Class BasicHistoricalRecord
- java.lang.Object
-
- com.inductiveautomation.ignition.gateway.history.BasicHistoricalRecord
-
- All Implemented Interfaces:
CacheOptimizedData,CacheOptimizedSchema,DatasourceData,GroupableData,HistoricalData,java.io.Serializable
public class BasicHistoricalRecord extends java.lang.Object implements DatasourceData, CacheOptimizedData, CacheOptimizedSchema, GroupableData
The basic historical record represents a specific query with columns of data. It supports many advanced features of the store and forward system- data grouping, "cache optimized" storage, etc.This record acts both as the courier and schema of the data- it implements CacheOptimizedSchema, which means it can be serialized and will only have the column information. It can then reconstitute the original record when provided with the raw data, that was serialized separately.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBasicHistoricalRecord.HistoricalRecordFlavorprotected static classBasicHistoricalRecord.HistoricalRecordXmlReader
-
Field Summary
Fields Modifier and Type Field Description static BasicHistoricalRecord.HistoricalRecordFlavorFLAVOR
-
Constructor Summary
Constructors Constructor Description BasicHistoricalRecord()BasicHistoricalRecord(java.lang.String tableName, java.lang.String loggerName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddColumn(HistoricalColumn column)Adds a pre-defined column to the row.voidaddColumn(java.lang.String name)Creates a value column with the given name.voidaddColumn(java.lang.String name, QualifiedValue value)Adds a column with data to the row.voidaddRow(java.util.List<java.lang.Object> rowData)HistoricalDatacreateData(java.lang.Object valueData)java.util.List<HistoricalColumn>getColumns()intgetDataCount()This returns the number of rows of this historical record.HistoryFlavorgetFlavor()The very broad "flavor" designator, used to get the data to the correct sink.java.lang.StringgetGroupId()Grouping optimization codejava.lang.StringgetLoggerName()Returns the name of the logger that should be notified when something happens to this data.protected java.lang.StringgetQuery(DBTranslator translator)CacheOptimizedSchemagetSchema()The basic record just returns itself as the schema.java.lang.StringgetSignature()The signature is a static string that describes this data as uniquely as possible.java.lang.StringgetTablename()java.lang.ObjectgetValueData()GroupableDatagroupData(GroupableData other)Merge another piece of similar data into this one.booleanquoteColumnNames()voidsetLoggerName(java.lang.String loggerName)voidsetTablename(java.lang.String value)voidstoreToConnection(SRConnection conn)Called after passing through the store and forward system, the data should store itself to the open connection.protected booleanuseBatching()Execution code
-
-
-
Field Detail
-
FLAVOR
public static final BasicHistoricalRecord.HistoricalRecordFlavor FLAVOR
-
-
Method Detail
-
getFlavor
public HistoryFlavor getFlavor()
Description copied from interface:HistoricalDataThe very broad "flavor" designator, used to get the data to the correct sink. That is, different sinks support different types of data, and this is used to match them up.- Specified by:
getFlavorin interfaceHistoricalData
-
getColumns
public java.util.List<HistoricalColumn> getColumns()
-
addColumn
public void addColumn(HistoricalColumn column)
Adds a pre-defined column to the row. This allows the caller to provide a custom column type, or use something besides the standard ValueHistoricalColumn.
-
addColumn
public void addColumn(java.lang.String name)
Creates a value column with the given name. Values must be added later with addRow.
-
addColumn
public void addColumn(java.lang.String name, QualifiedValue value)Adds a column with data to the row. Quickest way to build a single row HistoricalRecord.
-
quoteColumnNames
public boolean quoteColumnNames()
-
addRow
public void addRow(java.util.List<java.lang.Object> rowData)
-
getDataCount
public int getDataCount()
This returns the number of rows of this historical record.- Specified by:
getDataCountin interfaceHistoricalData
-
getLoggerName
public java.lang.String getLoggerName()
Description copied from interface:HistoricalDataReturns the name of the logger that should be notified when something happens to this data. If null or empty, notifications won't occur (errors, however, may still be logged to the general logger).- Specified by:
getLoggerNamein interfaceHistoricalData
-
setLoggerName
public void setLoggerName(java.lang.String loggerName)
-
getTablename
public java.lang.String getTablename()
-
setTablename
public void setTablename(java.lang.String value)
-
getSchema
public CacheOptimizedSchema getSchema()
The basic record just returns itself as the schema. The actual values in the history columns are transient, so they don't get serialized.- Specified by:
getSchemain interfaceCacheOptimizedData
-
getSignature
public java.lang.String getSignature()
Description copied from interface:HistoricalDataThe signature is a static string that describes this data as uniquely as possible. This will be used to group data in the data cache (for example, when displaying quarantined data), as well as uniquely identifying cacheable schemas, etc.Basically, the golden rule is that if two pieces of data have the same signature, the came from the same place, and are going to the same place, and in theory could be grouped together (note: they won't be, that is done with the
GroupableDatainterface).- Specified by:
getSignaturein interfaceHistoricalData
-
getValueData
public java.lang.Object getValueData()
- Specified by:
getValueDatain interfaceCacheOptimizedData
-
createData
public HistoricalData createData(java.lang.Object valueData) throws java.lang.Exception
- Specified by:
createDatain interfaceCacheOptimizedSchema- Throws:
java.lang.Exception
-
getGroupId
public java.lang.String getGroupId()
Grouping optimization code- Specified by:
getGroupIdin interfaceGroupableData
-
groupData
public GroupableData groupData(GroupableData other)
Description copied from interface:GroupableDataMerge another piece of similar data into this one.- Specified by:
groupDatain interfaceGroupableData
-
useBatching
protected boolean useBatching()
Execution code
-
storeToConnection
public void storeToConnection(SRConnection conn) throws java.lang.Exception
Description copied from interface:DatasourceDataCalled after passing through the store and forward system, the data should store itself to the open connection. If it cannot, it should throw an exception. After several retries, the data will be quarantined.- Specified by:
storeToConnectionin interfaceDatasourceData- Throws:
java.lang.Exception
-
getQuery
protected java.lang.String getQuery(DBTranslator translator)
-
-