2.17.2: 2011-06-17

net.sf.basedb.core
Class ArraySlide

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<D>
      extended by net.sf.basedb.core.OwnedItem<D>
          extended by net.sf.basedb.core.SharedItem<D>
              extended by net.sf.basedb.core.CommonItem<D>
                  extended by net.sf.basedb.core.AnnotatedItem<ArraySlideData>
                      extended by net.sf.basedb.core.ArraySlide
All Implemented Interfaces:
AccessControlled, Annotatable, Identifiable, Nameable, Ownable, Registered, Removable, Shareable

public class ArraySlide
extends AnnotatedItem<ArraySlideData>
implements Registered

This class represents a physical microarray slide.

Version:
2.0
Author:
Nicklas, Enell

Field Summary
static int MAX_BARCODE_LENGTH
          The maximum length of the barcode that can be stored in the database.
static Item TYPE
          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
ArraySlide(ArraySlideData data)
           
 
Method Summary
static boolean barcodeExists(DbControl dc, String barcode)
          Checks if a slide with the given barcode already exists in the database.
 Set<Annotatable> getAnnotatableParents()
          Get the array batch.
 ArrayBatch getArrayBatch()
          Get the ArrayBatch item to which this slide belongs.
 String getBarcode()
          Get the barcode of the slide.
 int getBatchIndex()
          Get the index of this slide in the batch.
static ArraySlide getById(DbControl dc, int id)
          Get a ArraySlide object when you know the ID.
 Date getEntryDate()
          Get the date that the item was registered in the database.
 Hybridization getHybridization()
          Get the Hybridization item which was used on this slide.
static ArraySlide getNew(DbControl dc, ArrayBatch arrayBatch)
          Create a new ArraySlide item.
static ItemQuery<ArraySlide> getQuery()
          Get a ItemQuery object configured to retrieve array slides.
 Item getType()
          Get the type of item represented by the object.
 Set<ItemProxy> getUsingItems()
          Get the hybridization that was used on this plate.
 boolean isDestroyed()
          Check if the slide is flagged as destroyed or not.
 boolean isUsed()
          Check if this item is used by some other item.
 boolean isUsedByOther(Hybridization hyb)
          Checks if this array design is used by a different hybridization than the given one.
private  void setArrayBatch(ArrayBatch arrayBatch)
          Set the ArrayBatch this arrayslide belongs to.
 void setBarcode(String barcode)
          Set the barcode for the slide.
 void setBatchIndex(int batchIndex)
          Set the index of this slide in the batch.
 void setDestroyed(boolean destroyed)
          Set if the slide should be flagged as destroyed.
 
Methods inherited from class net.sf.basedb.core.AnnotatedItem
getAnnotationSet, getProtocol, isAnnotated, removeAnnotations, toTransferable
 
Methods inherited from class net.sf.basedb.core.CommonItem
getDescription, getName, isRemoved, setDescription, setName, setRemoved, toTransferable
 
Methods inherited from class net.sf.basedb.core.SharedItem
getItemKey, getProjectKey, initPermissions, isShared, onBeforeCommit, setItemKey, setProjectKey, toTransferable
 
Methods inherited from class net.sf.basedb.core.OwnedItem
getOwner, isOwner, setOwner, takeOwnership, toTransferable
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getVersion
 
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
 
Methods inherited from interface net.sf.basedb.core.Ownable
getOwner, isOwner, setOwner, takeOwnership
 

Field Detail

TYPE

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

See Also:
Item.ARRAYSLIDE, getType()

MAX_BARCODE_LENGTH

public static final int MAX_BARCODE_LENGTH
The maximum length of the barcode that can be stored in the database. Check the length against this value before calling the setBarcode method to avoid exceptions.

See Also:
Constant Field Values
Constructor Detail

ArraySlide

ArraySlide(ArraySlideData data)
Method Detail

getNew

public static ArraySlide getNew(DbControl dc,
                                ArrayBatch arrayBatch)
                         throws PermissionDeniedException,
                                BaseException
Create a new ArraySlide item.

Parameters:
dc - The DbControl which will be used for permission checking and database access
arrayBatch - The ArrayBatch this slide belongs to
Returns:
The new ArraySlide item
Throws:
PermissionDeniedException - If the logged in user doesn't have use permission for the array batch
BaseException - If there is another error

getById

public static ArraySlide getById(DbControl dc,
                                 int id)
                          throws ItemNotFoundException,
                                 PermissionDeniedException,
                                 BaseException
Get a ArraySlide object 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 ArraySlide 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

barcodeExists

public static boolean barcodeExists(DbControl dc,
                                    String barcode)
Checks if a slide with the given barcode already exists in the database. The check is done on ALL slides, even on those not normally accessible by the logged in user.

Parameters:
dc - The DbControl to use for database access
barcode - The barcode to check
Returns:
TRUE if the barcode exists, FALSE if not or if the argument is NULL
Since:
2.7

getQuery

public static ItemQuery<ArraySlide> getQuery()
Get a ItemQuery object configured to retrieve array slides.

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.

Specified by:
getType in interface Identifiable
Returns:
A value indicating the type of item

getAnnotatableParents

public Set<Annotatable> getAnnotatableParents()
                                       throws BaseException
Get the array batch.

Specified by:
getAnnotatableParents in interface Annotatable
Returns:
A set containing annotatable items, or null
Throws:
BaseException - If there is an error

getEntryDate

public Date getEntryDate()
Description copied from interface: Registered
Get the date that the item was registered in the database.

Specified by:
getEntryDate in interface Registered
Returns:
A date or null if this is not known

isUsed

public boolean isUsed()
               throws BaseException
Description copied from class: BasicItem
Check if this item is used by some other item. With used we mean that another item is linking to this item in way that prevents this item from beeing deleted. Ie. if we tried to delete an item that is used, we would get a foreign key violation error from the database. If the subclass overrides this method it should propagate the call to the superclass, ie. super.isUsed(), unless it has decided that the item is used by some other means.

Overrides:
isUsed in class BasicItem<ArraySlideData>
Returns:
TRUE if this item is used, FALSE otherwise
Throws:
BaseException - If not able to tell if item is used or not.
See Also:
BasicItem.getUsingItems()

getUsingItems

public Set<ItemProxy> getUsingItems()
                             throws BaseException
Get the hybridization that was used on this plate.

Overrides:
getUsingItems in class BasicItem<ArraySlideData>
Returns:
A set containing proxies for the items, or an empty set if no items are using this item
Throws:
BaseException - If there is an error loading the items
Since:
2.2
See Also:
BasicItem.addUsingItems(Set, Item, org.hibernate.Query)

getBatchIndex

public int getBatchIndex()
Get the index of this slide in the batch.

Returns:
The index of the slide

setBatchIndex

public void setBatchIndex(int batchIndex)
                   throws PermissionDeniedException
Set the index of this slide in the batch.

Parameters:
batchIndex - The index of the slide in the batch
Throws:
PermissionDeniedException - This exception is thrown if the logged in user doesn't have write permission.

getBarcode

public String getBarcode()
Get the barcode of the slide.

Returns:
A string with the barcode sequence

setBarcode

public void setBarcode(String barcode)
                throws PermissionDeniedException,
                       InvalidDataException
Set the barcode for the slide. The value can be null and must not be longer than the value specified by the MAX_BARCODE_LENGTH constant.

Parameters:
barcode - The new barcode for the slide
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - This exception is thrown if the barcode is longer than MAX_BARCODE_LENGTH

isDestroyed

public boolean isDestroyed()
Check if the slide is flagged as destroyed or not. A destroyed slide may not be connected to a hybridization.

Returns:
TRUE if the slide is destroyed, FALSE otherwise

setDestroyed

public void setDestroyed(boolean destroyed)
                  throws PermissionDeniedException
Set if the slide should be flagged as destroyed. A destroyed slide may not be connected to a hybridization.

Parameters:
destroyed - true if the slide should be flagged as destroyed, false otherwise
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission

getArrayBatch

public ArrayBatch getArrayBatch()
                         throws PermissionDeniedException,
                                BaseException
Get the ArrayBatch item to which this slide belongs.

Returns:
The ArrayBatch item
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission for the array batch
BaseException - If there is another error

setArrayBatch

private void setArrayBatch(ArrayBatch arrayBatch)
                    throws InvalidDataException,
                           PermissionDeniedException
Set the ArrayBatch this arrayslide belongs to.

Parameters:
arrayBatch - the arrayBatch to be set. Cannot be null.
Throws:
InvalidDataException - If the arrayBatch is null
PermissionDeniedException - If the logged in user doesn't have use permission for the batch

getHybridization

public Hybridization getHybridization()
                               throws PermissionDeniedException,
                                      BaseException
Get the Hybridization item which was used on this slide. To set the hybridization use the Hybridization.setArraySlide(ArraySlide) method.

Returns:
The Hybridization item
Throws:
PermissionDeniedException - This exception is thrown if the logged in user doesn't have read permission to the item
BaseException - If there is another error

isUsedByOther

public boolean isUsedByOther(Hybridization hyb)
Checks if this array design is used by a different hybridization than the given one.

Parameters:
hyb - The hybridization to check, or null to check if the slide is used by any hybridization
Returns:
TRUE if the slide is used by a different hybridization, or FALSE if it is used by the given hybridization, or not used at all
Since:
2.8.3

2.17.2: 2011-06-17