Class PrometheusTableDataItem<T extends PrometheusDataItem>
java.lang.Object
io.github.tonywasher.joceanus.prometheus.database.PrometheusTableDataItem<T>
- Type Parameters:
T- the DataType
- All Implemented Interfaces:
PrometheusTableInstance<T>
- Direct Known Subclasses:
PrometheusTableControlData,PrometheusTableControlKeys,PrometheusTableControlKeySet,PrometheusTableDataKeySet,PrometheusTableEncrypted
public abstract class PrometheusTableDataItem<T extends PrometheusDataItem>
extends Object
implements PrometheusTableInstance<T>
Database Table class. This controls should be extended for each DataType/Table.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPrometheusTableDataItem(PrometheusDatabaseControl pDatabase, String pTable) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidClose the result set and statement.protected intCount the number of items to be loaded.(package private) voidcreateDatabase(String pDatabase) Create the database.voidCreate the table.protected abstract voiddeclareData(PrometheusDataSet pData) Declare DataSet.voiddeleteItems(TethysUIThreadStatusReport pReport, PrometheusBatchControl pBatch) Delete items from the list.voidDrop the table.protected PrometheusDatabaseControlObtain database.Access the table definition.getList()Obtain the list of items.protected PrometheusDataValuesgetRowValues(String pName) Obtain row values.protected PrometheusTableDefinitionObtain table definition.Access the table name.voidinsertItems(TethysUIThreadStatusReport pReport, PrometheusDataSet pData, PrometheusBatchControl pBatch) Insert new items from the list.voidloadItems(TethysUIThreadStatusReport pReport, PrometheusDataSet pData) Load items from the list into the table.protected abstract PrometheusDataValuesLoad an individual item from the result set.protected voidPost-Process on a load operation.voidTruncate the table.voidresolveReferences(List<PrometheusTableInstance<?>> pTables) Resolve references.protected voidsetFieldValue(T pItem, MetisDataItem.MetisDataFieldId pField) Set a field value for an item.protected voidsetList(PrometheusDataList<T> pList) Set the list of items.voidupdateItems(TethysUIThreadStatusReport pReport, PrometheusBatchControl pBatch) Update items from the list.
-
Constructor Details
-
PrometheusTableDataItem
Constructor.- Parameters:
pDatabase- the database controlpTable- the table name
-
-
Method Details
-
getDatabase
Obtain database.- Returns:
- the database
-
getTableDef
Obtain table definition.- Returns:
- the table definition
-
getTableName
Description copied from interface:PrometheusTableInstanceAccess the table name.- Specified by:
getTableNamein interfacePrometheusTableInstance<T extends PrometheusDataItem>- Returns:
- the table name
-
getDefinition
Description copied from interface:PrometheusTableInstanceAccess the table definition.- Specified by:
getDefinitionin interfacePrometheusTableInstance<T extends PrometheusDataItem>- Returns:
- the table definition
-
resolveReferences
Description copied from interface:PrometheusTableInstanceResolve references.- Specified by:
resolveReferencesin interfacePrometheusTableInstance<T extends PrometheusDataItem>- Parameters:
pTables- the list of defined tables
-
closeStmt
Close the result set and statement.- Throws:
SQLException- on error
-
countLoadItems
Count the number of items to be loaded.- Returns:
- the count of items
- Throws:
SQLException- on error
-
declareData
Declare DataSet.- Parameters:
pData- the Data set
-
setList
Set the list of items.- Parameters:
pList- the list of items
-
getList
Description copied from interface:PrometheusTableInstanceObtain the list of items.- Specified by:
getListin interfacePrometheusTableInstance<T extends PrometheusDataItem>- Returns:
- the list of items
-
loadValues
Load an individual item from the result set.- Returns:
- the values for the row
- Throws:
OceanusException- on error
-
setFieldValue
protected void setFieldValue(T pItem, MetisDataItem.MetisDataFieldId pField) throws OceanusException Set a field value for an item.- Parameters:
pItem- the item to insertpField- the field id- Throws:
OceanusException- on error
-
postProcessOnLoad
Post-Process on a load operation.- Throws:
OceanusException- on error
-
loadItems
public void loadItems(TethysUIThreadStatusReport pReport, PrometheusDataSet pData) throws OceanusException Load items from the list into the table.- Parameters:
pReport- the reportpData- the data- Throws:
OceanusException- on error
-
insertItems
public void insertItems(TethysUIThreadStatusReport pReport, PrometheusDataSet pData, PrometheusBatchControl pBatch) throws OceanusException Insert new items from the list.- Parameters:
pReport- the reportpData- the datapBatch- the batch control- Throws:
OceanusException- on error
-
updateItems
public void updateItems(TethysUIThreadStatusReport pReport, PrometheusBatchControl pBatch) throws OceanusException Update items from the list.- Parameters:
pReport- the reportpBatch- the batch control- Throws:
OceanusException- on error
-
deleteItems
public void deleteItems(TethysUIThreadStatusReport pReport, PrometheusBatchControl pBatch) throws OceanusException Delete items from the list.- Parameters:
pReport- the reportpBatch- the batch control- Throws:
OceanusException- on error
-
createTable
Create the table.- Throws:
OceanusException- on error
-
createDatabase
Create the database.- Parameters:
pDatabase- the database name- Throws:
OceanusException- on error
-
dropTable
Drop the table.- Throws:
OceanusException- on error
-
purgeTable
Truncate the table.- Throws:
OceanusException- on error
-
getRowValues
Obtain row values.- Parameters:
pName- the name of the item- Returns:
- the row values.
- Throws:
OceanusException- on error
-