2.17.2: 2011-06-17

net.sf.basedb.core
Class ExtraValueType

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<ExtraValueTypeData>
      extended by net.sf.basedb.core.ExtraValueType
All Implemented Interfaces:
AccessControlled, Identifiable, Nameable, Registered, Removable

public class ExtraValueType
extends BasicItem<ExtraValueTypeData>
implements Nameable, Removable, Registered

Defines extra values that can be calculated by plugins or some other application and inserted as part of a BioAssaySet. All extra value types must have a unique external id that is used for identification.

Currently only extra values of Type.INT, Type.FLOAT and Type.STRING are supported.

Version:
2.0
Author:
Nicklas
See Also:
ExtraValue, BioAssaySet.getSpotExtraValueBatcher(Class, ExtraValueType, Job), BioAssaySet.getPositionExtraValueBatcher(Class, ExtraValueType, Job)
Last modified
$Date: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

Field Summary
private  Coloring coloring
           
static int MAX_EXTERNAL_ID_LENGTH
          The maximum length of the external id variable 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
ExtraValueType(ExtraValueTypeData data)
          Creates a new extra value type item.
 
Method Summary
 Formula.AverageMethod getAverageMethod()
          Get the average method for this extra value type.
static ExtraValueType getByExternalId(DbControl dc, String externalId)
          Get a ExtraValueType when you know the external id.
static ExtraValueType getById(DbControl dc, int id)
          Get an ExtraValueType object when you know the id.
 Coloring getColoring()
          Get coloring information for this extra value.
 String getDescription()
          Get the description for the item.
 Date getEntryDate()
          Get the date that the item was registered in the database.
 String getExternalId()
          Get the external id for this ExtraValueType item.
 String getName()
          Get the name of the item.
static ExtraValueType getNew(DbControl dc, String externalId, Type valueType)
          Create a new ExtraValue item.
static ItemQuery<ExtraValueType> getQuery()
          Get a query configured to retrieve extra value types.
 Item getType()
          Get the type of item represented by the object.
 Set<ItemProxy> getUsingItems()
          Get all: ExtraValue:s of this type
 Type getValueType()
          Get the value type for this extra value type.
 boolean isRemoved()
          Check if the removed flag is set for this item.
 boolean isUsed()
          Check if: Any ExtraValue:s of this type exists
 void setAverageMethod(Formula.AverageMethod averageMethod)
          Set the average method of the extra value type..
 void setDescription(String description)
          Set the description for the item.
 void setExternalId(String externalId)
          Set the external id for this Client item.
 void setName(String name)
          Set the name of the item.
 void setRemoved(boolean removed)
          Set the removed flag for this item.
private  void setValueType(Type valueType)
          Set the value type for this extra value type.
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, initPermissions, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onBeforeCommit, 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
 

Field Detail

TYPE

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

See Also:
Item.EXTRAVALUETYPE, getType()

MAX_EXTERNAL_ID_LENGTH

public static final int MAX_EXTERNAL_ID_LENGTH
The maximum length of the external id variable that can be stored in the database. Check the length against this value before calling the setExternalId(String) method to avoid exceptions.

See Also:
Constant Field Values

coloring

private Coloring coloring
Constructor Detail

ExtraValueType

ExtraValueType(ExtraValueTypeData data)
Creates a new extra value type item.

Parameters:
data - The data
Method Detail

getNew

public static ExtraValueType getNew(DbControl dc,
                                    String externalId,
                                    Type valueType)
                             throws BaseException
Create a new ExtraValue item. Currently only extra values of Type.INT, Type.FLOAT and Type.STRING are supported.

Parameters:
dc - The DbControl which will be used for permission checking and database access
externalId - A unique string identifying the extra value type
valueType - The Type of the extra value
Returns:
The new ExtraValue item
Throws:
BaseException - If there is an error

getById

public static ExtraValueType getById(DbControl dc,
                                     int id)
                              throws ItemNotFoundException,
                                     PermissionDeniedException,
                                     BaseException
Get an ExtraValueType 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 ExtraValueType 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 items
BaseException - If there is an error

getByExternalId

public static ExtraValueType getByExternalId(DbControl dc,
                                             String externalId)
                                      throws ItemNotFoundException,
                                             PermissionDeniedException,
                                             BaseException
Get a ExtraValueType when you know the external id.

Parameters:
dc - The DbControl which will be used for database access.
externalId - The external id of the extra value type to load
Returns:
The ExtraValueType 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<ExtraValueType> getQuery()
Get a query configured to retrieve extra value 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

getName

public String getName()
Description copied from interface: Nameable
Get the name of the item.

Specified by:
getName in interface Nameable
Returns:
A String with the name of the item

setName

public void setName(String name)
             throws PermissionDeniedException,
                    InvalidDataException
Description copied from interface: Nameable
Set the name of the item. The name cannot be null and mustn't be longer than the value specified by the Nameable.MAX_NAME_LENGTH constant.

Specified by:
setName in interface Nameable
Parameters:
name - The new name for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the name is null or longer than specified by the Nameable.MAX_NAME_LENGTH constant

getDescription

public String getDescription()
Description copied from interface: Nameable
Get the description for the item.

Specified by:
getDescription in interface Nameable
Returns:
A String with a description of the item

setDescription

public void setDescription(String description)
                    throws PermissionDeniedException,
                           InvalidDataException
Description copied from interface: Nameable
Set the description for the item. The description can be null but mustn't be longer than the value specified by the Nameable.MAX_DESCRIPTION_LENGTH constant.

Specified by:
setDescription in interface Nameable
Parameters:
description - The new description for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the description longer than specified by the Nameable.MAX_DESCRIPTION_LENGTH constant

isRemoved

public boolean isRemoved()
Description copied from interface: Removable
Check if the removed flag is set for this item.

Specified by:
isRemoved in interface Removable
Returns:
TRUE if the item is flagged as removed, FALSE otherwise

setRemoved

public void setRemoved(boolean removed)
                throws PermissionDeniedException
Description copied from interface: Removable
Set the removed flag for this item.

Specified by:
setRemoved in interface Removable
Parameters:
removed - TRUE if the item should be flagged as removed, FALSE otherwise
Throws:
PermissionDeniedException - If the logged in user doesn't have Permission.DELETE permission for setting the flag to TRUE or Permission.WRITE permission for setting the flag to FALSE

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<ExtraValueTypeData>
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:

getValueType

public Type getValueType()
Get the value type for this extra value type. It can't be change once the object has been created.


setValueType

private void setValueType(Type valueType)
                   throws InvalidDataException
Set the value type for this extra value type. Null is not allowed and it must be one of the supported value types.

Throws:
InvalidDataException
See Also:
VirtualColumn.extraValue(Type)

getExternalId

public String getExternalId()
Get the external id for this ExtraValueType item.

Returns:
A string with the external id of this item

setExternalId

public void setExternalId(String externalId)
                   throws PermissionDeniedException,
                          InvalidDataException
Set the external id for this Client item. The value cannot be null and must not be longer than the value specified by the MAX_EXTERNAL_ID_LENGTH constant.

Parameters:
externalId - The new external id for this item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the new value is null or longer than MAX_EXTERNAL_ID_LENGTH

getColoring

public Coloring getColoring()
Get coloring information for this extra value.

Returns:
A Coloring object

getAverageMethod

public Formula.AverageMethod getAverageMethod()
Get the average method for this extra value type.

Returns:
A Formula.AverageMethod object
Since:
2.4

setAverageMethod

public void setAverageMethod(Formula.AverageMethod averageMethod)
                      throws PermissionDeniedException,
                             InvalidDataException
Set the average method of the extra value type..

Parameters:
averageMethod - A Formula.AverageMethod object, null is not allowed
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the averageMethod is null
Since:
2.4

2.17.2: 2011-06-17