Package adams.flow.transformer
Class AbstractReportFileImport<T extends Report>
-
- Type Parameters:
T
- the type of reports to import
- All Implemented Interfaces:
AdditionalInformationHandler
,AtomicMoveSupporter
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,DatabaseConnectionUser
,VariableChangeListener
,Actor
,ErrorHandler
,InputConsumer
,OutputProducer
,Serializable
,Comparable
public abstract class AbstractReportFileImport<T extends Report> extends AbstractDbDataProcessor
Abstract ancestor for report import actors.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
BACKUP_IDS
the key for storing the current ids in the backup.static String
BACKUP_REPORTS
the key for storing the current reports in the backup.protected boolean
m_Forward
whether to forward the containers instead of the IDs.protected List<Integer>
m_IDs
the IDs of the chromatograms that have been imported.protected boolean
m_Import
whether to import the containers into the database.protected boolean
m_Merge
whether to merge the current and existing report.protected Field[]
m_OverwriteFields
the fields to overwrite in "merge" mode.protected AbstractReportReader<T>
m_Reader
the reader used for reading the reports.protected boolean
m_RemoveExisting
whether to remove existing reports (i.e., completely remove them from the DB).protected List<T>
m_Reports
the reports that have been read.-
Fields inherited from class adams.flow.transformer.AbstractDbDataProcessor
m_DatabaseConnection
-
Fields inherited from class adams.flow.transformer.AbstractDataProcessor
m_AtomicMove, m_DestinationFile, m_Failed, m_Processed, m_ProcessError, m_Processing, m_TimestampDirFormat, m_UseTimestampDirs
-
Fields inherited from class adams.flow.transformer.AbstractTransformer
BACKUP_INPUT, BACKUP_OUTPUT, m_InputToken, m_OutputToken
-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description AbstractReportFileImport()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Hashtable<String,Object>
backupState()
Backs up the current state of the actor before update the variables.void
defineOptions()
Adds options to the internal list of options.String
forwardTipText()
Returns the tip text for this property.Class[]
generates()
Returns the class of objects that it generates.protected abstract AbstractReportReader<T>
getDefaultReader()
Returns the default reader for loading the reports.boolean
getForward()
Returns whether to forward the containers or the IDs.boolean
getImport()
Returns whether to import the containers into the database.boolean
getMerge()
Returns whether the information of current report is added to an existing one.Field[]
getOverwriteFields()
Returns the fields to overwrite in "merge" mode.AbstractReportReader
getReader()
Returns the reader in use.boolean
getRemoveExisting()
Returns whether existing reports are removed first.protected abstract Class
getReportClass()
Returns the report class in use.protected abstract ReportProviderByDBID<T>
getReportProvider()
Returns the report provider to use for writing the reports to the database.String
globalInfo()
Returns a string describing the object.boolean
hasPendingOutput()
Checks whether there is pending output to be collected after executing the flow item.String
importTipText()
Returns the tip text for this property.String
mergeTipText()
Returns the tip text for this property.Token
output()
Returns the generated token.String
overwriteFieldsTipText()
Returns the tip text for this property.protected boolean
processData(File file)
Processes the given data.protected void
pruneBackup()
Removes entries from the backup.String
readerTipText()
Returns the tip text for this property.String
removeExistingTipText()
Returns the tip text for this property.protected void
reset()
Resets the scheme.protected void
restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.void
setForward(boolean value)
Sets whether to forward the containers instead of the IDs.void
setImport(boolean value)
Sets whether to import the containers into the database.void
setMerge(boolean value)
Sets whether the information of the current report is added to an existing one.void
setOverwriteFields(Field[] value)
Sets the fields to overwrite in "merge" mode.void
setReader(AbstractReportReader value)
Sets the reader to use.void
setRemoveExisting(boolean value)
Sets whether existing reports are removed first.protected String
setUpDatabaseConnection()
Configures the database connection if necessary.-
Methods inherited from class adams.flow.transformer.AbstractDbDataProcessor
doExecute, getDatabaseConnection, getDefaultDatabaseConnection, initialize, wrapUp
-
Methods inherited from class adams.flow.transformer.AbstractDataProcessor
accepts, atomicMoveTipText, failedTipText, getAtomicMove, getFailed, getProcessed, getProcessing, getUseTimestampDirs, nextTimestampDir, postProcessData, prepareData, processedTipText, processingTipText, setAtomicMove, setFailed, setProcessed, setProcessing, setUseTimestampDirs, useTimestampDirsTipText
-
Methods inherited from class adams.flow.transformer.AbstractTransformer
currentInput, execute, hasInput, input, postExecute
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getQuickInfo, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, preExecute, pruneBackup, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
cleanUp, compareTo, destroy, equals, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getQuickInfo, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
BACKUP_IDS
public static final String BACKUP_IDS
the key for storing the current ids in the backup.- See Also:
- Constant Field Values
-
BACKUP_REPORTS
public static final String BACKUP_REPORTS
the key for storing the current reports in the backup.- See Also:
- Constant Field Values
-
m_Reader
protected AbstractReportReader<T extends Report> m_Reader
the reader used for reading the reports.
-
m_RemoveExisting
protected boolean m_RemoveExisting
whether to remove existing reports (i.e., completely remove them from the DB).
-
m_Import
protected boolean m_Import
whether to import the containers into the database.
-
m_Forward
protected boolean m_Forward
whether to forward the containers instead of the IDs.
-
m_Merge
protected boolean m_Merge
whether to merge the current and existing report.
-
m_OverwriteFields
protected Field[] m_OverwriteFields
the fields to overwrite in "merge" mode.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractDataProcessor
-
getDefaultReader
protected abstract AbstractReportReader<T> getDefaultReader()
Returns the default reader for loading the reports.- Returns:
- the default reader
-
setReader
public void setReader(AbstractReportReader value)
Sets the reader to use.- Parameters:
value
- the filter
-
getReader
public AbstractReportReader getReader()
Returns the reader in use.- Returns:
- the reader
-
readerTipText
public String readerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRemoveExisting
public void setRemoveExisting(boolean value)
Sets whether existing reports are removed first.- Parameters:
value
- if true then existing reports will be removed first
-
getRemoveExisting
public boolean getRemoveExisting()
Returns whether existing reports are removed first.- Returns:
- true if are removed first
-
removeExistingTipText
public String removeExistingTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setForward
public void setForward(boolean value)
Sets whether to forward the containers instead of the IDs.- Parameters:
value
- if true then the containers are forwarded
-
getForward
public boolean getForward()
Returns whether to forward the containers or the IDs.- Returns:
- true if the containers are forwarded
-
forwardTipText
public String forwardTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setImport
public void setImport(boolean value)
Sets whether to import the containers into the database.- Parameters:
value
- if true then the containers are imported
-
getImport
public boolean getImport()
Returns whether to import the containers into the database.- Returns:
- true if the containers are imported
-
importTipText
public String importTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMerge
public void setMerge(boolean value)
Sets whether the information of the current report is added to an existing one.- Parameters:
value
- if true then information is added
-
getMerge
public boolean getMerge()
Returns whether the information of current report is added to an existing one.- Returns:
- true if information is added
-
mergeTipText
public String mergeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOverwriteFields
public void setOverwriteFields(Field[] value)
Sets the fields to overwrite in "merge" mode.- Parameters:
value
- the fields
-
getOverwriteFields
public Field[] getOverwriteFields()
Returns the fields to overwrite in "merge" mode.- Returns:
- the fields
-
overwriteFieldsTipText
public String overwriteFieldsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
pruneBackup
protected void pruneBackup()
Removes entries from the backup.- Overrides:
pruneBackup
in classAbstractActor
- See Also:
AbstractActor.reset()
-
backupState
protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.- Overrides:
backupState
in classAbstractTransformer
- Returns:
- the backup
- See Also:
AbstractActor.updateVariables()
,AbstractActor.restoreState(Hashtable)
-
restoreState
protected void restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.- Overrides:
restoreState
in classAbstractTransformer
- Parameters:
state
- the backup of the state to restore from- See Also:
AbstractActor.updateVariables()
,AbstractActor.backupState()
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractActor
-
getReportProvider
protected abstract ReportProviderByDBID<T> getReportProvider()
Returns the report provider to use for writing the reports to the database.- Returns:
- the provider to use
-
setUpDatabaseConnection
protected String setUpDatabaseConnection()
Configures the database connection if necessary.- Overrides:
setUpDatabaseConnection
in classAbstractDbDataProcessor
- Returns:
- null if successful, otherwise error message
-
processData
protected boolean processData(File file)
Processes the given data.- Specified by:
processData
in classAbstractDataProcessor
- Parameters:
file
- the file/dir to process- Returns:
- true if everything went alright
- See Also:
AbstractDataProcessor.m_ProcessError
-
getReportClass
protected abstract Class getReportClass()
Returns the report class in use.- Returns:
- the report class
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Returns:
- java.lang.Integer.class
-
output
public Token output()
Returns the generated token.- Specified by:
output
in interfaceOutputProducer
- Overrides:
output
in classAbstractTransformer
- Returns:
- the generated token
-
hasPendingOutput
public boolean hasPendingOutput()
Checks whether there is pending output to be collected after executing the flow item.- Specified by:
hasPendingOutput
in interfaceOutputProducer
- Overrides:
hasPendingOutput
in classAbstractTransformer
- Returns:
- true if there is pending output
-
-