Package net.sf.basedb.core
Class BioMaterial
- All Implemented Interfaces:
AccessControlled
,Annotatable
,Identifiable
,Listable
,Nameable
,Ownable
,Removable
,Shareable
,Subtypable
- Direct Known Subclasses:
BioSource
,MeasuredBioMaterial
- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2015-04-17 14:02:22 +0200 (fr, 17 apr 2015) $
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximum length of the external id that can be stored in the database.Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract long
countChildren
(boolean pooled) Count the number of already existing children to this biomaterial.Get all child biomaterial items with a subtype that has theItemSubtype.getPushAnnotations()
flag set.static BioMaterial
Get a biomaterial item when you know the id.Get a query returning all events where this biomaterial has been used as a source item.(package private) BioMaterialData
getData()
Get theBasicData
object that holds all data for this item.Get the external id of the biomaterial.Get the subtype of the item.void
setExternalId
(String externalId) Set the external id of the biomaterial.void
setItemSubtype
(ItemSubtype subtype) Set the subtype on the item.Methods inherited from class net.sf.basedb.core.AnnotatedItem
getAnnotationSet, getProtocol, 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, onBeforeCommit, 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, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, 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, getType, 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
-
MAX_EXTERNAL_ID_LENGTH
public static final int MAX_EXTERNAL_ID_LENGTHThe maximum length of the external id that can be stored in the database.- See Also:
-
-
Constructor Details
-
BioMaterial
BioMaterial(BioMaterialData bioMaterialData)
-
-
Method Details
-
getById
Get a biomaterial item when you know the id. This method can return any of the subclasses ofBioMaterial
. Eg.BioSource
,Sample
orExtract
.- 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- Since:
- 2.17
-
getData
BioMaterialData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.- Overrides:
getData
in classAnnotatedItem
-
getItemSubtype
Description copied from interface:Subtypable
Get the subtype of the item.- Specified by:
getItemSubtype
in interfaceSubtypable
- Returns:
- A subtype of null if not set
- See Also:
-
setItemSubtype
Description copied from interface:Subtypable
Set the subtype on the item.- Specified by:
setItemSubtype
in interfaceSubtypable
- Parameters:
subtype
- A subtype or null- See Also:
-
getAnnotatableParents
Get all child biomaterial items with a subtype that has theItemSubtype.getPushAnnotations()
flag set.- Specified by:
getAnnotatableParents
in interfaceAnnotatable
- Returns:
- A set containing annotatable items, or null
- Throws:
BaseException
- If there is an error- Since:
- 3.1
-
getExternalId
Get the external id of the biomaterial. This value can be used to link with information in external databases. It is not used by the BASE core and it doesn't have to be unique.- Returns:
- The external id for the biomaterial
-
setExternalId
Set the external id of the biomaterial. The value may be null but must not be longer than the value specified by theMAX_EXTERNAL_ID_LENGTH
constant.- Parameters:
externalId
- The new value for the external id- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the string is too long
-
countChildren
public abstract long countChildren(boolean pooled) Count the number of already existing children to this biomaterial. The count includes items that the logged in user doesn't have access to.- Parameters:
pooled
- If TRUE, the count is for biomaterials of the same type, if FALSE the count is for biomaterials of the child type- Since:
- 2.16
-
getChildCreationEvents
Get a query returning all events where this biomaterial has been used as a source item.- Returns:
- A special query
- Since:
- 3.0
-