2.17.2: 2011-06-17

net.sf.basedb.core
Class AnnotatedItem<D extends AnnotatedData>

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<D>
Type Parameters:
D - Kind of annotated data the item is annotated with.
All Implemented Interfaces:
AccessControlled, Annotatable, Identifiable, Nameable, Ownable, Removable, Shareable
Direct Known Subclasses:
ArrayBatch, ArrayDesign, ArraySlide, BioMaterial, BioPlate, Hybridization, Plate, PluginConfiguration, Protocol, RawBioAssay, Scan

public abstract class AnnotatedItem<D extends AnnotatedData>
extends CommonItem<D>
implements Annotatable

This is a helper class for items that need to implement the Annotatable interface. Most of those items should be able to extend this class.

Version:
2.0
Author:
Nicklas
See Also:
Annotatable
Last modified
$Date: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

Field Summary
 
Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
 
Constructor Summary
AnnotatedItem(D annotatedData)
           
 
Method Summary
 AnnotationSet getAnnotationSet()
          Get the annotation set containing the annotations for this item.
 Protocol getProtocol()
          Default implementation returns null.
 boolean isAnnotated()
          Check if this item has an annotation set.
 void removeAnnotations()
          Remove all annotations from this item, by deleting the annotation set.
(package private)  AnnotatedItemInfo toTransferable(AnnotatedItemInfo info)
           
 
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, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, 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.Annotatable
getAnnotatableParents
 
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getType, 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
 

Constructor Detail

AnnotatedItem

AnnotatedItem(D annotatedData)
Method Detail

getAnnotationSet

public AnnotationSet getAnnotationSet()
                               throws PermissionDeniedException,
                                      BaseException
Description copied from interface: Annotatable
Get the annotation set containing the annotations for this item. If the item doesn't have any annotations a new annotation set is created and automatically saved to the database when DbControl.commit() is called. To check if an item has annotations without creating a new annotation set use the Annotatable.isAnnotated() method.

Specified by:
getAnnotationSet in interface Annotatable
Returns:
An AnnotationSet
Throws:
PermissionDeniedException - If the logged in user doesn't have enough permissions
BaseException - If there is another error

isAnnotated

public boolean isAnnotated()
Description copied from interface: Annotatable
Check if this item has an annotation set. The annotation set may be empty.

Specified by:
isAnnotated in interface Annotatable
Returns:
TRUE if an annotation set exists, FALSE otherwise

removeAnnotations

public void removeAnnotations()
                       throws PermissionDeniedException,
                              BaseException
Description copied from interface: Annotatable
Remove all annotations from this item, by deleting the annotation set.

Specified by:
removeAnnotations in interface Annotatable
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
BaseException - If there is another error

getProtocol

public Protocol getProtocol()
Default implementation returns null. Should be overriden by subclasses that has protocols.

Specified by:
getProtocol in interface Annotatable
Returns:
Always null
Since:
2.2

toTransferable

AnnotatedItemInfo toTransferable(AnnotatedItemInfo info)
Since:
2.5

2.17.2: 2011-06-17