Package net.sf.basedb.core
Class Sample
- All Implemented Interfaces:
AccessControlled
,Annotatable
,Identifiable
,Listable
,Nameable
,Ownable
,Registered
,Removable
,Shareable
,Subtypable
This class is used to represent sample items. A sample is the
actual sample taken from a
BioSource
. A sample
can also be created by combining other samples into a new sample.
A process is known as pooling. It is also possible to create
standalone samples, with no reference to a biosource or to other
samples.- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
-
Nested Class Summary
Nested classes/interfaces inherited from class net.sf.basedb.core.MeasuredBioMaterial
MeasuredBioMaterial.RemainingQuantityAction
-
Field Summary
Fields inherited from class net.sf.basedb.core.BioMaterial
MAX_EXTERNAL_ID_LENGTH
Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
countChildren
(boolean samples) Count the number of child samples or extracts.long
Counts all extracts that have been created from this sample.long
Counts all samples that have been created from this sample.static Sample
Get anSample
item when you know the id.Creates a query that returns all child (pooled) samples that has this sample as one of it's sources.(package private) SampleData
getData()
Get theBasicData
object that holds all data for this item.Get a query that returns all extracts created from this sample.Get the subtype of the item.static Sample
Create a newSample
item.static Sample
getNew
(DbControl dc, BioPlateEventParticipant master) Create a newSample
item as part of a master bioplate event.getQuery()
Get a query that returns samples.getType()
Get the type of item represented by the object.Get all:Extract
:s created from this sample Pooled samplesboolean
isUsed()
newExtract
(Float usedQuantity) Create a newExtract
from this sample.newExtract
(Float usedQuantity, BioPlateEventParticipant master) Create a newExtract
from this sample as part of a master bioplate event.Methods inherited from class net.sf.basedb.core.MeasuredBioMaterial
breakCircularReferences, getAnnotatableParents, getAnnotatableParents, getBioWell, getCreationEvent, getEntryDate, getEvents, getOriginalQuantity, getParent, getParentType, getProtocol, getRemainingQuantity, hasSingleParent, isInWell, isLockedInWell, newEvent, newEvent, onBeforeCommit, setBioPlateEventParticipant, setBioWell, setEntryDate, setOriginalQuantity, updateRemainingQuantity
Methods inherited from class net.sf.basedb.core.BioMaterial
getChildCreationEvents, getExternalId, setExternalId, setItemSubtype
Methods inherited from class net.sf.basedb.core.AnnotatedItem
getAnnotationSet, isAnnotated, removeAnnotations
Methods inherited from class net.sf.basedb.core.CommonItem
getDescription, getName, getRemovedBy, isRemoved, setDescription, setName, setRemoved
Methods inherited from class net.sf.basedb.core.SharedItem
getItemKey, getProjectKey, initPermissions, isShared, setItemKey, setProjectKey
Methods inherited from class net.sf.basedb.core.OwnedItem
getOwner, isOwner, setOwner, takeOwnership
Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, validate
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getVersion
Methods inherited from interface net.sf.basedb.core.Nameable
getDescription, getName, setDescription, setName
Methods inherited from interface net.sf.basedb.core.Ownable
getOwner, isOwner, setOwner, takeOwnership
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
-
Constructor Details
-
Sample
Sample(SampleData sampleData)
-
-
Method Details
-
getNew
Create a newSample
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access- Returns:
- The new
Sample
item - Throws:
BaseException
- If there is an error
-
getNew
Create a newSample
item as part of a master bioplate event.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessmaster
- The master bioplate event participant or null- Returns:
- The new
Sample
item - Throws:
BaseException
- If there is an error- Since:
- 2.17
-
getById
public static Sample getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get anSample
item when you know the id.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access.id
- The id of the item to load- Returns:
- The
Sample
item - Throws:
ItemNotFoundException
- If an item with the specified id is not foundPermissionDeniedException
- If the logged in user doesn't have read permission to the itemBaseException
- If there is another error
-
getQuery
Get a query that returns samples.- Returns:
- An
ItemQuery
object
-
getData
SampleData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.- Overrides:
getData
in classMeasuredBioMaterial
-
getType
Description copied from interface:Identifiable
Get the type of item represented by the object. The returned value is one of the values defined in theItem
enumeration.- Returns:
- A value indicating the type of item
-
getItemSubtype
@SupportsPushAnnotations @SubtypableRelatedItems({PROTOCOL,KIT,HARDWARE,BIOSOURCE,SAMPLE}) public ItemSubtype getItemSubtype()Description copied from interface:Subtypable
Get the subtype of the item.- Specified by:
getItemSubtype
in interfaceSubtypable
- Overrides:
getItemSubtype
in classMeasuredBioMaterial
- Returns:
- A subtype of null if not set
- See Also:
-
isUsed
Check that:- Overrides:
isUsed
in classMeasuredBioMaterial
- Returns:
- TRUE if this item is used, FALSE otherwise
- Throws:
BaseException
- If not able to tell if item is used or not.- See Also:
-
getUsingItems
Get all:Extract
:s created from this sample- Pooled samples
- Overrides:
getUsingItems
in classMeasuredBioMaterial
- Returns:
- A set containing proxies for the items, or an empty set if no items are using this item
- Since:
- 2.2
- See Also:
-
newExtract
Create a newExtract
from this sample.- Parameters:
usedQuantity
- The quantity used from this sample or null if not known- Returns:
- The new
Extract
item - Throws:
PermissionDeniedException
- If the logged in user doesn't have use permission for this sampleBaseException
- If there is another error
-
newExtract
public Extract newExtract(Float usedQuantity, BioPlateEventParticipant master) throws PermissionDeniedException, BaseException Create a newExtract
from this sample as part of a master bioplate event.- Parameters:
usedQuantity
- The quantity used from this sample or null if not knownmaster
- The master bioplate event participant or null- Returns:
- The new
Extract
item - Throws:
PermissionDeniedException
- If the logged in user doesn't have use permission for this sampleBaseException
- If there is another error- Since:
- 2.17
-
getExtracts
Get a query that returns all extracts created from this sample.- Returns:
- An
ItemQuery
object - Throws:
BaseException
- If the query couldn't be created.
-
getChildSamples
Creates a query that returns all child (pooled) samples that has this sample as one of it's sources.- Returns:
- A query
- Since:
- 2.10
-
countExtracts
Counts all extracts that have been created from this sample. The count includes extracts that the logged in user doesn't have access to.- Returns:
- The number of extracts
- Throws:
BaseException
- If there is some kind of error.
-
countSamples
Counts all samples that have been created from this sample. The count includes samples that the logged in user doesn't have access to.- Returns:
- The number of samples
- Throws:
BaseException
- If there is some kind of error.- Since:
- 2.16
-
countChildren
public long countChildren(boolean samples) Count the number of child samples or extracts.- Specified by:
countChildren
in classBioMaterial
- Parameters:
samples
- TRUE = count child samples, FALSE = count child extracts- Since:
- 2.16
-