2.17.2: 2011-06-17

net.sf.basedb.core
Class ExtraValue

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<D>
      extended by net.sf.basedb.core.ChildItem<ExtraValueData>
          extended by net.sf.basedb.core.ExtraValue
All Implemented Interfaces:
AccessControlled, FileStoreEnabled, Identifiable

public class ExtraValue
extends ChildItem<ExtraValueData>
implements FileStoreEnabled

Represents extra values attached to a BioAssaySet. The type of extra values are defined by the ExtraValueType. The insertion of extra values is done using batchers, created by calling either BioAssaySet.getSpotExtraValueBatcher(Class, ExtraValueType, Job) or BioAssaySet.getPositionExtraValueBatcher(Class, ExtraValueType, Job). Only one set of extra values of the same ExtraValueType are allowed in a bioassayset.

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

Nested Class Summary
static class ExtraValue.CoordinateType
          Defines which coordinates in the data cube the extra values are attached to.
 
Field Summary
static Item TYPE
          The type of item represented by this class.
 
Constructor Summary
ExtraValue(ExtraValueData data)
          Creates a new extra value item from the given data.
 
Method Summary
 BioAssaySet getBioAssaySet()
          Get the bioassayset this extra value belongs to.
static ExtraValue getById(DbControl dc, int id)
          Get an ExtraValue item when you know the id.
 ExtraValue.CoordinateType getCoordinateType()
          Get information about which coordinates in the data cube the extra values are attached to.
(package private)  DataCube getDataCube()
           
(package private)  DataCubeExtraValue getDataCubeExtraValue()
           
 short getDataCubeNo()
          Get the number of the data cube the extra values are stored in.
 Experiment getExperiment()
          Get the experiment this extra value belongs to.
 short getExtraNo()
          Get the number in the data cube of the extra values.
 ExtraValueType getExtraValueType()
          Get the type of the extra values.
 FileSet getFileSet()
          Get the file set that collects all files that holds data for this item.
 Job getJob()
          Get the job that created the extra values.
(package private)  String getJoinAlias()
          The alias used when joining this extra value into a query.
(package private) static ExtraValue getNew(DbControl dc, BioAssaySet bioAssaySet, ExtraValueType extraValueType, DataCubeExtraValue dcev, Job job)
          Create a new ExtraValue item.
 int getNumFileValues()
          Get the number of values that are stored in files.
 int getNumValues()
          Get the number of extra values inserted.
 Collection<FileSet> getParentFileSets()
          Get the file set from the parent bioassay set if it exists.
(package private)  Permission getPermissionForWriteDeleteAndCreate()
          USE permission is enough to be able to manage extra values.
 Platform getPlatform()
          Get the platform the item is related to.
static ItemQuery<ExtraValue> getQuery(BioAssaySet bioAssaySet)
          Get a query configured to retrieve extra values in a given bioassayset.
 RawDataType getRawDataType()
          Get the raw data type the experiment uses for the raw data.
(package private)  SharedData getSharedParent()
          Get the experiment.
 Item getType()
          Get the type of item represented by the object.
 DynamicExtraValueQuery getValues()
          Get a query returning the extra values.
 Type getValueType()
          Get the type of values.
 PlatformVariant getVariant()
          Get the platform variant the item is related to.
 VirtualColumn getVirtualColumn()
          Get the virtual column object that represents the column where the extra values are stored.
(package private)  VirtualDb getVirtualDb()
           
(package private)  VirtualTable getVirtualTable()
           
 boolean hasFileSet()
          Check if this item has a file set.
private  void setBioAssaySet(BioAssaySet bioAssaySet)
          Set the bioassayset.
private  void setDataCubeExtraValue(DataCubeExtraValue dcev)
           
private  void setExtraValueType(ExtraValueType extraValueType)
          Set the extra value type.
private  void setJob(Job job)
          Set the job that created the extra values.
 void setNumFileValues(int numValues)
          Set the number of extra values that are stored in files.
(package private)  void setNumValues(int numValues)
          Called from batcher when it is closed.
 
Methods inherited from class net.sf.basedb.core.ChildItem
getPluginPermissions, initPermissions
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, 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.EXTRAVALUE, getType()
Constructor Detail

ExtraValue

ExtraValue(ExtraValueData data)
Creates a new extra value item from the given data.

Parameters:
data - the data
Method Detail

getNew

static ExtraValue getNew(DbControl dc,
                         BioAssaySet bioAssaySet,
                         ExtraValueType extraValueType,
                         DataCubeExtraValue dcev,
                         Job job)
                  throws PermissionDeniedException,
                         InvalidDataException,
                         BaseException
Create a new ExtraValue item.

Parameters:
dc - The DbControl which will be used for permission checking and database access.
bioAssaySet - The bioassayset the extra value belongs to
extraValueType - The type of the extra value
dcev - The data cube extra value used to store the extra values
job - The job that calculated the extra values or null
Returns:
The new ExtraValue item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission for the experiment
InvalidDataException - If the bioassayset or extra value type is null
BaseException - If there is an error

getById

public static ExtraValue getById(DbControl dc,
                                 int id)
                          throws ItemNotFoundException,
                                 PermissionDeniedException,
                                 BaseException
Get an ExtraValue 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 ExtraValue 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<ExtraValue> getQuery(BioAssaySet bioAssaySet)
                                      throws InvalidDataException
Get a query configured to retrieve extra values in a given bioassayset.

Parameters:
bioAssaySet - The bioassayset to retreive bioassays for, null is not allowed
Returns:
An ItemQuery object
Throws:
InvalidDataException - If the argument is null.
See Also:
getValues()

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

getFileSet

public FileSet getFileSet()
Description copied from interface: FileStoreEnabled
Get the file set that collects all files that holds data for this item. If no file set exists a new one is created and automatically saved to the database when DbControl.commit() is called. To check if an item has files without creating a new file set use the FileStoreEnabled.hasFileSet() method.

Specified by:
getFileSet in interface FileStoreEnabled
Returns:
A file set
Since:
2.8

hasFileSet

public boolean hasFileSet()
Description copied from interface: FileStoreEnabled
Check if this item has a file set. Always call this method before FileStoreEnabled.getFileSet() to avoid creating a new file set when there is no need for it.

Specified by:
hasFileSet in interface FileStoreEnabled
Returns:
TRUE if a file set exists, FALSE if not
Since:
2.8

getPlatform

public Platform getPlatform()
Description copied from interface: FileStoreEnabled
Get the platform the item is related to. The platform is used to limit the DataFileType:s that can be added to the file set.

Specified by:
getPlatform in interface FileStoreEnabled
Returns:
Always null
Since:
2.8

getVariant

public PlatformVariant getVariant()
Description copied from interface: FileStoreEnabled
Get the platform variant the item is related to. The platform is used to limit the DataFileType:s that can be added to the file set.

Specified by:
getVariant in interface FileStoreEnabled
Returns:
Always null
Since:
2.8

getParentFileSets

public Collection<FileSet> getParentFileSets()
Get the file set from the parent bioassay set if it exists.

Specified by:
getParentFileSets in interface FileStoreEnabled
Returns:
A collection of FileSet or null
Since:
2.8

getSharedParent

SharedData getSharedParent()
Get the experiment.

Specified by:
getSharedParent in class ChildItem<ExtraValueData>
Returns:
The parent item

getPermissionForWriteDeleteAndCreate

Permission getPermissionForWriteDeleteAndCreate()
USE permission is enough to be able to manage extra values.

Overrides:
getPermissionForWriteDeleteAndCreate in class ChildItem<ExtraValueData>

getExperiment

public Experiment getExperiment()
                         throws PermissionDeniedException,
                                BaseException
Get the experiment this extra value belongs to.

Returns:
An Experiment object
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the experiment
BaseException - If there is another error

getBioAssaySet

public BioAssaySet getBioAssaySet()
                           throws PermissionDeniedException,
                                  BaseException
Get the bioassayset this extra value belongs to.

Returns:
A BioAssaySet object
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the bioassayset
BaseException - If there is another error

setBioAssaySet

private void setBioAssaySet(BioAssaySet bioAssaySet)
                     throws PermissionDeniedException,
                            InvalidDataException
Set the bioassayset. This cannot be changed after the extra value has been created.

Throws:
PermissionDeniedException
InvalidDataException

getExtraValueType

public ExtraValueType getExtraValueType()
                                 throws PermissionDeniedException,
                                        BaseException
Get the type of the extra values.

Returns:
An ExtraValueType object
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the extra value type
BaseException - If there is another error

setExtraValueType

private void setExtraValueType(ExtraValueType extraValueType)
                        throws PermissionDeniedException,
                               InvalidDataException
Set the extra value type. This cannot be changed after the extra value has been created.

Throws:
PermissionDeniedException
InvalidDataException

getJob

public Job getJob()
           throws PermissionDeniedException,
                  BaseException
Get the job that created the extra values.

Returns:
A Job object, ot null if the extra values wasn't created by a job
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the experiment
BaseException - If there is another error

setJob

private void setJob(Job job)
Set the job that created the extra values. Once set it can't be changed.


getRawDataType

public RawDataType getRawDataType()
Get the raw data type the experiment uses for the raw data.

Returns:
A RawDataType object

getNumValues

public int getNumValues()
Get the number of extra values inserted.


setNumValues

void setNumValues(int numValues)
Called from batcher when it is closed.


getNumFileValues

public int getNumFileValues()
Get the number of values that are stored in files.

Since:
2.8

setNumFileValues

public void setNumFileValues(int numValues)
Set the number of extra values that are stored in files.

Parameters:
numValues - The number of spots
Since:
2.8

getDataCubeNo

public short getDataCubeNo()
Get the number of the data cube the extra values are stored in.


getExtraNo

public short getExtraNo()
Get the number in the data cube of the extra values.


getCoordinateType

public ExtraValue.CoordinateType getCoordinateType()
Get information about which coordinates in the data cube the extra values are attached to.

Returns:
A CoordinateType object
See Also:
DataCube

getValueType

public Type getValueType()
Get the type of values. Shortcut for getExtraValueType().getValueType().

Returns:
A Type object

getValues

public DynamicExtraValueQuery getValues()
Get a query returning the extra values. The query will select column, position and the extra value by default, if the extra values attached to both column and position. Otherwise only the coordinate the extra values are attached to are selected.
// Example of default query for extra integer values attached to spots
SELECT ex.column, ex.position, ex.value
FROM Dynamic#SpotExtraInt AS ex
WHERE ex.cube = <cube_no> AND ex.extra = <extra_no>

Returns:
A DynamicExtraValueQuery object

getDataCubeExtraValue

DataCubeExtraValue getDataCubeExtraValue()
                                   throws PermissionDeniedException,
                                          BaseException
Throws:
PermissionDeniedException
BaseException

setDataCubeExtraValue

private void setDataCubeExtraValue(DataCubeExtraValue dcev)

getVirtualDb

VirtualDb getVirtualDb()

getDataCube

DataCube getDataCube()

getVirtualTable

VirtualTable getVirtualTable()

getVirtualColumn

public VirtualColumn getVirtualColumn()
Get the virtual column object that represents the column where the extra values are stored. The column depends on the value type of the extra value.

Returns:
A VirtualColumn object
See Also:
VirtualColumn.extraValue(Type)

getJoinAlias

String getJoinAlias()
The alias used when joining this extra value into a query. We can't use the VirtualTable.getAlias() value, which we normally do, since the alias must be unique if we join several extra values. We simply return a value based on the id of this item. The ExtraValueJoin and ExtraValueExpression both uses this method to create their SQL.

Returns:
The alias to use in joins
See Also:
ExtraValueJoin, ExtraValueExpression

2.17.2: 2011-06-17