Class DatabaseTarget
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.gui.tools.spreadsheetprocessor.AbstractWidget
-
- adams.gui.tools.spreadsheetprocessor.targets.AbstractTarget
-
- adams.gui.tools.spreadsheetprocessor.targets.DatabaseTarget
-
- All Implemented Interfaces:
LoggingLevelHandler,LoggingSupporter,SizeOfHandler,Serializable,Comparable<AbstractWidget>
public class DatabaseTarget extends AbstractTarget
For storing the data in a database.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEY_BATCHSIZEstatic StringKEY_COLUMNNAMECONVERSIONstatic StringKEY_MAXSTRINGLENGTHstatic StringKEY_PASSWORDstatic StringKEY_STRINGCOLUMNSQLstatic StringKEY_TABLEstatic StringKEY_TYPEMAPPERstatic StringKEY_URLstatic StringKEY_USERprotected BaseButtonm_ButtonExecutethe button for uploading the data.protected BaseComboBox<ColumnNameConversion>m_ComboBoxColumnNameConversionthe column name conversion.protected SqlConnectionPanelm_PanelConnectionthe connection panel.protected GenericObjectEditorPanelm_PanelTypeMapperthe panel for the type mapper.protected BaseObjectTextField<BaseInteger>m_TextBatchSizethe batch size.protected BaseObjectTextField<BaseInteger>m_TextMaxStringLengththe max string length.protected BaseTextFieldm_TextStringColumnSQLthe SQL for creating string columns.protected BaseTextFieldm_TextTablethe table to use.protected BasePanelm_Widgetthe widget.-
Fields inherited from class adams.gui.tools.spreadsheetprocessor.AbstractWidget
m_Owner
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description DatabaseTarget()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassign(AbstractWidget other)Retrieves the values from the other widget, if possible.voiddeserialize(Object data, MessageCollection errors)Deserializes the setup and maps it onto the widget.protected voiddoProcess(SpreadSheet data, MessageCollection errors)Processes the data.protected voidgenerate()Loads the dataBaseIntegergetCurrentBatchSize()Returns the current batch size.ColumnNameConversiongetCurrentColumnNameConversion()Returns the current column name conversion.AbstractDatabaseConnectiongetCurrentConnection()Returns the current connection.BaseIntegergetCurrentMaxStringLength()Returns the current maximum length for strings.StringgetCurrentStringColumnSQL()Returns the current SQL template for string columns.StringgetCurrentTable()Returns the current table.AbstractTypeMappergetCurrentTypeMapper()Returns the current type mapper.StringgetName()Returns the name of the widget.ComponentgetWidget()Returns the widget.Objectserialize()Serializes the setup from the widget.voidsetCurrentBatchSize(BaseInteger value)Sets the current batch size.voidsetCurrentColumnNameConversion(ColumnNameConversion value)Sets the current column name conversion.voidsetCurrentConnection(AbstractDatabaseConnection value)Sets the current connection.voidsetCurrentMaxStringLength(BaseInteger value)Sets the current maximum length for strings.voidsetCurrentStringColumnSQL(String value)Sets the current SQL template for string columns.voidsetCurrentTable(String value)Sets the current table.voidsetCurrentTypeMapper(AbstractTypeMapper value)Sets the current type mapper.voidupdate()Updates the widget.-
Methods inherited from class adams.gui.tools.spreadsheetprocessor.targets.AbstractTarget
check, process
-
Methods inherited from class adams.gui.tools.spreadsheetprocessor.AbstractWidget
compareTo, equals, getOwner, notifyOwner, setOwner, toString
-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
KEY_URL
public static final String KEY_URL
- See Also:
- Constant Field Values
-
KEY_USER
public static final String KEY_USER
- See Also:
- Constant Field Values
-
KEY_PASSWORD
public static final String KEY_PASSWORD
- See Also:
- Constant Field Values
-
KEY_TYPEMAPPER
public static final String KEY_TYPEMAPPER
- See Also:
- Constant Field Values
-
KEY_TABLE
public static final String KEY_TABLE
- See Also:
- Constant Field Values
-
KEY_COLUMNNAMECONVERSION
public static final String KEY_COLUMNNAMECONVERSION
- See Also:
- Constant Field Values
-
KEY_MAXSTRINGLENGTH
public static final String KEY_MAXSTRINGLENGTH
- See Also:
- Constant Field Values
-
KEY_STRINGCOLUMNSQL
public static final String KEY_STRINGCOLUMNSQL
- See Also:
- Constant Field Values
-
KEY_BATCHSIZE
public static final String KEY_BATCHSIZE
- See Also:
- Constant Field Values
-
m_Widget
protected BasePanel m_Widget
the widget.
-
m_PanelConnection
protected SqlConnectionPanel m_PanelConnection
the connection panel.
-
m_PanelTypeMapper
protected GenericObjectEditorPanel m_PanelTypeMapper
the panel for the type mapper.
-
m_TextTable
protected BaseTextField m_TextTable
the table to use.
-
m_ComboBoxColumnNameConversion
protected BaseComboBox<ColumnNameConversion> m_ComboBoxColumnNameConversion
the column name conversion.
-
m_TextMaxStringLength
protected BaseObjectTextField<BaseInteger> m_TextMaxStringLength
the max string length.
-
m_TextStringColumnSQL
protected BaseTextField m_TextStringColumnSQL
the SQL for creating string columns.
-
m_TextBatchSize
protected BaseObjectTextField<BaseInteger> m_TextBatchSize
the batch size.
-
m_ButtonExecute
protected BaseButton m_ButtonExecute
the button for uploading the data.
-
-
Method Detail
-
getName
public String getName()
Returns the name of the widget.- Specified by:
getNamein classAbstractWidget- Returns:
- the name
-
getWidget
public Component getWidget()
Returns the widget.- Specified by:
getWidgetin classAbstractWidget- Returns:
- the widget
-
update
public void update()
Updates the widget.- Specified by:
updatein classAbstractWidget
-
generate
protected void generate()
Loads the data
-
setCurrentConnection
public void setCurrentConnection(AbstractDatabaseConnection value)
Sets the current connection.- Parameters:
value- the connection
-
getCurrentConnection
public AbstractDatabaseConnection getCurrentConnection()
Returns the current connection.- Returns:
- the connection
-
setCurrentTypeMapper
public void setCurrentTypeMapper(AbstractTypeMapper value)
Sets the current type mapper.- Parameters:
value- the mapper
-
getCurrentTypeMapper
public AbstractTypeMapper getCurrentTypeMapper()
Returns the current type mapper.- Returns:
- the mapper
-
setCurrentTable
public void setCurrentTable(String value)
Sets the current table.- Parameters:
value- the table
-
getCurrentTable
public String getCurrentTable()
Returns the current table.- Returns:
- the table
-
setCurrentColumnNameConversion
public void setCurrentColumnNameConversion(ColumnNameConversion value)
Sets the current column name conversion.- Parameters:
value- the conversion
-
getCurrentColumnNameConversion
public ColumnNameConversion getCurrentColumnNameConversion()
Returns the current column name conversion.- Returns:
- the conversion
-
setCurrentMaxStringLength
public void setCurrentMaxStringLength(BaseInteger value)
Sets the current maximum length for strings.- Parameters:
value- the maximum
-
getCurrentMaxStringLength
public BaseInteger getCurrentMaxStringLength()
Returns the current maximum length for strings.- Returns:
- the maximum
-
setCurrentStringColumnSQL
public void setCurrentStringColumnSQL(String value)
Sets the current SQL template for string columns.- Parameters:
value- the template
-
getCurrentStringColumnSQL
public String getCurrentStringColumnSQL()
Returns the current SQL template for string columns.- Returns:
- the template
-
setCurrentBatchSize
public void setCurrentBatchSize(BaseInteger value)
Sets the current batch size.- Parameters:
value- the size
-
getCurrentBatchSize
public BaseInteger getCurrentBatchSize()
Returns the current batch size.- Returns:
- the size
-
assign
public void assign(AbstractWidget other)
Retrieves the values from the other widget, if possible.- Specified by:
assignin classAbstractWidget- Parameters:
other- the other widget to get the values from
-
serialize
public Object serialize()
Serializes the setup from the widget.- Specified by:
serializein classAbstractWidget- Returns:
- the generated setup representation
-
deserialize
public void deserialize(Object data, MessageCollection errors)
Deserializes the setup and maps it onto the widget.- Specified by:
deserializein classAbstractWidget- Parameters:
data- the setup representation to useerrors- for collecting errors
-
doProcess
protected void doProcess(SpreadSheet data, MessageCollection errors)
Processes the data.- Specified by:
doProcessin classAbstractTarget- Parameters:
data- the input dataerrors- for storing errors
-
-