public abstract class TagCRUDOperation
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected class |
TagCRUDOperation.AlarmDetails |
protected class |
TagCRUDOperation.ItemIdPair<T> |
protected class |
TagCRUDOperation.TagDetails |
Modifier and Type | Field and Description |
---|---|
protected BatchStatement |
alarmInsertStmt |
protected static java.lang.Long |
ROOT_LEVEL_PARENT_ID
The owner id to use for root level types.
|
protected BatchStatement |
tagInsertStmt |
protected BatchStatement |
tagPropInsertStmt |
protected BatchStatement |
tagPropUpdateStmt |
Constructor and Description |
---|
TagCRUDOperation(java.sql.Connection conn) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addAlarmDefinitionToInsertStatement(BatchStatement stmt,
TagCRUDOperation.AlarmDetails alarm) |
protected void |
addPropertySetToBatch(long tagId,
java.lang.String subPath,
PropertySet props) |
protected void |
addPropertyToBatch(long tagId,
java.lang.String name,
java.lang.Object value,
DataTypeClass dtype) |
protected void |
addPropertyToBatch(long tagId,
java.lang.String name,
java.lang.Object value,
DataTypeClass dtype,
DataType type,
java.lang.String subPath,
boolean isCustom)
Adds the property information to a batch statement that expects
[id,name,intval,floatval,doubleval,strval,subpath,iscustom]
|
void |
addTags(TagPath parent,
java.util.List<? extends Tag> tags) |
protected abstract void |
addTagToInsertStatement(BatchStatement stmt,
TagCRUDOperation.TagDetails tag)
Adds the tag to the statement.
|
protected void |
close(BatchStatement stmt) |
protected void |
commitAndClose()
Called when finished, should free held resources.
|
protected void |
continueTagInsert(java.util.List<TagCRUDOperation.ItemIdPair<Tag>> tags) |
protected abstract BatchStatement |
createAlarmDefinitionInsertStatement() |
protected abstract BatchStatement |
createAlarmPropInsertStatement()
Returns a batch statement that is an insert with columns for ALARMID,NAME,INTVAL,STRVAL,DOUBLEVAL
|
protected abstract BatchStatement |
createPermissionsInsertStatement()
Creates the batch statement that will be used to insert custom permissions
|
protected abstract BatchStatement |
createTagInsertStatement()
Creates the batch statement that will be used to insert core tag definitions
|
protected abstract BatchStatement |
createTagPropInsertStatement()
Creates the batch statement that will be used to insert core tag definitions
|
protected java.util.List<TagCRUDOperation.TagDetails> |
flattenTags(TagPath parent,
java.util.List<? extends Tag> tags) |
protected java.sql.Connection |
getConnection() |
java.lang.Exception |
getFailure() |
protected abstract java.util.List<TagCRUDOperation.ItemIdPair<TagCRUDOperation.AlarmDetails>> |
getIdsForInsertedAlarms() |
protected abstract java.util.List<TagCRUDOperation.ItemIdPair<Tag>> |
getIdsForInsertedTags()
Called after insertTagDefinitions, provides the ids for the recently created tags.
|
protected DataType |
getTypeForValueProp(PropertySet propSet)
Gets the data type for the value property stored in the provided property set
|
void |
init()
Gives subclasses the chance to prepare for the operation that is going to happen.
|
protected void |
insertAlarmDefinitions(java.util.List<TagCRUDOperation.AlarmDetails> alarms) |
protected void |
insertAlarmProperties(java.util.List<TagCRUDOperation.ItemIdPair<TagCRUDOperation.AlarmDetails>> alarms) |
protected void |
insertAlarms(java.util.List<TagCRUDOperation.AlarmDetails> alarms) |
protected void |
insertTagDefinitions(java.util.List<TagCRUDOperation.TagDetails> tags)
Manages the insertions of the core tag definitions.
|
protected void |
insertTagPermissions(java.lang.Long tagId,
Tag tag,
java.lang.String overridePath) |
protected void |
insertTagProperties(java.lang.Long tagId,
Tag tag)
Returns how many rows were added to the batch.
|
protected void |
insertTags(java.util.List<TagCRUDOperation.TagDetails> tags) |
boolean |
isFailed() |
void |
modifyTags(TagDiff diff,
java.util.Collection<EntityId> tagIds) |
protected void |
prepForInsert() |
protected void |
setFailure(java.lang.Exception e) |
protected static java.lang.Long ROOT_LEVEL_PARENT_ID
protected BatchStatement tagInsertStmt
protected BatchStatement tagPropInsertStmt
protected BatchStatement alarmInsertStmt
protected BatchStatement tagPropUpdateStmt
public boolean isFailed()
public java.lang.Exception getFailure()
protected void setFailure(java.lang.Exception e)
protected java.sql.Connection getConnection()
public void init() throws java.lang.Exception
java.lang.Exception
protected void prepForInsert() throws java.lang.Exception
java.lang.Exception
protected void commitAndClose()
protected void close(BatchStatement stmt)
protected abstract BatchStatement createTagInsertStatement() throws java.sql.SQLException
java.sql.SQLException
protected abstract BatchStatement createTagPropInsertStatement() throws java.sql.SQLException
java.sql.SQLException
protected abstract BatchStatement createPermissionsInsertStatement() throws java.sql.SQLException
java.sql.SQLException
protected abstract void addTagToInsertStatement(BatchStatement stmt, TagCRUDOperation.TagDetails tag) throws java.lang.Exception
java.lang.Exception
protected abstract java.util.List<TagCRUDOperation.ItemIdPair<Tag>> getIdsForInsertedTags()
protected void insertTagDefinitions(java.util.List<TagCRUDOperation.TagDetails> tags) throws java.lang.Exception
tags
- java.sql.SQLException
java.lang.Exception
protected void insertTags(java.util.List<TagCRUDOperation.TagDetails> tags) throws java.lang.Exception
java.lang.Exception
protected void continueTagInsert(java.util.List<TagCRUDOperation.ItemIdPair<Tag>> tags) throws java.lang.Exception
java.lang.Exception
protected void insertTagProperties(java.lang.Long tagId, Tag tag) throws java.lang.Exception
dbt
- propStmt
- java.lang.Exception
protected void insertTagPermissions(java.lang.Long tagId, Tag tag, java.lang.String overridePath) throws java.lang.Exception
java.lang.Exception
public void modifyTags(TagDiff diff, java.util.Collection<EntityId> tagIds) throws java.lang.Exception
java.lang.Exception
protected void addPropertyToBatch(long tagId, java.lang.String name, java.lang.Object value, DataTypeClass dtype) throws java.lang.Exception
java.lang.Exception
protected void addPropertySetToBatch(long tagId, java.lang.String subPath, PropertySet props) throws java.lang.Exception
java.lang.Exception
protected void addPropertyToBatch(long tagId, java.lang.String name, java.lang.Object value, DataTypeClass dtype, DataType type, java.lang.String subPath, boolean isCustom) throws java.lang.Exception
tagId
- stmt
- name
- value
- dtype
- type
- subPath
- isCustom
- java.lang.Exception
protected abstract java.util.List<TagCRUDOperation.ItemIdPair<TagCRUDOperation.AlarmDetails>> getIdsForInsertedAlarms()
protected void insertAlarms(java.util.List<TagCRUDOperation.AlarmDetails> alarms) throws java.lang.Exception
java.lang.Exception
protected abstract BatchStatement createAlarmDefinitionInsertStatement() throws java.lang.Exception
java.lang.Exception
protected abstract void addAlarmDefinitionToInsertStatement(BatchStatement stmt, TagCRUDOperation.AlarmDetails alarm) throws java.lang.Exception
java.lang.Exception
protected void insertAlarmDefinitions(java.util.List<TagCRUDOperation.AlarmDetails> alarms) throws java.lang.Exception
java.lang.Exception
protected abstract BatchStatement createAlarmPropInsertStatement() throws java.lang.Exception
java.lang.Exception
protected void insertAlarmProperties(java.util.List<TagCRUDOperation.ItemIdPair<TagCRUDOperation.AlarmDetails>> alarms) throws java.lang.Exception
java.lang.Exception
protected DataType getTypeForValueProp(PropertySet propSet)
protected java.util.List<TagCRUDOperation.TagDetails> flattenTags(TagPath parent, java.util.List<? extends Tag> tags)