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 String
KEY_BATCHSIZE
static String
KEY_COLUMNNAMECONVERSION
static String
KEY_MAXSTRINGLENGTH
static String
KEY_PASSWORD
static String
KEY_STRINGCOLUMNSQL
static String
KEY_TABLE
static String
KEY_TYPEMAPPER
static String
KEY_URL
static String
KEY_USER
protected BaseButton
m_ButtonExecute
the button for uploading the data.protected BaseComboBox<ColumnNameConversion>
m_ComboBoxColumnNameConversion
the column name conversion.protected SqlConnectionPanel
m_PanelConnection
the connection panel.protected GenericObjectEditorPanel
m_PanelTypeMapper
the panel for the type mapper.protected BaseObjectTextField<BaseInteger>
m_TextBatchSize
the batch size.protected BaseObjectTextField<BaseInteger>
m_TextMaxStringLength
the max string length.protected BaseTextField
m_TextStringColumnSQL
the SQL for creating string columns.protected BaseTextField
m_TextTable
the table to use.protected BasePanel
m_Widget
the 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 void
assign(AbstractWidget other)
Retrieves the values from the other widget, if possible.void
deserialize(Object data, MessageCollection errors)
Deserializes the setup and maps it onto the widget.protected void
doProcess(SpreadSheet data, MessageCollection errors)
Processes the data.protected void
generate()
Loads the dataBaseInteger
getCurrentBatchSize()
Returns the current batch size.ColumnNameConversion
getCurrentColumnNameConversion()
Returns the current column name conversion.AbstractDatabaseConnection
getCurrentConnection()
Returns the current connection.BaseInteger
getCurrentMaxStringLength()
Returns the current maximum length for strings.String
getCurrentStringColumnSQL()
Returns the current SQL template for string columns.String
getCurrentTable()
Returns the current table.AbstractTypeMapper
getCurrentTypeMapper()
Returns the current type mapper.String
getName()
Returns the name of the widget.Component
getWidget()
Returns the widget.Object
serialize()
Serializes the setup from the widget.void
setCurrentBatchSize(BaseInteger value)
Sets the current batch size.void
setCurrentColumnNameConversion(ColumnNameConversion value)
Sets the current column name conversion.void
setCurrentConnection(AbstractDatabaseConnection value)
Sets the current connection.void
setCurrentMaxStringLength(BaseInteger value)
Sets the current maximum length for strings.void
setCurrentStringColumnSQL(String value)
Sets the current SQL template for string columns.void
setCurrentTable(String value)
Sets the current table.void
setCurrentTypeMapper(AbstractTypeMapper value)
Sets the current type mapper.void
update()
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:
getName
in classAbstractWidget
- Returns:
- the name
-
getWidget
public Component getWidget()
Returns the widget.- Specified by:
getWidget
in classAbstractWidget
- Returns:
- the widget
-
update
public void update()
Updates the widget.- Specified by:
update
in 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:
assign
in classAbstractWidget
- Parameters:
other
- the other widget to get the values from
-
serialize
public Object serialize()
Serializes the setup from the widget.- Specified by:
serialize
in 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:
deserialize
in classAbstractWidget
- Parameters:
data
- the setup representation to useerrors
- for collecting errors
-
doProcess
protected void doProcess(SpreadSheet data, MessageCollection errors)
Processes the data.- Specified by:
doProcess
in classAbstractTarget
- Parameters:
data
- the input dataerrors
- for storing errors
-
-