Package net.sf.basedb.core
Class FeatureBatcher
- All Implemented Interfaces:
AutoCloseable
,AccessControlled
,Batcher
Batcher class for Features or AffyFeatures. A single instance can be used
for features belonging to a single
ArrayDesign
.
Create new FeatureData
objects with either
newFeature(ArrayDesignBlock, ReporterData)
or
newFeature(ArrayDesignBlock, Well)
. Use the latter method if the array
desing is connected to plates.
Depending on the FeatureIdentificationMethod
used by the array design,
you must set different properties on the FeatureData
object.
- NONE: Not supported
- COORDINATES:
FeatureData.setRow(int)
andFeatureData.setColumn(int)
- POSITION:
FeatureData.setPosition(int)
- FEATURE_ID:
FeatureData.setExternalId(String)
- Version:
- 2.0
- Author:
- Enell, Nicklas
- Last modified
- $Date$
-
Field Summary
Modifier and TypeFieldDescriptionprivate final ArrayDesign
The array design this batcher adds features to.private final ArrayDesignData
Just a copy of the data object for the array design.private int
Keeps track of the position number.private Set
Holds identification of already inserted features.private final FeatureIdentificationMethod
Fields inherited from class net.sf.basedb.core.BasicBatcher
debugEnabled, logParam
Fields inherited from class net.sf.basedb.core.AbstractBatcher
debugSqlEnabled, logSql
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
delete
(int id) Always throws aPermissionDeniedException
, since a feature cannot be modifed once it has been created.(package private) void
Delete all features belonging to this array design.Get the array design this batcher is used for.(package private) static FeatureBatcher
getNew
(DbControl dc, ArrayDesign arrayDesign) Create a new batcher for regular features.(package private) PluginPermission
getType()
Get the type of item supported by the batcher.(package private) void
initPermissions
(int granted, int denied) Grant read permission if the logged in user has read permission to the array design.void
insert
(FeatureData data) Set the position number and add the feature to the insert queue.newFeature
(ArrayDesignBlock adb, ReporterData reporter) Create a new feature.newFeature
(ArrayDesignBlock adb, Well well) Create a new feature.(package private) void
Set the hasFeature flag on the array design if features has been added.void
update
(FeatureData data) Always throws aPermissionDeniedException
, since a feature cannot be modifed once it has been created.void
validate
(FeatureData data) Validate all properties for the feature object: The data object is not null An array design block has been specfied The position number is > 0 The external id is not null or too long The feature identification is unique The data object belongs to the correct array design The reporter match the well's reporter if a well has been specifiedMethods inherited from class net.sf.basedb.core.BasicBatcher
checkPermission, delete, flush, flushDelete, flushInsert, flushUpdate, getPermissions, getPropertyValue, getTotalInsertCount, hasPermission, onBeforeCommit, setPropertyValue
Methods inherited from class net.sf.basedb.core.AbstractBatcher
analyzeTable, close, getBatchSize, getDbControl, getSessionControl, isClosed, setBatchSize, setDbControl, updateLastAccess
-
Field Details
-
arrayDesign
The array design this batcher adds features to. -
arrayDesignData
Just a copy of the data object for the array design. -
fiMethod
-
featureIds
Holds identification of already inserted features. -
currentPosition
private int currentPositionKeeps track of the position number.
-
-
Constructor Details
-
FeatureBatcher
FeatureBatcher(DbControl dc, ArrayDesign arrayDesign) throws BaseException - Throws:
BaseException
-
-
Method Details
-
getNew
static FeatureBatcher getNew(DbControl dc, ArrayDesign arrayDesign) throws DatabaseException, BaseException Create a new batcher for regular features.- Parameters:
dc
- The DbControl to use for database access and permission checkingarrayDesign
- The array design this batcher should add features to- Throws:
BaseException
- If there is an errorDatabaseException
- See Also:
-
getType
Description copied from class:BasicBatcher
Get the type of item supported by the batcher. The returned value is one of the values defined in theItem
enumeration.- Specified by:
getType
in classBasicBatcher<FeatureData>
- Returns:
- A value indicating the type of item
- See Also:
-
validate
Validate all properties for the feature object:- The data object is not null
- An array design block has been specfied
- The position number is > 0
- The external id is not null or too long
- The feature identification is unique
- The data object belongs to the correct array design
- The reporter match the well's reporter if a well has been specified
- Specified by:
validate
in classBasicBatcher<FeatureData>
- Parameters:
data
- Data object to validate- Throws:
InvalidDataException
- If the data object is invalid
-
insert
Set the position number and add the feature to the insert queue.- Overrides:
insert
in classBasicBatcher<FeatureData>
- Parameters:
data
- Data object to be inserted- Throws:
InvalidDataException
- If the data is null or it doesn't validate against theBasicBatcher.validate(BatchableData)
methodPermissionDeniedException
- If the logged in user doesn't have create permissionBaseException
- If there is another error
-
update
Always throws aPermissionDeniedException
, since a feature cannot be modifed once it has been created.- Overrides:
update
in classBasicBatcher<FeatureData>
- Parameters:
data
- Data object to be updated- Throws:
InvalidDataException
- If the data is null or it doesn't validate against theBasicBatcher.validate(BatchableData)
methodPermissionDeniedException
- If the logged in user doesn't have write permissionBaseException
- If there is another error
-
delete
Always throws aPermissionDeniedException
, since a feature cannot be modifed once it has been created.- Overrides:
delete
in classBasicBatcher<FeatureData>
- Parameters:
id
- Id of the object to be deleted- Throws:
PermissionDeniedException
- If the logged in user doesn't have delete permissionBaseException
- If there is another error- See Also:
-
initPermissions
Grant read permission if the logged in user has read permission to the array design. Grant write, delete and create permission if the logged in user has write permission to the array design.- Overrides:
initPermissions
in classBasicBatcher<FeatureData>
- Parameters:
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclass- Throws:
BaseException
- If the permissions couldn't be initialised
-
getPluginPermissions
PluginPermission getPluginPermissions()- Overrides:
getPluginPermissions
in classBasicBatcher<FeatureData>
-
onBeforeClose
Set the hasFeature flag on the array design if features has been added.- Overrides:
onBeforeClose
in classBasicBatcher<FeatureData>
- Throws:
BaseException
-
getArrayDesign
Get the array design this batcher is used for.- Returns:
- An
ArrayDesign
-
newFeature
Create a new feature.- Parameters:
adb
- The array design of the feature.well
- The well of the feature. Null is not allowed. The plate of the well must have a position on the ArrayDesign of the current FeatureBatcher.- Returns:
- A feature data object
- Throws:
BaseException
- If there is an error
-
newFeature
Create a new feature.- Returns:
- A feature data object
- Throws:
BaseException
- If there is an error
-
deleteAll
Delete all features belonging to this array design.- Throws:
BaseException
-