|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectadams.core.ConsoleObject
adams.core.option.AbstractOptionHandler
adams.flow.core.AbstractActor
adams.flow.sink.AbstractSink
adams.flow.sink.SpreadSheetDbWriter
public class SpreadSheetDbWriter
Transfers a SpreadSheet object into a database.
Input/output:-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-name <java.lang.String> (property: name) The name of the actor. default: SpreadSheetDbWriter
-annotation <adams.core.base.BaseText> (property: annotations) The annotations to attach to this actor. default:
-skip (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is.
-stop-flow-on-error (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors.
-table <java.lang.String> (property: table) The table to write the data to (gets automatically created). default: blah
-column-name-conversion <AS_IS|LOWER_CASE|UPPER_CASE> (property: columnNameConversion) How to convert the column headers into SQL table column names. default: UPPER_CASE
-max-string-length <int> (property: maxStringLength) The maximum length for strings to enforce; can be used as @MAX in the 'stringColumnsSQL' property. default: 50 minimum: 1
-string-column-sql <java.lang.String> (property: stringColumnSQL) The SQL type to use for STRING columns in the CREATE statement; you can use the @MAX placeholder to tie the type to the 'naxStringLength' property; see also: http://en.wikipedia.org/wiki/SQL default: VARCHAR(@MAX)
| Nested Class Summary | |
|---|---|
static class |
SpreadSheetDbWriter.ColumnNameConversion
Defines how column names are converted. |
| Field Summary | |
|---|---|
protected SpreadSheetDbWriter.ColumnNameConversion |
m_ColumnNameConversion
the column name conversion. |
protected String[] |
m_ColumnNames
the column names (shortened, disambiguated). |
protected AbstractDatabaseConnection |
m_DatabaseConnection
the database connection. |
protected int |
m_MaxColumnLength
the maximum length for column names. |
protected int |
m_MaxStringLength
the maximum length for strings. |
protected String |
m_StringColumnSQL
the SQL type for string columns. |
protected String |
m_Table
the table to write the data to. |
protected Cell.ContentType[] |
m_Types
the type used for the table. |
static String |
PLACEHOLDER_MAX
the placeholder for the maximum length for string values. |
| Fields inherited from class adams.flow.sink.AbstractSink |
|---|
BACKUP_INPUT, m_InputToken |
| Fields inherited from class adams.flow.core.AbstractActor |
|---|
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_FullName, m_Headless, m_Name, m_Parent, m_Root, m_Self, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated |
| Fields inherited from class adams.core.option.AbstractOptionHandler |
|---|
m_DebugLevel, m_OptionManager |
| Fields inherited from interface adams.flow.core.Actor |
|---|
FILE_EXTENSION, FILE_EXTENSION_GZ |
| Constructor Summary | |
|---|---|
SpreadSheetDbWriter()
|
|
| Method Summary | |
|---|---|
Class[] |
accepts()
Returns the class that the consumer accepts. |
String |
columnNameConversionTipText()
Returns the tip text for this property. |
protected String |
createTable(SQL sql,
SpreadSheet sheet)
Creates the table. |
void |
defineOptions()
Adds options to the internal list of options. |
protected String |
determineSetup(SpreadSheet sheet)
Determines the column types and names. |
protected String |
doExecute()
Executes the flow item. |
protected String |
fixColumnName(String s)
Fixes the column name. |
SpreadSheetDbWriter.ColumnNameConversion |
getColumnNameConversion()
Returns how to convert the column headers into SQL table column names. |
protected AbstractDatabaseConnection |
getDatabaseConnection()
Determines the database connection in the flow. |
int |
getMaxStringLength()
Returns the maximum length for strings. |
String |
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI. |
String |
getStringColumnSQL()
Returns the SQL type for string columns for the CREATE statement. |
String |
getTable()
Returns the table to write the data to. |
String |
globalInfo()
Returns a string describing the object. |
String |
maxStringLengthTipText()
Returns the tip text for this property. |
void |
setColumnNameConversion(SpreadSheetDbWriter.ColumnNameConversion value)
Sets how to convert the column headers into SQL table column names. |
void |
setMaxStringLength(int value)
Sets the maximum length for strings. |
void |
setStringColumnSQL(String value)
Sets the SQL type for string columns for the CREATE statement. |
void |
setTable(String value)
Sets the table to write the data to. |
String |
setUp()
Initializes the item for flow execution. |
String |
stringColumnSQLTipText()
Returns the tip text for this property. |
String |
tableTipText()
Returns the tip text for this property. |
void |
wrapUp()
Cleans up after the execution has finished. |
protected String |
writeData(SQL sql,
SpreadSheet sheet)
Writes the data to the table. |
| Methods inherited from class adams.flow.sink.AbstractSink |
|---|
backupState, input, restoreState |
| Methods inherited from class adams.core.option.AbstractOptionHandler |
|---|
cleanUpOptions, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString |
| Methods inherited from class adams.core.ConsoleObject |
|---|
getDebugging, getSystemErr, getSystemOut |
| 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, debug, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFullName, getName, getNextSibling, getParent, getPreviousSibling, getRoot, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setHeadless, setName, setParent, setSkip, setStopFlowOnError, setVariables, sizeOf, stopExecution, stopExecution, variableChanged |
| Methods inherited from interface adams.core.AdditionalInformationHandler |
|---|
getAdditionalInformation |
| Methods inherited from interface adams.core.option.OptionHandler |
|---|
cleanUpOptions, getOptionManager |
| Field Detail |
|---|
public static final String PLACEHOLDER_MAX
protected AbstractDatabaseConnection m_DatabaseConnection
protected String m_Table
protected Cell.ContentType[] m_Types
protected int m_MaxColumnLength
protected String[] m_ColumnNames
protected SpreadSheetDbWriter.ColumnNameConversion m_ColumnNameConversion
protected String m_StringColumnSQL
protected int m_MaxStringLength
| Constructor Detail |
|---|
public SpreadSheetDbWriter()
| Method Detail |
|---|
public String globalInfo()
globalInfo in class AbstractOptionHandlerpublic void defineOptions()
defineOptions in interface OptionHandlerdefineOptions in class AbstractActorpublic String getQuickInfo()
getQuickInfo in interface QuickInfoSupportergetQuickInfo in interface ActorgetQuickInfo in class AbstractActorpublic void setTable(String value)
value - the table namepublic String getTable()
public String tableTipText()
public void setColumnNameConversion(SpreadSheetDbWriter.ColumnNameConversion value)
value - the conversionpublic SpreadSheetDbWriter.ColumnNameConversion getColumnNameConversion()
public String columnNameConversionTipText()
public void setMaxStringLength(int value)
value - the maximumpublic int getMaxStringLength()
public String maxStringLengthTipText()
public void setStringColumnSQL(String value)
value - the SQL typepublic String getStringColumnSQL()
public String stringColumnSQLTipText()
public Class[] accepts()
protected AbstractDatabaseConnection getDatabaseConnection()
public String setUp()
setUp in interface ActorsetUp in class AbstractActorprotected String fixColumnName(String s)
s - the column name to fix
protected String determineSetup(SpreadSheet sheet)
sheet - the sheet to analyzem_Types,
m_ColumnNames
protected String createTable(SQL sql,
SpreadSheet sheet)
sql - for executing queriessheet - the data to write to the database
protected String writeData(SQL sql,
SpreadSheet sheet)
sql - for performing the writingsheet - the data to write
protected String doExecute()
doExecute in class AbstractActorpublic void wrapUp()
wrapUp in interface ActorwrapUp in class AbstractSink
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||