Package net.sf.basedb.core
Class Protocol
- All Implemented Interfaces:
AccessControlled
,Annotatable
,FileAttachable
,Identifiable
,Nameable
,Ownable
,Registered
,Removable
,Shareable
,Subtypable
This class is used to represent individual protocol items
and information about them.
- Version:
- 2.0
- Author:
- enell
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The ID for the alignment protocol type, for example a protocol used when creating aDerivedBioAssay
representing data that has been aligned against a reference genome.static final String
The ID for the cluster generation (in a flow cell) protocol type, for example a protocol used when creating aPhysicalBioAssay
.static final String
static final String
The ID for the feature extraction protocol type, for example a protocol used for analysing one or more images to create a raw data file.static final String
The ID for the hybridization protocol type, for example a protocol used when creating aPhysicalBioAssay
from a set of (labeled)Extract
:s.static final String
The ID for the labeling protocol type, for example a protocol used when creating a labeled extract from anExtract
.static final String
The ID for the library preparation protocol type, for example a protocol used when creating a library extract from anExtract
.static final int
The maximum length of the external id that can be stored in the database.static final String
static final String
The ID for the printing protocol type, for example a protocol used when printing a batch of array slides using a print robot.static final String
static final String
The ID for the scanning protocol type, for example a protocol used for scanning the microarray slide after an experiment.static final String
The ID for the sequencing protocol type, for example a protocol used when creating aDerivedBioAssay
from aPhysicalBioAssay
static final Item
The type of item represented by this class.Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addParameter
(AnnotationType annotationType) Add an annotation type as a parameter to this protocol.Get all parents objects which are annotatable and the logged in user has read permission to.static Protocol
Get aProtocol
item when you know the ID.(package private) ProtocolData
getData()
Get theBasicData
object that holds all data for this item.static String
getDefaultSystemId
(Item itemType) Get the system id for the protocol subtype that should be used on an item that doesn't have a subtype.Get the date that the item was registered in the database.Get the external id of the protocol.getFile()
Get the file that is attached to the item.Get the subtype of the item.static Protocol
Create a newProtocol
item.Get a query that returns all annotation types used as parameters for this protocol.getQuery()
Get a query configured to retrieve protocols.getType()
Get the type of item represented by the object.Get all: aBioMaterial
:s andPhysicalBioAssay
:s using this protocol aPlate
:s using this protocol anArrayBatch
:s using this protocol aDerivedBioAssay
:s using this protocol aRawBioAssay
:s using this protocolboolean
isParameter
(Annotation annotation) Check if the annotation is parameter to this protocol.boolean
isParameter
(AnnotationType annotationType) Check if the annotation type is a parameter to this protocol.boolean
isUsed()
Check if this protocol is used by: aBioMaterialEvent
aPlateEvent
anArrayBatch
aDerivedBioAssay
aRawBioAssay
void
removeParameter
(AnnotationType annotationType) Remove an annotation type from the parameters for this protocol.void
setEntryDate
(Date entryDate) Set the date the entry was registered in the database.void
setExternalId
(String externalId) Set the external id of the protocol.void
Attach a file to the item.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, 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.Ownable
getOwner, isOwner, setOwner, takeOwnership
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
SAMPLING
The ID for the sampling protocol type, for example a protocol used when creating aSample
from aBioSource
.- Since:
- 3.0
- See Also:
-
EXTRACTION
The ID for the extraction protocol type, for example a protocol used when creating anExtract
from aSample
.- Since:
- 3.0
- See Also:
-
LABELING
The ID for the labeling protocol type, for example a protocol used when creating a labeled extract from anExtract
.- Since:
- 3.0
- See Also:
-
LIBRARY_PREPARATION
The ID for the library preparation protocol type, for example a protocol used when creating a library extract from anExtract
.- Since:
- 3.0
- See Also:
-
POOLING
The ID for the pooling protocol type, for example a protocol used when creating a biomaterial item (Sample
orExtract
) from a set of other biomaterial items.- Since:
- 3.0
- See Also:
-
HYBRIDIZATION
The ID for the hybridization protocol type, for example a protocol used when creating aPhysicalBioAssay
from a set of (labeled)Extract
:s.- Since:
- 3.0
- See Also:
-
CLUSTER_GENERATION
The ID for the cluster generation (in a flow cell) protocol type, for example a protocol used when creating aPhysicalBioAssay
.- Since:
- 3.0
- See Also:
-
SEQUENCING
The ID for the sequencing protocol type, for example a protocol used when creating aDerivedBioAssay
from aPhysicalBioAssay
- Since:
- 3.0
- See Also:
-
ALIGNMENT
The ID for the alignment protocol type, for example a protocol used when creating aDerivedBioAssay
representing data that has been aligned against a reference genome.- Since:
- 3.0
- See Also:
-
PRINTING
The ID for the printing protocol type, for example a protocol used when printing a batch of array slides using a print robot.- Since:
- 3.0
- See Also:
-
SCANNING
The ID for the scanning protocol type, for example a protocol used for scanning the microarray slide after an experiment.- Since:
- 3.0
- See Also:
-
FEATURE_EXTRACTION
The ID for the feature extraction protocol type, for example a protocol used for analysing one or more images to create a raw data file.- Since:
- 3.0
- See Also:
-
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.- Since:
- 2.15
- See Also:
-
-
Constructor Details
-
Protocol
Protocol(ProtocolData data) Creates a new protocol item.- Parameters:
data
- the data
-
-
Method Details
-
getDefaultSystemId
Get the system id for the protocol subtype that should be used on an item that doesn't have a subtype. This includesSubtypable
items with a nullItemSubtype
and all other non-subtypable items which can be linked to a protocol.- Parameters:
itemType
- The item type- Returns:
- The system id of the default protocol or null
- Since:
- 3.0
-
getNew
Create a newProtocol
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access- Returns:
- The new
Protocol
item - Throws:
BaseException
- If there is an error
-
getById
public static Protocol getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aProtocol
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
Protocol
item - Throws:
ItemNotFoundException
- This exception is thrown if an item with the specified ID is not foundPermissionDeniedException
- This exception is thrown if the logged in user doesn't haveREAD
permission to the itemBaseException
- This exception is thrown if there is another error
-
getQuery
Get a query configured to retrieve protocols.- Returns:
- An
ItemQuery
object
-
getData
ProtocolData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.- Overrides:
getData
in classAnnotatedItem
-
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.- Specified by:
getType
in interfaceIdentifiable
- Returns:
- A value indicating the type of item
-
getFile
Description copied from interface:FileAttachable
Get the file that is attached to the item.- Specified by:
getFile
in interfaceFileAttachable
- Returns:
- A
File
item, or null if no file is attached - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission for the fileBaseException
- If there is another error
-
setFile
Description copied from interface:FileAttachable
Attach a file to the item.- Specified by:
setFile
in interfaceFileAttachable
- Parameters:
file
- The file to attach to the item- Throws:
PermissionDeniedException
- If the logged in user doesn't have use permission for the file or write permission for the item
-
getEntryDate
Description copied from interface:Registered
Get the date that the item was registered in the database.- Specified by:
getEntryDate
in interfaceRegistered
- Returns:
- A date or null if this is not known
-
setEntryDate
Description copied from interface:Registered
Set the date the entry was registered in the database. Implementations should only allow this property to be set before the item is first stored in the database. The intention of this method is to facilitate export/import of data between server.- Specified by:
setEntryDate
in interfaceRegistered
- Parameters:
entryDate
- A date or null to use today's date
-
getAnnotatableParents
Description copied from interface:Annotatable
Get all parents objects which are annotatable and the logged in user has read permission to. If the item doesn't have any annotatable parents, it may return null or an empty set. The method should only return the immediate parent(s), not parents to parents, etc. As of BASE 3.1 this method may also return child items if the child item is aSubtypable
item that has a subtype with theItemSubtype.getPushAnnotations()
flag set.- Specified by:
getAnnotatableParents
in interfaceAnnotatable
- Returns:
- Always null
- Since:
- 2.12
-
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:
-
isUsed
Check if this protocol is used by:- Overrides:
isUsed
in classBasicItem
- 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:- a
BioMaterial
:s andPhysicalBioAssay
:s using this protocol - a
Plate
:s using this protocol - an
ArrayBatch
:s using this protocol - a
DerivedBioAssay
:s using this protocol - a
RawBioAssay
:s using this protocol
- Overrides:
getUsingItems
in classBasicItem
- Returns:
- A set containing proxies for the items, or an empty set if no items are using this item
- Since:
- 2.2
- See Also:
- a
-
getExternalId
Get the external id of the protocol. 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 protocol
- Since:
- 2.15
-
setExternalId
Set the external id of the protocol. 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- Since:
- 2.15
-
addParameter
public void addParameter(AnnotationType annotationType) throws PermissionDeniedException, InvalidDataException Add an annotation type as a parameter to this protocol.- Parameters:
annotationType
- The annotation type to add to this protocol- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.WRITE
permission for the protocol andPermission.USE
for the annotation typeInvalidDataException
- If the annotationType is null, or theAnnotationType.isProtocolParameter()
doesn't return true- Since:
- 2.2
-
removeParameter
public void removeParameter(AnnotationType annotationType) throws PermissionDeniedException, InvalidDataException Remove an annotation type from the parameters for this protocol.- Parameters:
annotationType
- The annotation type to remove from this protocol- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.WRITE
permission for the protocolInvalidDataException
- If the annotationType is null- Since:
- 2.2
-
isParameter
Check if the annotation type is a parameter to this protocol.- Parameters:
annotationType
- The annotation type to check, null always return false- Returns:
- TRUE if the annotation type is a parameter, FALSE otherwise
- Since:
- 2.2
- See Also:
-
isParameter
Check if the annotation is parameter to this protocol. This method is equivalent toisParameter(AnnotationType)
but is not affected by possible permission problems with the annotation type.- Parameters:
annotation
- The annotation to check, null always return false- Returns:
- TRUE if the annotation is a parameter, FALSE otherwise
- Since:
- 2.10
-
getParameters
Get a query that returns all annotation types used as parameters for this protocol.- Returns:
- An
ItemQuery
object - Since:
- 2.2
-