Last update: 2011-06-23

org.proteios.core
Class Sample

java.lang.Object
  extended by org.proteios.core.BasicItem<D>
      extended by org.proteios.core.OwnedItem<D>
          extended by org.proteios.core.SharedItem<D>
              extended by org.proteios.core.CommonItem<D>
                  extended by org.proteios.core.AnnotatedItem<D>
                      extended by org.proteios.core.BioMaterial<D>
                          extended by org.proteios.core.MeasuredBioMaterial<SampleData>
                              extended by org.proteios.core.Sample
All Implemented Interfaces:
AccessControlled, Annotatable, Identifiable, Nameable, Ownable, Removable, Shareable

public class Sample
extends MeasuredBioMaterial<SampleData>

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: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $

Field Summary
static Item TYPE
          The type of item represented by this class.
 
Fields inherited from class org.proteios.core.BioMaterial
MAX_EXTERNAL_ID_LENGTH, MAX_STORAGE_LOCATION_LENGTH
 
Fields inherited from interface org.proteios.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
 
Method Summary
 Set<Annotatable> getAnnotatableParents()
          Get the biosource or pooled samples.
 BioSource getBioSource()
          Get the BioSource that is the parent of this sample.
static Sample getById(DbControl dc, int id)
          Get an Sample item when you know the id.
 ItemQuery<Extract> getExtracts()
          Get a query that returns all extracts created from this sample.
static ItemQuery<Sample> getQuery()
          Get a query that returns samples.
 Item getType()
          Get the type of item represented by the object.
 boolean isUsed()
          Check that: no Extract:s has been created from this item no Sample:s has been created from this item
 void setBioSource(BioSource bioSource)
          Set the BioSource item that is the the parent of this sample.
 
Methods inherited from class org.proteios.core.MeasuredBioMaterial
getConcentrationInGramsPerLiter, getCreationEvent, getEventQuery, getEvents, getOriginalQuantityInMicroLiters, getRemainingQuantityInMicroLiters, isPooled, setConcentrationInGramsPerLiter, setCreationEvent, setOriginalQuantityInMicroLiters, setPooled, setRemainingQuantityInMicroLiters
 
Methods inherited from class org.proteios.core.BioMaterial
addFile, getExternalId, getFiles, getStorageLocation, setExternalId, setFiles, setStorageLocation
 
Methods inherited from class org.proteios.core.CommonItem
getDescription, getName, isRemoved, setDescription, setName, setRemoved
 
Methods inherited from class org.proteios.core.SharedItem
getItemKey, getProjectKey, isShared, setItemKey, setProjectKey
 
Methods inherited from class org.proteios.core.OwnedItem
getOwner, setOwner
 
Methods inherited from class org.proteios.core.BasicItem
checkPermission, equals, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.proteios.core.Identifiable
getId, getVersion
 
Methods inherited from interface org.proteios.core.AccessControlled
checkPermission, hasPermission
 
Methods inherited from interface org.proteios.core.Ownable
getOwner, setOwner
 

Field Detail

TYPE

public static final Item TYPE
The type of item represented by this class.

See Also:
Item.SAMPLE, getType()
Method Detail

getById

public static Sample getById(DbControl dc,
                             int id)
                      throws ItemNotFoundException,
                             PermissionDeniedException,
                             BaseException
Get an Sample item when you know the id.

Parameters:
dc - The DbControl 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 found
PermissionDeniedException - If the logged in user doesn't have read permission to the item
BaseException - If there is another error

getQuery

public static ItemQuery<Sample> getQuery()
Get a query that returns samples.

Returns:
An ItemQuery object

getType

public Item 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 the Item enumeration.

Returns:
A value indicating the type of item

getAnnotatableParents

public Set<Annotatable> getAnnotatableParents()
                                       throws BaseException
Get the biosource or pooled samples.

Throws:
BaseException

isUsed

public boolean isUsed()
               throws BaseException
Check that:

Overrides:
isUsed in class MeasuredBioMaterial<SampleData>
Returns:
TRUE if this item is used, FALSE otherwise
Throws:
BaseException

getBioSource

public BioSource getBioSource()
                       throws PermissionDeniedException,
                              BaseException
Get the BioSource that is the parent of this sample.

Returns:
A BioSource object or null if this is a pooled or standalone sample
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission for the biosource
BaseException - If there is another error

setBioSource

public void setBioSource(BioSource bioSource)
                  throws PermissionDeniedException,
                         InvalidDataException
Set the BioSource item that is the the parent of this sample.

Parameters:
bioSource - The parent BioSource item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission for this sample or use permission for the biosource
InvalidDataException - If this is a pooled sample
BaseException - If there is another error

getExtracts

public ItemQuery<Extract> getExtracts()
                               throws BaseException
Get a query that returns all extracts created from this sample.

Returns:
An ItemQuery object
Throws:
BaseException

Last update: 2011-06-23