|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.AbstractBatcher net.sf.basedb.core.BasicBatcher<RawData> net.sf.basedb.core.RawDataBatcher
public class RawDataBatcher
Batcher class for raw data. A single instance can be used
for raw data belonging to a single RawBioAssay
.
If the raw bioassay is connected to an array design with features
the raw data is verified against the features before it is inserted
as follows:
ItemNotFoundException
is thrown
insert(RawData, String)
method the external reporter id of the
feature is checked against the supplied reporter id. If they don't
match an InvalidDataException
is thrown.
Note that if the raw bioassay isn't connected to an array design no checks are made
and none of the above apply. The major difference is that you must alsways set a
reporter youself in this case. We recommend that you use the insert(RawData)
method if no array design is connected, and the insert(RawData, String)
method otherwise.
Field Summary | |
---|---|
private boolean |
acceptInsertIfNullReporterOnFeature
If we should always accept inserts when the feature has a NULL reporter. |
private ArrayDesignData |
arrayDesign
The array design the raw bioassay is connected to, if any. |
private long |
bytes
The number of bytes the spot data is occupying on disk. |
private boolean |
caseInsensitive
If case should be ignored when comparing strings (external ID) |
private int |
currentPosition
Keeps track of the position number unless the raw bioassay is connected to an array design with features. |
private static boolean |
debugSqlEnabled
So we don't always have to call logSql.debug() |
private FeatureIdentificationMethod |
fiMethod
The method to use for identifying features. |
private org.hibernate.Query |
findReporter
A query to find reporters by the external id. |
private static Logger |
logSql
Log all SQL statements. |
private int |
numAcceptedWithNullReporterOnFeature
The number of accepted inserts were the feature had a NULL reporter |
private int |
numReportersNotFound
The number of reporters that was not found. |
private int |
numSkippedMissingFeature
The number of skipped inserts due to missing feature |
private Map<Object,FeatureData> |
preloaded
Holds info about the features of an array design. |
private RawBioAssay |
rawBioAssay
The raw bioassay this batcher adds raw data to. |
private RawBioAssayData |
rawBioAssayData
Just a copy of the data object for the raw bioassay. |
private RawDataType |
rawDataType
The type of raw data to batch. |
private boolean |
skipInsertIfMissingFeature
If inserts that can't find a matching feature should be skipped or generate an error. |
private Set<Object> |
usedFeatures
Keep track of the used features to make sure that no more than raw data spot references the same feature. |
private boolean |
useNullIfReporterNotFound
If we should use the null reporter if a reporter isn't found. |
Fields inherited from class net.sf.basedb.core.BasicBatcher |
---|
debugEnabled, logParam |
Constructor Summary | |
---|---|
RawDataBatcher(DbControl dc,
RawBioAssay rawBioAssay,
FeatureIdentificationMethod fim)
|
Method Summary | |
---|---|
void |
acceptInsertIfNullReporterOnFeature(boolean accept)
Specify if inserts always should be accepted if there is a matching feature that has a NULL reporter. |
void |
delete(int id)
Always throws a PermissionDeniedException, since raw data cannot be modifed once it has been created, except if all spots are deleted at the same time. |
(package private) void |
deleteAll()
Delete all raw data. |
private void |
doInsert(RawData data,
String externalReporterId,
String externalFeatureId,
boolean validateReporterId)
Do the actual insert. |
(package private) static RawDataBatcher |
getNew(DbControl dc,
RawBioAssay rawBioAssay,
FeatureIdentificationMethod fiMethod)
Create a new batcher for raw data. |
int |
getNumAcceptedWithNullReporterOnFeature()
Get the number of accepted inserts because of features with a NULL reporter. |
int |
getNumReportersNotFound()
Get the number of reporters that was not found. |
int |
getNumSkippedMissingFeature()
Get the number of skipped inserts because of a missing feature. |
(package private) PluginPermission |
getPluginPermissions()
|
RawBioAssay |
getRawBioAssay()
Get the raw bioassay this batcher is used for. |
Item |
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 raw bioassay. |
void |
insert(RawData data)
Insert a data object. |
void |
insert(RawData data,
String externalReporterId)
Deprecated. Use insert(RawData, String, String) instead |
void |
insert(RawData data,
String externalReporterId,
String externalFeatureId)
Insert a raw data spot and verify the external id of the reporter. |
RawData |
newRawData()
Create a new raw data object. |
(package private) void |
onBeforeClose()
Update the spot count and disk usage on the raw bioassay. |
void |
skipInsertIfMissingFeature(boolean skip)
Specify if the insert method should skip the insert if a feature for the spot can't be found. |
void |
update(RawData data)
Always throws a PermissionDeniedException, since raw data cannot be modifed once it has been created. |
void |
useNullIfReporterNotFound(boolean useNull)
Specify if the insert method should use a null reporter if a reporter with the given external ID isn't found. |
void |
validate(RawData data)
Validate all properties for the raw data object: The data object is not null The data object belongs to the correct raw bioassay The position value is > 0 All of the extra properties using the ExtendedProperty.validateValue(Object) method
|
Methods 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger logSql
private static final boolean debugSqlEnabled
private final RawBioAssay rawBioAssay
private final RawBioAssayData rawBioAssayData
private final RawDataType rawDataType
private final ArrayDesignData arrayDesign
private final boolean caseInsensitive
private int currentPosition
private long bytes
private org.hibernate.Query findReporter
private FeatureIdentificationMethod fiMethod
private final Map<Object,FeatureData> preloaded
FeatureIdentificationMethod
private Set<Object> usedFeatures
private boolean useNullIfReporterNotFound
private int numReportersNotFound
private boolean skipInsertIfMissingFeature
private int numSkippedMissingFeature
private boolean acceptInsertIfNullReporterOnFeature
private int numAcceptedWithNullReporterOnFeature
Constructor Detail |
---|
RawDataBatcher(DbControl dc, RawBioAssay rawBioAssay, FeatureIdentificationMethod fim) throws BaseException
BaseException
Method Detail |
---|
static RawDataBatcher getNew(DbControl dc, RawBioAssay rawBioAssay, FeatureIdentificationMethod fiMethod) throws BaseException
dc
- The DbControl to use for database access and
permission checkingrawBioAssay
- The raw bioassay this batcher should
add raw data tofiMethod
- The method to use for identifying features, use null
to use the method specified by the array design
BaseException
- If there is an errorRawBioAssay.getRawDataBatcher(FeatureIdentificationMethod, Job)
public Item getType()
BasicBatcher
Item
enumeration.
getType
in class BasicBatcher<RawData>
Item
public void validate(RawData data) throws InvalidDataException
ExtendedProperty.validateValue(Object)
method
validate
in class BasicBatcher<RawData>
data
- Data object to validate
InvalidDataException
- If the data object is invalidpublic void insert(RawData data) throws BaseException
BasicBatcher
insert
in class BasicBatcher<RawData>
data
- Data object to be inserted
InvalidDataException
- If the data is null or it doesn't validate
against the BasicBatcher.validate(BatchableData)
method
PermissionDeniedException
- If the logged in user doesn't
have create permission
BaseException
- If there is another errorpublic void update(RawData data) throws BaseException
update
in class BasicBatcher<RawData>
data
- Data object to be updated
InvalidDataException
- If the data is null or it doesn't validate
against the BasicBatcher.validate(BatchableData)
method
PermissionDeniedException
- If the logged in user doesn't
have write permission
BaseException
- If there is another errorpublic void delete(int id) throws BaseException
delete
in class BasicBatcher<RawData>
id
- Id of the object to be deleted
PermissionDeniedException
- If the logged in user doesn't
have delete permission
BaseException
- If there is another errordeleteAll()
void initPermissions(int granted, int denied) throws BaseException
initPermissions
in class BasicBatcher<RawData>
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclass
BaseException
- If the permissions couldn't be initialisedPluginPermission getPluginPermissions()
getPluginPermissions
in class BasicBatcher<RawData>
void onBeforeClose() throws BaseException
onBeforeClose
in class BasicBatcher<RawData>
BaseException
public void useNullIfReporterNotFound(boolean useNull)
useNull
- TRUE if the insert should use a null reporter (default),
FALSE otherwiseskipInsertIfMissingFeature(boolean)
public int getNumReportersNotFound()
useNullIfReporterNotFound(boolean)
public void skipInsertIfMissingFeature(boolean skip)
skip
- TRUE if the insert should be skipped, FALSE to
throw an ItemNotFoundException
(default)useNullIfReporterNotFound(boolean)
public int getNumSkippedMissingFeature()
skipInsertIfMissingFeature(boolean)
public void acceptInsertIfNullReporterOnFeature(boolean accept)
NOTE! The inserted data will also reference the NULL reporter.
accept
- TRUE to always accept the insert, FALSE to throw an
ItemNotFoundException
if the insert doesn't specify a NULL
reporter (default)public int getNumAcceptedWithNullReporterOnFeature()
acceptInsertIfNullReporterOnFeature(boolean)
public RawBioAssay getRawBioAssay()
public void insert(RawData data, String externalReporterId) throws BaseException
insert(RawData, String, String)
instead
BaseException
public void insert(RawData data, String externalReporterId, String externalFeatureId)
RawData.setReporter(ReporterData)
method.
The externalFeatureId
is only needed if the
FeatureIdentificationMethod.FEATURE_ID
identification method is used.
The other methods will use properties on the RawData
object (postion or the coordinates) to find the feature. Feature
identification is of course needed when the raw bioassay is connected
to an array design but is also used when there is no array design to
validate that duplicate spots are not inserted.
data
- The raw data to insertexternalReporterId
- The external id of the reporter expected to
be found at the feature of this spot, or null to use the reporter
attached to the featureexternalFeatureId
- The feature ID of the feature if the
FeatureIdentificationMethod.FEATURE_ID
identification method is used
BaseException
- If the insertion failedprivate void doInsert(RawData data, String externalReporterId, String externalFeatureId, boolean validateReporterId) throws BaseException
BaseException
public RawData newRawData() throws BaseException
insert(RawData)
or insert(RawData, String)
methods to insert the raw data.
You do not have to set the reporter if the raw bioassay is connected to
an array design.
BaseException
- If there is an errorvoid deleteAll() throws BaseException
BaseException
RawBioAssay.deleteRawData()
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |