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 updateReportobjects or reports that are part of aMutableReportHandlerobject.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractReportDbUpdater.QueryTypeEnumeration for the supported types of queries.
-
Field Summary
Fields Modifier and Type Field Description protected Stringm_ColumnKeythe key column.protected Stringm_ColumnValuethe value column.protected AbstractDatabaseConnectionm_DatabaseConnectionthe database connection.protected booleanm_Lenientwhether to be lenient, ie accept empyt resultsets.protected AbstractReportDbUpdater.QueryTypem_QueryTypethe query type.protected SQLStatementm_SQLthe 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 voidaddToReport(Report report, String key, Object value)Adds the specified value to the report.StringcolumnKeyTipText()Returns the tip text for this property.StringcolumnValueTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecute()Executes the flow item.Class[]generates()Returns the class of objects that it generates.StringgetColumnKey()Returns the name of the key column.StringgetColumnValue()Returns the name of the value column.protected AbstractDatabaseConnectiongetDatabaseConnection()Determines the database connection in the flow.booleangetLenient()Returns whether to be lenient, i.e., quietly handle empty resultsets.AbstractReportDbUpdater.QueryTypegetQueryType()Returns the type of query.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.SQLStatementgetSQL()Returns the SQL statement to run.StringlenientTipText()Returns the tip text for this property.StringqueryTypeTipText()Returns the tip text for this property.protected voidreset()Resets the scheme.voidsetColumnKey(String value)Sets the name of the key column.voidsetColumnValue(String value)Sets the name of the value column.voidsetLenient(boolean value)Sets whether to be lenient, i.e., quietly handle empty resultsets.voidsetQueryType(AbstractReportDbUpdater.QueryType value)Sets the type of query.voidsetSQL(SQLStatement value)Sets the SQL statement to run.StringSQLTipText()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:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
resetin 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:
setLenientin interfaceLenientModeSupporter- Parameters:
value- true if lenient
-
getLenient
public boolean getLenient()
Returns whether to be lenient, i.e., quietly handle empty resultsets.- Specified by:
getLenientin interfaceLenientModeSupporter- Returns:
- true if lenient
-
lenientTipText
public String lenientTipText()
Returns the tip text for this property.- Specified by:
lenientTipTextin 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:
acceptsin interfaceInputConsumer- Returns:
- the data type
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Specified by:
generatesin 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:
getQuickInfoin interfaceActor- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin 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:
doExecutein classAbstractActor- Returns:
- null if everything is fine, otherwise error message
-
-