Package adams.flow.transformer
Class AbstractReportDbUpdater
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.transformer.AbstractTransformer
-
- adams.flow.transformer.AbstractReportDbUpdater
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LenientModeSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,DatabaseConnectionUser
,VariableChangeListener
,Actor
,ErrorHandler
,InputConsumer
,OutputProducer
,Serializable
,Comparable
- Direct Known Subclasses:
ReportDbUpdater
,TimeseriesReportDbUpdater
public abstract class AbstractReportDbUpdater extends AbstractTransformer implements DatabaseConnectionUser, LenientModeSupporter
Ancestor for transformers that updateReport
objects or reports that are part of aMutableReportHandler
object.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractReportDbUpdater.QueryType
Enumeration for the supported types of queries.
-
Field Summary
Fields Modifier and Type Field Description protected String
m_ColumnKey
the key column.protected String
m_ColumnValue
the value column.protected AbstractDatabaseConnection
m_DatabaseConnection
the database connection.protected boolean
m_Lenient
whether to be lenient, ie accept empyt resultsets.protected AbstractReportDbUpdater.QueryType
m_QueryType
the query type.protected SQLStatement
m_SQL
the SQL statement to execute.-
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 AbstractReportDbUpdater()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the class of objects that it accepts.protected void
addToReport(Report report, String key, Object value)
Adds the specified value to the report.String
columnKeyTipText()
Returns the tip text for this property.String
columnValueTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected String
doExecute()
Executes the flow item.Class[]
generates()
Returns the class of objects that it generates.String
getColumnKey()
Returns the name of the key column.String
getColumnValue()
Returns the name of the value column.protected AbstractDatabaseConnection
getDatabaseConnection()
Determines the database connection in the flow.boolean
getLenient()
Returns whether to be lenient, i.e., quietly handle empty resultsets.AbstractReportDbUpdater.QueryType
getQueryType()
Returns the type of query.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.SQLStatement
getSQL()
Returns the SQL statement to run.String
lenientTipText()
Returns the tip text for this property.String
queryTypeTipText()
Returns the tip text for this property.protected void
reset()
Resets the scheme.void
setColumnKey(String value)
Sets the name of the key column.void
setColumnValue(String value)
Sets the name of the value column.void
setLenient(boolean value)
Sets whether to be lenient, i.e., quietly handle empty resultsets.void
setQueryType(AbstractReportDbUpdater.QueryType value)
Sets the type of query.void
setSQL(SQLStatement value)
Sets the SQL statement to run.String
SQLTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.transformer.AbstractTransformer
backupState, currentInput, execute, hasInput, hasPendingOutput, input, output, postExecute, restoreState, wrapUp
-
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, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, preExecute, pruneBackup, 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, globalInfo, 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, 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
-
m_SQL
protected SQLStatement m_SQL
the SQL statement to execute.
-
m_QueryType
protected AbstractReportDbUpdater.QueryType m_QueryType
the query type.
-
m_ColumnKey
protected String m_ColumnKey
the key column.
-
m_ColumnValue
protected String m_ColumnValue
the value column.
-
m_Lenient
protected boolean m_Lenient
whether to be lenient, ie accept empyt resultsets.
-
m_DatabaseConnection
protected AbstractDatabaseConnection m_DatabaseConnection
the database connection.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractActor
-
setSQL
public void setSQL(SQLStatement value)
Sets the SQL statement to run.- Parameters:
value
- the statement
-
getSQL
public SQLStatement getSQL()
Returns the SQL statement to run.- Returns:
- the statement
-
SQLTipText
public String SQLTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setQueryType
public void setQueryType(AbstractReportDbUpdater.QueryType value)
Sets the type of query.- Parameters:
value
- the type
-
getQueryType
public AbstractReportDbUpdater.QueryType getQueryType()
Returns the type of query.- Returns:
- the type
-
queryTypeTipText
public String queryTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setColumnKey
public void setColumnKey(String value)
Sets the name of the key column.- Parameters:
value
- the column name
-
getColumnKey
public String getColumnKey()
Returns the name of the key column.- Returns:
- the column name
-
columnKeyTipText
public String columnKeyTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setColumnValue
public void setColumnValue(String value)
Sets the name of the value column.- Parameters:
value
- the column name
-
getColumnValue
public String getColumnValue()
Returns the name of the value column.- Returns:
- the column name
-
columnValueTipText
public String columnValueTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLenient
public void setLenient(boolean value)
Sets whether to be lenient, i.e., quietly handle empty resultsets.- Specified by:
setLenient
in interfaceLenientModeSupporter
- Parameters:
value
- true if lenient
-
getLenient
public boolean getLenient()
Returns whether to be lenient, i.e., quietly handle empty resultsets.- Specified by:
getLenient
in interfaceLenientModeSupporter
- Returns:
- true if lenient
-
lenientTipText
public String lenientTipText()
Returns the tip text for this property.- Specified by:
lenientTipText
in interfaceLenientModeSupporter
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
accepts
public Class[] accepts()
Returns the class of objects that it accepts.- Specified by:
accepts
in interfaceInputConsumer
- Returns:
- the data type
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Specified by:
generates
in interfaceOutputProducer
- Returns:
- the data type
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractActor
- Returns:
- null if no info available, otherwise short string
-
getDatabaseConnection
protected AbstractDatabaseConnection getDatabaseConnection()
Determines the database connection in the flow.- Returns:
- the database connection to use
-
addToReport
protected void addToReport(Report report, String key, Object value)
Adds the specified value to the report.- Parameters:
report
- the report to modifykey
- the key for the valuevalue
- the value to add
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecute
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
-
-