2.17.2: 2011-06-17

net.sf.basedb.core
Class PlateType

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<PlateTypeData>
                  extended by net.sf.basedb.core.PlateType
All Implemented Interfaces:
AccessControlled, Identifiable, Nameable, Ownable, Registered, Removable, Shareable

public class PlateType
extends CommonItem<PlateTypeData>
implements Registered

This class represents plate types, which is a name, description, geometry and a list of event types.

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

Field Summary
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
PlateType(PlateTypeData plateTypeData)
           
 
Method Summary
static PlateType getById(DbControl dc, int id)
          Get a PlateType item when you know the id.
 Date getEntryDate()
          Get the date that the item was registered in the database.
 ItemQuery<PlateEventType> getEventTypes()
          Get a query that returns all event types for this plate type.
static PlateType getNew(DbControl dc, PlateGeometry plateGeometry)
          Create a new PlateType item.
 PlateGeometry getPlateGeometry()
          Get the PlateGeometry of this plate type.
 ItemQuery<Plate> getPlates()
          Get a query that returns all plates of this plate type.
static ItemQuery<PlateType> getQuery()
          Get a query that returns plate types.
 Item getType()
          Get the type of item represented by the object.
 Set<ItemProxy> getUsingItems()
          Get all: Plate:s created from this plate type
 boolean isUsed()
          Check if: Any Plate:s of this type exists
 PlateEventType newEventType()
          Create a new event type for this plate type.
 Plate newPlate()
          Create a new plate of this plate type.
private  void setPlateGeometry(PlateGeometry plateGeometry)
          Set the plate geometry of this plate type.
 
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.PLATETYPE, getType()
Constructor Detail

PlateType

PlateType(PlateTypeData plateTypeData)
Method Detail

getNew

public static PlateType getNew(DbControl dc,
                               PlateGeometry plateGeometry)
                        throws BaseException
Create a new PlateType item.

Parameters:
dc - The DbControl which will be used for permission checking and database access
plateGeometry - The geometry of the new plate type
Returns:
The new PlateType item
Throws:
PermissionDeniedException - If the loggged in user doesn't have use permission for the geometry
InvalidDataException - If the geometry is null
BaseException - If there is an error

getById

public static PlateType getById(DbControl dc,
                                int id)
                         throws ItemNotFoundException,
                                PermissionDeniedException,
                                BaseException
Get a PlateType 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 PlateType item
Throws:
ItemNotFoundException - If an item with the specified id is not found
PermissionDeniedException - If the logged in user doesn't have Permission.READ permission to the item
BaseException - If there is another error

getQuery

public static ItemQuery<PlateType> getQuery()
Get a query that returns plate types.

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

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
Check if:

Overrides:
isUsed in class BasicItem<PlateTypeData>
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()
Get all:

getPlateGeometry

public PlateGeometry getPlateGeometry()
                               throws PermissionDeniedException,
                                      BaseException
Get the PlateGeometry of this plate type.

Returns:
The PlateGeometry item
Throws:
PermissionDeniedException - If the logged in user doesn't have Permission.READ permission for the plate geometry
BaseException - If there is another error

setPlateGeometry

private void setPlateGeometry(PlateGeometry plateGeometry)
                       throws PermissionDeniedException,
                              InvalidDataException
Set the plate geometry of this plate type.

Throws:
PermissionDeniedException - If the logged in user doesn't have use permission for the geometry
InvalidDataException - If the geometry is null

newEventType

public PlateEventType newEventType()
                            throws PermissionDeniedException,
                                   BaseException
Create a new event type for this plate type.

Returns:
The new PlateEventType item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission for this plate type
BaseException - If there is another error

getEventTypes

public ItemQuery<PlateEventType> getEventTypes()
Get a query that returns all event types for this plate type.

Returns:
An ItemQuery object

newPlate

public Plate newPlate()
               throws PermissionDeniedException,
                      BaseException
Create a new plate of this plate type.

Returns:
The new Plate item
Throws:
PermissionDeniedException - If the logged in user doesn't have use permission for this plate type
BaseException - If there is another error

getPlates

public ItemQuery<Plate> getPlates()
Get a query that returns all plates of this plate type.

Returns:
An ItemQuery object

2.17.2: 2011-06-17