Class ReporterCloneBatcher
- All Implemented Interfaces:
AutoCloseable
,Batcher
- Since:
- 3.1
- Author:
- Nicklas
- Last modified
- $Date: 2024-10-30 13:32:46 +0100 (Wed, 30 Oct 2024) $
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Specifies which source table to use for finding out which reporters that are part of the current experiment. -
Field Summary
Modifier and TypeFieldDescriptionprivate final long
The number of bytes used by a single row.private final Experiment
The experiment this batcher inserts data for.private PreparedStatement
The statement that inserts cloned reporter data.private String
The SQL string for theinsertSql
statement.private int[]
private final VirtualDb
Fields inherited from class net.sf.basedb.core.AbstractBatcher
debugSqlEnabled, logSql
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate PreparedStatement
Builds the insert SQL statement.private DynamicRawDataQuery
private DynamicPositionQuery
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
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
Get the current experiment this batcher is used with.(package private) void
Update disk usage and close open SQL statements.Methods inherited from class net.sf.basedb.core.AbstractBatcher
analyzeTable, close, getBatchSize, getDbControl, getSessionControl, isClosed, setBatchSize, setDbControl, updateLastAccess
-
Field Details
-
experiment
The experiment this batcher inserts data for. -
virtualDb
-
bytesPerRow
private final long bytesPerRowThe number of bytes used by a single row. -
insertSql
The statement that inserts cloned reporter data.INSERT INTO D#Reporter# (id, version, external_id, ...) VALUES (?, ?, ?, ...)
-
insertSqlStatement
The SQL string for theinsertSql
statement. -
parameterTypes
private int[] parameterTypes
-
-
Constructor Details
-
ReporterCloneBatcher
ReporterCloneBatcher(DbControl dc, Experiment experiment)
-
-
Method Details
-
flush
Description copied from interface:Batcher
Flush the batcher and send all remaining items in memory to the database.- Throws:
BaseException
- If there is an error- See Also:
-
onBeforeClose
Update disk usage and close open SQL statements.- Overrides:
onBeforeClose
in classAbstractBatcher
- Throws:
BaseException
-
getExperiment
Get the current experiment this batcher is used with. -
dropClonedReporters
public void dropClonedReporters()Drop the cloned reporter information from the dynamic database. If the current experiment doesn't have any cloned reporters, nothing is done.- Throws:
PermissionDeniedException
- If the logged in user does't have write permission in this experiment
-
cloneReporters
public 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.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 theRawBioAssay
: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.
- Parameters:
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 reporter- Returns:
- The number of cloned reporters
- Throws:
InvalidUseOfNullException
- 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 reporters
-
flushInternal
- Throws:
SQLException
-
buildInsertSql
Builds the insert SQL statement. -
buildSelectQuery
Builds a query that select all reporter properties that should be cloned from the real reporter table. -
buildRawSelectQuery
-