public class ElementToRule extends AbstractSequencerRule
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
abortOnMissingTargetAttr |
protected java.lang.String |
attributeBaseName |
protected java.lang.String[] |
attrNames |
protected java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,T_LONGLONG>> |
elemCache
Hashtable containing the cached elements.
|
protected java.lang.String |
elementName |
protected java.lang.String |
errorReasonProperty |
protected boolean |
ignoreMissingName |
protected boolean |
ignoreMissingParent |
protected int |
insertState |
protected int |
IS_ABORT |
protected int |
IS_IGNORE |
protected int |
IS_NOCHECK |
protected int |
IS_REPLACE |
protected int |
IS_UPDATE |
protected boolean |
logExisting |
protected boolean |
logMissingAttributes |
protected java.lang.String[] |
noLinkForElements |
protected ODSCache |
odsCache |
protected boolean |
rememberInstancesId |
protected boolean |
splitNM |
protected boolean |
versionIsLong |
cleanAfterGet, localNVUloggerName, postMethods, preMethods, sessionRefarguments, ctx, descriptor, NEW_LINE| Constructor and Description |
|---|
ElementToRule() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addResToFound(java.util.Hashtable<java.lang.String,T_LONGLONG> foundIds,
ElemResultSet[] res) |
protected boolean |
addToValuesArray(NameValueUnit[] nvu,
java.lang.String[] names,
java.lang.String[][] values,
int ieIndex)
Add the attribute values of an instance element to the values[][] that
holds the attributes to write.
|
protected void |
cacheMeqDatatypes(java.lang.String[] names,
java.lang.String[][] values,
boolean idIsFromTarget)
Get name and datatype of each measurement quantity and store it in the
odsCache
|
protected void |
checkElementName() |
protected T_LONGLONG |
checkIds(QueryStructure qs,
java.lang.String idName,
NameValueUnit[] nvu)
Query an instance by its id.
|
protected AIDNameValueSeqUnitId[] |
createAIDNameValueSeqUnitId(java.lang.String[] names,
java.lang.String[][] values,
T_LONGLONG[] attrUnits)
Convert the String[][] values to an AIDNameValueSeqUnitId[].
|
protected AIDNameValueSeqUnitId |
createAIDNameValueSeqUnitId(java.lang.String name,
T_LONGLONG aid)
Helper to create an AIDNameValueSeqUnitId an
|
protected void |
createNMrelations(ElemId[] newIds,
NameValueUnit[][] nvu) |
void |
doUpdate(T_LONGLONG[] idsForUpdate,
short[][] flagsForUpdate,
AIDNameValueSeqUnitId values)
Performs the update of local column values
|
void |
execute()
The execute method, nothing to do.
|
protected int |
firstIndexOf(java.lang.String[] str,
java.lang.String searchString)
Find the first index in a string array that contains the searchString
|
protected int |
getAttributeIndex(NameValueUnit[] attributes,
java.lang.String attrName)
Get the index on an attribute.
|
protected T_LONGLONG |
getIdsByName(java.lang.String idName,
java.lang.String nameName,
java.lang.String versionName,
NameValueUnit[] nvu)
Perform a query to get instances by their name.
|
protected T_LONGLONG |
getParentAid()
Get the Id of the parent application element.
|
protected java.lang.String |
getParentName()
Get the Name of the parent Application Element
|
protected java.util.Hashtable<java.lang.String,T_LONGLONG> |
getToplevelElementsWithoutVersion(java.lang.String idName,
java.lang.String nameName,
java.lang.String[] names)
Perform a query to get instances by their name.
|
protected java.lang.String[] |
getUsedAttributeNames(NameValueUnit[][] nvu)
Look at the values which target attribute names are used in the source.
|
protected java.lang.String[] |
getUsedNMRelationNames(NameValueUnit[][] nvu)
Look at the values which target N to M relation names are used in the source.
|
void |
init()
The initialization of the rule.
|
void |
init(java.lang.String elementName,
ODSCache odsCache,
java.lang.String insertMode,
boolean rememberInstances,
boolean logExisting,
boolean versionIsLong,
boolean abortOnMissingTargetAttr,
java.lang.String errorReasonProperty) |
void |
init(java.lang.String elementName,
ODSCache odsCache,
java.lang.String insertMode,
boolean rememberInstances,
boolean logExisting,
boolean versionIsLong,
boolean abortOnMissingTargetAttr,
java.lang.String errorReasonProperty,
boolean logMissingAttributes) |
void |
init(java.lang.String elementName,
ODSCache odsCache,
java.lang.String insertMode,
boolean rememberInstances,
boolean logExisting,
boolean versionIsLong,
boolean abortOnMissingTargetAttr,
java.lang.String errorReasonProperty,
java.lang.String attributeBaseName,
boolean logMissingAttributes) |
protected QueryStructure |
prepareQueryStructureById(java.lang.String idName)
Prepare a query structure to get instances by id.
|
protected QueryStructure |
prepareQueryStructureByName(java.lang.String idName,
java.lang.String nameName,
java.lang.String versionName,
java.lang.String nameValue,
java.lang.String versionValue)
Prepare a query structure to get instances by name and version (if version attribute exists).
|
protected QueryStructure |
prepareQueryStructureByParent(java.lang.String idName,
java.lang.String nameName,
java.lang.String versionName,
ElemId parentId)
Prepare a query structure to select Id, Name and (optionally) version of all instances
within a parent.
|
protected QueryStructure |
prepareQueryStructureForCatalogs(java.lang.String idName,
java.lang.String nameName,
java.lang.String[] names)
Prepare a query structure to get instances by an array of names.
|
protected java.lang.String[][] |
removeEmptyEntries(java.lang.String[][] values,
int length)
Remove null values from the values[][]
|
protected java.lang.String[][] |
removeIdAttribute(java.lang.String[] names,
java.lang.String[][] valuesToInsert)
Remove the id column from the values[][]
|
protected java.lang.String[] |
removeIdAttributeName(java.lang.String[] names)
Remove the id from the attribute names
|
protected java.lang.String[] |
removeValueAttributeNames(java.lang.String[] names)
Remove the names of the generation_parameter and values attributes from
the array of attribute names.
|
protected java.lang.String[][] |
removeValueAttributes(java.lang.String[] names,
java.lang.String[][] values)
Remove the base attributes values and generation_parameters from the
values array.
|
void |
setValue(NameValueUnit[][] nvu)
Set the value.
|
void |
terminate()
The terminat method, reset the local variables.
|
getValueexecute, executePostMethods, executePreMethods, getAoSessionFromContextWithSessionRef, getId, getOdsCache, getPointTo, getSessionRef, getType, isPedantic, setGathermode, setId, setPointTo, setPostMethods, setPreMethods, setSessionRef, setType, toString, toString, toStringaddAttributesToNameValueUnitArray, addAttributeToNameValueUnitArray, addStringValueToNameValueUnitArray, checkDirectoy, checkDirectoy, checkDirectoy, checkFile, checkFile, checkFile, checkIntValue, checkStringValue, compressNvuArray, createMessageFromPropertyFile, createMessageFromPropertyFile, createMessageFromPropertyFile, createTsUnionFromObject, deleteRowWithAttributes, getArguments, getContext, getDescriptor, getListFromProperty, getMandatoryProperty, getMandatoryProperty, getMandatoryPropertyAsInt, getMandatoryPropertyAsList, getMandatoryPropertyWithRuleException, getNvuArrayFromMap, getNvuArrayFromMap, getNvuObjectWithName, getNvuObjectWithName, getNvuObjectWithName, getOdsCacheFromProperty, getOptioanlPropertyAsInt, getOptionalProperty, getOptionalProperty, getOptionalProperty, getOptionalProperty, getOptionalPropertyAsBoolean, getOptionalPropertyAsBoolean, getOptionalPropertyAsBoolean, getOptionalPropertyAsList, makeUpperCaseKeyword, removeAttributeFromNameValueUnitArray, removeAttributeFromNameValueUnitArray, setArguments, setContext, setDescriptorclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetContext, getDescriptor, setArguments, setContext, setDescriptorprotected java.lang.String elementName
protected ODSCache odsCache
protected java.lang.String[] noLinkForElements
protected java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,T_LONGLONG>> elemCache
protected int IS_ABORT
protected int IS_IGNORE
protected int IS_NOCHECK
protected int IS_UPDATE
protected int IS_REPLACE
protected int insertState
protected boolean rememberInstancesId
protected java.lang.String attributeBaseName
protected boolean logExisting
protected boolean logMissingAttributes
protected boolean splitNM
protected boolean versionIsLong
protected boolean ignoreMissingParent
protected boolean ignoreMissingName
protected java.lang.String[] attrNames
protected boolean abortOnMissingTargetAttr
protected java.lang.String errorReasonProperty
protected java.lang.String[] getUsedAttributeNames(NameValueUnit[][] nvu) throws RuleException
nvu - 2-dimensional Array of Values. First index is the instance
element, second index is the attribute.RuleExceptionprotected T_LONGLONG getIdsByName(java.lang.String idName, java.lang.String nameName, java.lang.String versionName, NameValueUnit[] nvu) throws RuleException
idName - Name of Id attributenameName - Name of name attributeversionName - Name of version attributenvu - NameValueUnit[][] holding the instances and their attributesRuleExceptionprotected void addResToFound(java.util.Hashtable<java.lang.String,T_LONGLONG> foundIds, ElemResultSet[] res) throws AoException
AoExceptionprotected java.util.Hashtable<java.lang.String,T_LONGLONG> getToplevelElementsWithoutVersion(java.lang.String idName, java.lang.String nameName, java.lang.String[] names) throws RuleException
idName - Name of Id attributenameName - Name of name attributeversionName - Name of version attributenames - NameValueUnit[][] holding the instances and their attributesversions - RuleExceptionprotected T_LONGLONG checkIds(QueryStructure qs, java.lang.String idName, NameValueUnit[] nvu) throws RuleException
qs - The query structureidName - Name of the id attributenvu - NameValueUnit[][] containing the instances and attributesRuleExceptionprotected java.lang.String getParentName()
protected T_LONGLONG getParentAid()
protected QueryStructure prepareQueryStructureByName(java.lang.String idName, java.lang.String nameName, java.lang.String versionName, java.lang.String nameValue, java.lang.String versionValue) throws RuleException
idName - Name of id attributenameName - Name of name attributeversionName - Name of version attributenameValue - Name to searchversionValue - Value to searchRuleExceptionprotected QueryStructure prepareQueryStructureForCatalogs(java.lang.String idName, java.lang.String nameName, java.lang.String[] names) throws RuleException
idName - Name of id attributenameName - Name of name attributenames - Array of names to searchRuleExceptionprotected QueryStructure prepareQueryStructureById(java.lang.String idName)
idName - Name of id attributeprotected java.lang.String[][] removeEmptyEntries(java.lang.String[][] values,
int length)
values - The String[][] containing the attribute values for all instanceslength - The number of entries in the values[][]public void doUpdate(T_LONGLONG[] idsForUpdate, short[][] flagsForUpdate, AIDNameValueSeqUnitId values) throws RuleException
idsForUpdate - The ids of the local columns to updateflagsForUpdate - The flags to updatevalues - The values to updateRuleExceptionAoExceptionprotected AIDNameValueSeqUnitId createAIDNameValueSeqUnitId(java.lang.String name, T_LONGLONG aid)
name - The attribute nameaid - The application element idprotected int getAttributeIndex(NameValueUnit[] attributes, java.lang.String attrName)
attributes - The NameValueUnit[] of attributes on an instanceattrName - The name of the attribute we look forpublic void setValue(NameValueUnit[][] nvu) throws RuleException
nvu - -
the attribute values of the instances of the element of the
rule.RuleExceptionRuleIF.setValue(org.asam.ods.NameValueUnit[][])protected java.lang.String[] removeIdAttributeName(java.lang.String[] names)
names - Array of attribute namesprotected java.lang.String[][] removeIdAttribute(java.lang.String[] names,
java.lang.String[][] valuesToInsert)
names - Array of column namesvaluesToInsert - The values[][]protected void createNMrelations(ElemId[] newIds, NameValueUnit[][] nvu) throws RuleException
RuleExceptionprotected java.lang.String[] removeValueAttributeNames(java.lang.String[] names)
names - The array of attribute namesprotected AIDNameValueSeqUnitId[] createAIDNameValueSeqUnitId(java.lang.String[] names, java.lang.String[][] values, T_LONGLONG[] attrUnits) throws RuleException
names - The array containing the attribute namesvalues - The array containing the attribute values for the instancesattrUnits2 - RuleExceptionprotected java.lang.String[][] removeValueAttributes(java.lang.String[] names,
java.lang.String[][] values)
names - values - protected int firstIndexOf(java.lang.String[] str,
java.lang.String searchString)
str - The string arraysearchString - The search stringprotected void cacheMeqDatatypes(java.lang.String[] names,
java.lang.String[][] values,
boolean idIsFromTarget)
throws RuleException
names - The array containing the attribute namesvalues - The array containing the attribute values for each instance.idIsFromTarget - TODORuleExceptionprotected boolean addToValuesArray(NameValueUnit[] nvu, java.lang.String[] names, java.lang.String[][] values, int ieIndex)
nvu - NameValueUnit[] with the attributes of the instance.names - Array of Strings with attribute names.values - Two dimensional array of attributes. The first index holds the
attributes. The order is determined by the array "names". The
second index holds the values for the instances (ieIndex).ieIndex - The instances index within the "values" array.protected void checkElementName()
throws InitializationFailedException
InitializationFailedExceptionpublic void init(java.lang.String elementName,
ODSCache odsCache,
java.lang.String insertMode,
boolean rememberInstances,
boolean logExisting,
boolean versionIsLong,
boolean abortOnMissingTargetAttr,
java.lang.String errorReasonProperty,
boolean logMissingAttributes)
throws InitializationFailedException
InitializationFailedExceptionpublic void init(java.lang.String elementName,
ODSCache odsCache,
java.lang.String insertMode,
boolean rememberInstances,
boolean logExisting,
boolean versionIsLong,
boolean abortOnMissingTargetAttr,
java.lang.String errorReasonProperty)
throws InitializationFailedException
InitializationFailedExceptionpublic void init(java.lang.String elementName,
ODSCache odsCache,
java.lang.String insertMode,
boolean rememberInstances,
boolean logExisting,
boolean versionIsLong,
boolean abortOnMissingTargetAttr,
java.lang.String errorReasonProperty,
java.lang.String attributeBaseName,
boolean logMissingAttributes)
throws InitializationFailedException
InitializationFailedExceptionpublic void init()
throws InitializationFailedException
init in interface ImplementationIFinit in class AbstractSequencerRuleInitializationFailedException - if the initialization fails.AbstractImplementation.init()public void execute()
throws ExecutableException
execute in interface ExecutableIFexecute in class AbstractSequencerRuleExecutableException - if execution fails.AbstractRule.execute()public void terminate()
throws TerminationException
terminate in interface ExecutableIFterminate in class AbstractSequencerRuleTerminationException - if termination fails.AbstractRule.terminate()protected java.lang.String[] getUsedNMRelationNames(NameValueUnit[][] nvu)
nvu - 2-dimensional Array of Values. First index is the instance
element, second index is the attribute.protected QueryStructure prepareQueryStructureByParent(java.lang.String idName, java.lang.String nameName, java.lang.String versionName, ElemId parentId)
idName - Name of the id attributenameName - Name of the name attributeversionName - Name of the version attributeparentId - ElemId of the parent instance