Package adams.db.generic
Class LogT
-
- All Implemented Interfaces:
LoggingSupporter
,SizeOfHandler
,DatabaseConnectionProvider
,DatabaseConnectionUser
,LogIntf
,SQLIntf
,TableInterface
,DatabaseConnectionChangeListener
,Serializable
public class LogT extends AbstractIndexedTable implements LogIntf
Table for storing log messages.- Author:
- Fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static TableManager<LogT>
m_TableManager
the table manager.-
Fields inherited from class adams.db.AbstractIndexedTable
m_init
-
Fields inherited from class adams.db.AbstractTable
FILENAME, m_Properties, m_TableName
-
Fields inherited from class adams.db.generic.SQL
m_DatabaseConnection, m_Debug
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.db.LogIntf
TABLE_NAME
-
Fields inherited from interface adams.db.SQLIntf
FAKE_TABLE_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LogT(AbstractDatabaseConnection dbcon)
The constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(LogEntry log)
Adds a log entry.boolean
exists(LogEntry log)
Looks for a log entry in the DB, looking for the auto_id.protected ColumnMapping
getColumnMapping()
Returns column names and data types.protected Indices
getIndices()
Returns required indices for this table.LogEntry
load(long auto_id)
Loads a log entry from db, using the database ID.List<LogEntry>
load(LogEntryConditions cond)
Loads log entries from the database that match the conditions.boolean
remove(LogEntry log)
Removes a log entry from the DB.protected LogEntry
resultsetToObject(ResultSet rs)
Turns the values at the next position into a substance object if possible.static LogT
singleton(AbstractDatabaseConnection dbcon)
Returns the singleton instance.protected boolean
store(LogEntry log, boolean update)
Inserts or updates a substance.boolean
update(LogEntry log)
Updates a log entry.-
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, getTableName, isEnabled, tableExists, toString
-
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, tableExists, truncate, update, updatePrefix
-
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.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.db.TableInterface
getTableName
-
-
-
-
Field Detail
-
m_TableManager
protected static TableManager<LogT> m_TableManager
the table manager.
-
-
Constructor Detail
-
LogT
protected LogT(AbstractDatabaseConnection dbcon)
The constructor.- Parameters:
dbcon
- the database context this table is used in
-
-
Method Detail
-
getColumnMapping
protected ColumnMapping getColumnMapping()
Returns column names and data types.- Specified by:
getColumnMapping
in classAbstractIndexedTable
- Returns:
- Column Mapping
-
getIndices
protected Indices getIndices()
Returns required indices for this table.- Specified by:
getIndices
in classAbstractIndexedTable
- Returns:
- Indices
-
load
public LogEntry load(long auto_id)
Loads a log entry from db, using the database ID.
-
load
public List<LogEntry> load(LogEntryConditions cond)
Loads log entries from the database that match the conditions.
-
resultsetToObject
protected LogEntry resultsetToObject(ResultSet rs)
Turns the values at the next position into a substance object if possible.- Parameters:
rs
- the result set- Returns:
- the generate object or null in case of an error
-
exists
public boolean exists(LogEntry log)
Looks for a log entry in the DB, looking for the auto_id.
-
store
protected boolean store(LogEntry log, boolean update)
Inserts or updates a substance.- Parameters:
log
- the log entry to store/updateupdate
- if true then an UPDATE will be performed, otherwise an INSERT- Returns:
- true if insert successful or already present
-
add
public boolean add(LogEntry log)
Adds a log entry.
-
update
public boolean update(LogEntry log)
Updates a log entry.
-
remove
public boolean remove(LogEntry log)
Removes a log entry from the DB.
-
singleton
public static LogT singleton(AbstractDatabaseConnection dbcon)
Returns the singleton instance.- Returns:
- the singleton
-
-