public class ReporterCloneBatcher extends AbstractBatcher
Modifier and Type | Class and Description |
---|---|
static class |
ReporterCloneBatcher.CloneSource
Specifies which source table to use for finding out which reporters
that are part of the current experiment.
|
Modifier and Type | Field and Description |
---|---|
private long |
bytesPerRow
The number of bytes used by a single row.
|
private Experiment |
experiment
The experiment this batcher inserts data for.
|
private java.sql.PreparedStatement |
insertSql
The statement that inserts cloned reporter data.
|
private java.lang.String |
insertSqlStatement
The SQL string for the
insertSql statement. |
private int[] |
parameterTypes |
private VirtualDb |
virtualDb |
debugSqlEnabled, logSql
Constructor and Description |
---|
ReporterCloneBatcher(DbControl dc,
Experiment experiment) |
Modifier and Type | Method and Description |
---|---|
private java.sql.PreparedStatement |
buildInsertSql()
Builds the insert SQL statement.
|
private DynamicRawDataQuery |
buildRawSelectQuery() |
private DynamicPositionQuery |
buildSelectQuery()
Builds a query that select all reporter properties that should be cloned
from the real reporter table.
|
int |
cloneReporters(ReporterCloneBatcher.CloneSource source,
ReporterCloneTemplate template,
ProgressReporter progress)
Create a reporter clone table in the dynamic database for this
experiment and populate it with the current reporter annotations
for all reporters that are part of the experiment.
|
void |
dropClonedReporters()
Drop the cloned reporter information from the dynamic database.
|
void |
flush()
Flush the batcher and send all remaining items in memory to the
database.
|
private void |
flushInternal() |
Experiment |
getExperiment()
Get the current experiment this batcher is used with.
|
(package private) void |
onBeforeClose()
Update disk usage and close open SQL statements.
|
analyzeTable, close, getBatchSize, getDbControl, getSessionControl, isClosed, setBatchSize, setDbControl, updateLastAccess
private final Experiment experiment
private final VirtualDb virtualDb
private final long bytesPerRow
private java.sql.PreparedStatement insertSql
INSERT INTO D#Reporter# (id, version, external_id, ...) VALUES (?, ?, ?, ...)
private java.lang.String insertSqlStatement
insertSql
statement.private int[] parameterTypes
ReporterCloneBatcher(DbControl dc, Experiment experiment)
public void flush() throws BaseException
Batcher
BaseException
- If there is an errorBatcher.close()
void onBeforeClose() throws BaseException
onBeforeClose
in class AbstractBatcher
BaseException
public Experiment getExperiment()
public void dropClonedReporters()
PermissionDeniedException
- If the logged in user does't have
write permission in this experimentpublic int cloneReporters(ReporterCloneBatcher.CloneSource source, ReporterCloneTemplate template, ProgressReporter progress)
To find out which reporters that are part of the experiment, the batcher
can use either what has already been inserted into the VirtualTable.POSITION
table (source=ReporterCloneBatcher.CloneSource.VIRTUAL
) or the reporters that are referenced
by the RawBioAssay
:s attached to the experiment (source=ReporterCloneBatcher.CloneSource.RAW
).
The AUTO method uses the position table if it exists. The RAW method can't be used
with raw data types that doesn't store raw data in the database.
This method will create an immutable copy of the template so that we can always know which fields that have been cloned, even if the template is modified. If there already is a cloned reporter information it will be removed.
template
- The reporter clone template to use or null to clone
all propertiessource
- The source of the cloned reporters, null is the same as AUTOprogress
- An optional progress reporterInvalidUseOfNullException
- If the template is nullPermissionDeniedException
- If the logged in user does't have
write permission in this experiment or use permission for the template
or read permission for reportersprivate void flushInternal() throws java.sql.SQLException
java.sql.SQLException
private java.sql.PreparedStatement buildInsertSql() throws java.sql.SQLException, BaseException
java.sql.SQLException
BaseException
BatchUtil.buildInsertSql(VirtualDb, VirtualTable, VirtualColumn[], Object[])
private DynamicPositionQuery buildSelectQuery()
private DynamicRawDataQuery buildRawSelectQuery()