Package adams.db.generic
Class SampleDataT
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.db.generic.SQL
-
- adams.db.AbstractTable
-
- adams.db.AbstractIndexedTable
-
- adams.db.ReportTableByID<SampleData,adams.data.report.Field>
-
- adams.db.generic.SampleDataT
-
- All Implemented Interfaces:
adams.core.logging.LoggingSupporter,adams.core.SizeOfHandler,adams.db.BulkReportUpdater<SampleData>,adams.db.DatabaseConnectionProvider,adams.db.DatabaseConnectionUser,adams.db.FieldProvider<adams.data.report.Field>,adams.db.InstrumentProvider,adams.db.ReportProvider<SampleData,String>,adams.db.ReportProviderByID<SampleData>,SampleDataIntf,adams.db.SQLIntf,adams.db.TableInterface,adams.event.DatabaseConnectionChangeListener,Serializable
- Direct Known Subclasses:
SampleDataT,SampleDataT,SampleDataT,SampleDataT,SampleDataT
public abstract class SampleDataT extends adams.db.ReportTableByID<SampleData,adams.data.report.Field> implements SampleDataIntf
A class for handling the sample data reports table.- Author:
- dale
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_BulkStoreStoppedwhether to stop the bulk store.protected static adams.db.TableManager<SampleDataT>m_TableManagerthe table manager.-
Fields inherited from class adams.db.AbstractTable
FILENAME, m_AnsiQuotes, m_Properties, m_TableName
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.db.SampleDataIntf
TABLE_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSampleDataT(adams.db.AbstractDatabaseConnection dbcon)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbulkStore(SampleData[] records, adams.data.report.DataType[] types, String skipFields, int batchSize, boolean autoCommit, boolean newConnection)Stores the records.protected booleandoStore(String id, SampleData report)Stores the report.booleanexists(String id)Checks whether the report exists in the database.protected adams.db.ColumnMappinggetColumnMapping()Column mapping for table.List<Integer>getDBIDs(adams.db.AbstractConditions conditions)Return a list of database IDs of data containers that match the defined conditions.List<adams.data.report.Field>getFields(adams.data.report.DataType dtype)Returns all available fields.List<String>getIDs(adams.db.AbstractConditions cond)Return a list (Vector) of IDs of spectra that match the defined conditions.List<String>getIDs(String[] columns, adams.db.AbstractConditions cond)Return a list (Vector) of IDs of spectra that match the defined conditions.protected ListgetIDs(String[] columns, adams.db.AbstractConditions cond, boolean dbids)Return a list (Vector) of IDs of spectra that match the defined conditions.protected adams.db.indices.IndicesgetIndices()Get table indices.List<String>getInstruments()Returns all the various instruments.List<String>getOrphanedIDs(OrphanedSampleDataConditions conditions)Returns a list of sample IDs of sample data without associated spectra.static SampleDataIntfgetSingleton(adams.db.AbstractDatabaseConnection dbcon)Returns the singleton of the table (active).static voidinitTable(adams.db.AbstractDatabaseConnection dbcon)Initializes the table.SampleDataload(String id)Get params.voidstopBulkStore()Interrupts a currently running bulk store, if possible.-
Methods inherited from class adams.db.ReportTableByID
createField, getFields, parse, remove, remove, remove, store, store
-
Methods inherited from class adams.db.AbstractIndexedTable
columnsMatch, columnsMatchTest, create, getAllColumns, getTables, init, initTables, isThere, postCreate, select, select, selectDistinct, selectDistinct, truncate, update
-
Methods inherited from class adams.db.AbstractTable
columnExists, databaseConnectionStateChanged, getProperties, getQueries, getTableName, getTablePrefix, isEnabled, quoteName, tableExists, toString, useAnsiQuotes
-
Methods inherited from class adams.db.generic.SQL
columnExists, doSelect, drop, execute, executeGeneratedKeys, getDatabaseConnection, getDebug, getMaxColumnNameLength, getResultSet, getSimpleResultSet, prepareStatement, prepareStatement, prepareStatement, select, selectDistinct, selectDouble, selectInt, selectLong, selectString, selectStrings, setDebug, singleton, tableExists, truncate, update, updatePrefix, updateTableName
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.db.SampleDataIntf
getSpectrumHandler, init
-
-
-
-
Field Detail
-
m_TableManager
protected static adams.db.TableManager<SampleDataT> m_TableManager
the table manager.
-
m_BulkStoreStopped
protected boolean m_BulkStoreStopped
whether to stop the bulk store.
-
-
Method Detail
-
getFields
public List<adams.data.report.Field> getFields(adams.data.report.DataType dtype)
Returns all available fields.- Specified by:
getFieldsin interfaceadams.db.FieldProvider<adams.data.report.Field>- Specified by:
getFieldsin interfaceSampleDataIntf- Parameters:
dtype- the type to limit the search to, use "null" for all- Returns:
- the list of fields
-
exists
public boolean exists(String id)
Checks whether the report exists in the database.- Specified by:
existsin interfaceadams.db.ReportProvider<SampleData,String>- Specified by:
existsin interfaceadams.db.ReportProviderByID<SampleData>- Specified by:
existsin interfaceSampleDataIntf- Parameters:
id- the ID of parent data container- Returns:
- true if the report exists
-
load
public SampleData load(String id)
Get params.- Specified by:
loadin interfaceadams.db.ReportProvider<SampleData,String>- Specified by:
loadin interfaceadams.db.ReportProviderByID<SampleData>- Specified by:
loadin interfaceSampleDataIntf- Parameters:
id- sample ID of spectrum- Returns:
- the hashtable
-
doStore
protected boolean doStore(String id, SampleData report)
Stores the report. Either updates or inserts the fields.- Specified by:
doStorein classadams.db.ReportTableByID<SampleData,adams.data.report.Field>- Parameters:
id- the id of the reportreport- the report- Returns:
- true if successfully inserted
-
getColumnMapping
protected adams.db.ColumnMapping getColumnMapping()
Column mapping for table.- Specified by:
getColumnMappingin classadams.db.AbstractIndexedTable- Returns:
- column mapping
-
getIndices
protected adams.db.indices.Indices getIndices()
Get table indices.- Specified by:
getIndicesin classadams.db.AbstractIndexedTable- Returns:
- indices.
-
getIDs
public List<String> getIDs(adams.db.AbstractConditions cond)
Return a list (Vector) of IDs of spectra that match the defined conditions. Since the alphanumeric IDs can be of numeric nature as well, we're returning them surrounded with double quotes to avoid them being interpreted as database IDs.- Specified by:
getIDsin interfaceadams.db.ReportProvider<SampleData,String>- Specified by:
getIDsin interfaceadams.db.ReportProviderByID<SampleData>- Specified by:
getIDsin interfaceSampleDataIntf- Parameters:
cond- the conditions that the spectra must meet- Returns:
- list of spectrum ids
-
getIDs
public List<String> getIDs(String[] columns, adams.db.AbstractConditions cond)
Return a list (Vector) of IDs of spectra that match the defined conditions. Since the alphanumeric IDs can be of numeric nature as well, we're returning them surrounded with double quotes to avoid them being interpreted as database IDs. If several columns are specified, then the result contains them tab-separated.- Specified by:
getIDsin interfaceadams.db.ReportProvider<SampleData,String>- Specified by:
getIDsin interfaceadams.db.ReportProviderByID<SampleData>- Specified by:
getIDsin interfaceSampleDataIntf- Parameters:
columns- the columns to retrieve ("sp." for spectrum table, "sd." for sampledata table)cond- the conditions that the spectra must meet- Returns:
- list of spectrum ids
-
getDBIDs
public List<Integer> getDBIDs(adams.db.AbstractConditions conditions)
Return a list of database IDs of data containers that match the defined conditions.- Specified by:
getDBIDsin interfaceadams.db.ReportProvider<SampleData,String>- Specified by:
getDBIDsin interfaceadams.db.ReportProviderByID<SampleData>- Specified by:
getDBIDsin interfaceSampleDataIntf- Parameters:
conditions- the conditions that the conatiners must meet- Returns:
- list of database IDs
-
getIDs
protected List getIDs(String[] columns, adams.db.AbstractConditions cond, boolean dbids)
Return a list (Vector) of IDs of spectra that match the defined conditions. Since the alphanumeric IDs can be of numeric nature as well, we're returning them surrounded with double quotes to avoid them being interpreted as database IDs. If several columns are specified, then the result contains them tab-separated.- Parameters:
columns- the columns to retrieve ("sp." for spectrum table, "sd." for sampledata table)cond- the conditions that the spectra must meet- Returns:
- list of spectrum ids
-
getOrphanedIDs
public List<String> getOrphanedIDs(OrphanedSampleDataConditions conditions)
Returns a list of sample IDs of sample data without associated spectra.- Specified by:
getOrphanedIDsin interfaceSampleDataIntf- Parameters:
conditions- the conditions that the sample data must meet- Returns:
- list of sample IDs
-
getInstruments
public List<String> getInstruments()
Returns all the various instruments.- Specified by:
getInstrumentsin interfaceadams.db.InstrumentProvider- Specified by:
getInstrumentsin interfaceSampleDataIntf- Returns:
- the instruments
-
initTable
public static void initTable(adams.db.AbstractDatabaseConnection dbcon)
Initializes the table. Used by the "InitializeTables" tool.- Parameters:
dbcon- the database context
-
bulkStore
public boolean bulkStore(SampleData[] records, adams.data.report.DataType[] types, String skipFields, int batchSize, boolean autoCommit, boolean newConnection)
Stores the records. Removes any previously existing reference values.- Specified by:
bulkStorein interfaceadams.db.BulkReportUpdater<SampleData>- Parameters:
records- the reporttypes- the data types to importskipFields- the fields to skip (regular expression), null to accept allbatchSize- the maximum number of records in one batchautoCommit- whether to use auto-commit or not (turning off may impact other transactions!)newConnection- uses a separate database connection just for this connection (then no auto-commit doesn't affect the rest)- Returns:
- true if successfully inserted/updated
-
stopBulkStore
public void stopBulkStore()
Interrupts a currently running bulk store, if possible.- Specified by:
stopBulkStorein interfaceadams.db.BulkReportUpdater<SampleData>
-
getSingleton
public static SampleDataIntf getSingleton(adams.db.AbstractDatabaseConnection dbcon)
Returns the singleton of the table (active).- Parameters:
dbcon- the database connection to get the singleton for- Returns:
- the singleton
-
-