Class AttributeMetaData
- java.lang.Object
-
- de.aristaflow.adept2.core.orgmodelmanager.AttributeMetaData
-
- All Implemented Interfaces:
Serializable
,Iterable<AttributeMetaData.MetaDataElement>
- Direct Known Subclasses:
OmeAttributeMetaData
public class AttributeMetaData extends Object implements Iterable<AttributeMetaData.MetaDataElement>, Serializable
AttributeMetaData
is a simple immutable container class forAttributeMetaData.MetaDataElement
-objects, supposed to conveniently hold all available meta information about the attributes of one entity type.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AttributeMetaData.MetaDataElement
Used to hold information about a single attribute.
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Collection<String>>
attr2OmExts
The attribute names (all lower case) and the (names of the) corresponding source OM extension ordered by their priority.protected Collection<String>
knownOmExts
The (name of the) OM extensions that either have a mapping or a UID column and thus can be a source for (attribute values of) entities of this entity type.protected Map<String,Collection<String>>
omExt2Attrs
The (name of the) OM extensions being mapped to the corresponding attributes (attribute names, all lower case) which have the OM extension as source.protected Map<String,String>
omExt2Uid
The UID attributes (all lower case) indexed by the corresponding OM extension names.protected Collection<String>
srcAttrs
The source OM extensions attributes (all lower case).
-
Constructor Summary
Constructors Constructor Description AttributeMetaData(AttributeMetaData.MetaDataElement[] metaDataElements)
Constructs a newAttributeMetaData
-object containing the givenAttributeMetaData.MetaDataElement
s.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AttributeMetaData.MetaDataElement
get(int index)
Returns theAttributeMetaData.MetaDataElement
at the given index.AttributeMetaData.MetaDataElement
get(String attrName)
Returns theAttributeMetaData.MetaDataElement
for the given attribute name ornull
if none is contained for this attribute name.Map<String,Collection<String>>
getAttrsMappedToOmExts()
Gets the attribute names (all lower case) and the (names of the) corresponding source OM extension ordered by their priority.int
getCount()
Gets the amount ofAttributeMetaData.MetaDataElement
s held by this container (without the OM extension-specific attributes).int
getCount(boolean includeOmExtAttributes)
Gets the amount ofAttributeMetaData.MetaDataElement
s held by this container, optionally including the OM extension-specific attributes (hidden source and enabled attributes of all OM extensions for which a mapping exists).Collection<String>
getKnownOmExts()
Gets the (name of the) OM extensions that either have a mapping or a UID column.AttributeMetaData.MetaDataElement
getMetaDataElementFor(String combAttrName)
Gets theMetaDataElement
for the entity type of this attribute meta data and the designated attribute name if it refers to an attribute of this attribute meta data.static AttributeMetaData.MetaDataElement
getMetaDataEnabledAttr(EntityType entType, String ome)
Gets theMetaDataElement
for the enabled attribute for the designated entity type and the designated OM extension.static AttributeMetaData.MetaDataElement
getMetaDataSourceAttr(EntityType entType, String attrName)
Gets theMetaDataElement
for the attribute containing the source OM extension name for the designated entity type and attribute name.String[]
getNames()
Gets the names of all attributes in a new array (without the OM extension-specific attributes).String[]
getNames(boolean includeOmExtAttributes)
Deprecated, for removal: This API element is subject to removal in a future version.UsegetNames(Collection)
instead.String[]
getNames(Collection<String> ommKnownOmes)
Gets the names of all attributes in a new array, optionally including the OM extension-specific attributes (hidden source and enabled attributes for the designated extensions).Map<String,Collection<String>>
getOmExtsMappingAttrs()
Gets the (name of the) OM extensions being mapped to the corresponding attributes (attribute names, all lower case) which have the OM extension as source.Map<String,String>
getOmExtUidAttrs()
Gets the (name of the) OM extensions being mapped to the corresponding UID attributes (attribute names, all lower case).Collection<String>
getSrcAttrs()
Gets the attributes specifying the OM extensions currently providing the value of the corresponding attribute (all lower case).Iterator<AttributeMetaData.MetaDataElement>
iterator()
AttributeMetaData.MetaDataElement[]
toArray()
Returns an array containing allAttributeMetaData.MetaDataElement
s.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
attr2OmExts
protected Map<String,Collection<String>> attr2OmExts
The attribute names (all lower case) and the (names of the) corresponding source OM extension ordered by their priority.
-
omExt2Attrs
protected Map<String,Collection<String>> omExt2Attrs
The (name of the) OM extensions being mapped to the corresponding attributes (attribute names, all lower case) which have the OM extension as source.
-
omExt2Uid
protected Map<String,String> omExt2Uid
The UID attributes (all lower case) indexed by the corresponding OM extension names.
-
knownOmExts
protected Collection<String> knownOmExts
The (name of the) OM extensions that either have a mapping or a UID column and thus can be a source for (attribute values of) entities of this entity type.
This isomExt2Attrs
.keySet() unified withomExt2Uid
.keySet().
-
srcAttrs
protected Collection<String> srcAttrs
The source OM extensions attributes (all lower case).
-
-
Constructor Detail
-
AttributeMetaData
public AttributeMetaData(AttributeMetaData.MetaDataElement[] metaDataElements)
Constructs a newAttributeMetaData
-object containing the givenAttributeMetaData.MetaDataElement
s.- Parameters:
metaDataElements
- theAttributeMetaData.MetaDataElement
s this container should hold
-
-
Method Detail
-
getNames
public String[] getNames()
Gets the names of all attributes in a new array (without the OM extension-specific attributes).- Returns:
- The names of all attributes in a new array (without the OM extension-specific attributes).
-
getNames
@Deprecated(since="14.0.0", forRemoval=true) public String[] getNames(boolean includeOmExtAttributes)
Deprecated, for removal: This API element is subject to removal in a future version.UsegetNames(Collection)
instead.Gets the names of all attributes in a new array, optionally including the OM extension-specific attributes (hidden source and enabled attributes).- Parameters:
includeOmExtAttributes
- whether to include OM extension-specific attributes (hidden source and enabled attributes).- Returns:
- The names of all attributes in a new array, optionally including the OM extension-specific attributes (hidden source and enabled attributes).
-
getNames
public String[] getNames(Collection<String> ommKnownOmes)
Gets the names of all attributes in a new array, optionally including the OM extension-specific attributes (hidden source and enabled attributes for the designated extensions).
The designated collection restricts the attribute names to the OM extensions known by the OMM. This meta data may know more OM extensions (there may be mappings for OM extensions which are not loaded by the OMM).- Parameters:
ommKnownOmes
- If this is notnull
, OM extension-specific attributes will be included, which are all hidden source attributes and the enabled attributes of this OM extensions.- Returns:
- The names of all attributes in a new array, optionally including the OM extension-specific attributes (hidden source and the enabled attributes of the designated OM extensions).
-
getCount
public int getCount()
Gets the amount ofAttributeMetaData.MetaDataElement
s held by this container (without the OM extension-specific attributes).- Returns:
- The amount of
AttributeMetaData.MetaDataElement
s held by this container (without the OM extension-specific attributes).
-
getCount
public int getCount(boolean includeOmExtAttributes)
Gets the amount ofAttributeMetaData.MetaDataElement
s held by this container, optionally including the OM extension-specific attributes (hidden source and enabled attributes of all OM extensions for which a mapping exists).- Parameters:
includeOmExtAttributes
- Whether to include OM extension-specific attributes (hidden source and enabled attributes).- Returns:
- The amount of
AttributeMetaData.MetaDataElement
s held by this container, optionally including the OM extension-specific attributes (hidden source and enabled attributes).
-
get
public AttributeMetaData.MetaDataElement get(int index)
Returns theAttributeMetaData.MetaDataElement
at the given index.- Parameters:
index
- the index for which theAttributeMetaData.MetaDataElement
should be returned- Returns:
- the
AttributeMetaData.MetaDataElement
at the given index
-
get
public AttributeMetaData.MetaDataElement get(String attrName)
Returns theAttributeMetaData.MetaDataElement
for the given attribute name ornull
if none is contained for this attribute name.- Parameters:
attrName
- the attribute name for which theAttributeMetaData.MetaDataElement
should be returned- Returns:
- the
AttributeMetaData.MetaDataElement
for the given attribute name ornull
if none is contained for this attribute name
-
toArray
public AttributeMetaData.MetaDataElement[] toArray()
Returns an array containing allAttributeMetaData.MetaDataElement
s.- Returns:
- an array containing all
AttributeMetaData.MetaDataElement
s
-
getAttrsMappedToOmExts
public Map<String,Collection<String>> getAttrsMappedToOmExts()
Gets the attribute names (all lower case) and the (names of the) corresponding source OM extension ordered by their priority. Attributes without an OM extension mapping will not be in the map.- Returns:
- The attribute names (all lower case) and the (names of the) corresponding source OM extension ordered by their priority or an empty map.
-
getOmExtsMappingAttrs
public Map<String,Collection<String>> getOmExtsMappingAttrs()
Gets the (name of the) OM extensions being mapped to the corresponding attributes (attribute names, all lower case) which have the OM extension as source. If there is no mapping for the entity, the map will be empty.- Returns:
- The (name of the) OM extensions being mapped to the corresponding attributes (attribute names, all lower case) which have the OM extension as source.
-
getOmExtUidAttrs
public Map<String,String> getOmExtUidAttrs()
Gets the (name of the) OM extensions being mapped to the corresponding UID attributes (attribute names, all lower case). An entity having a UID attribute for an OM extension indicates that the entity is being synchronised via the OM extension. Such entities may be automatically created and do not need attributes stemming from the corresponding OM extension.- Returns:
- The (name of the) OM extensions being mapped to the corresponding UID attributes (attribute names, all lower case).
-
getKnownOmExts
public Collection<String> getKnownOmExts()
Gets the (name of the) OM extensions that either have a mapping or a UID column. These OM extension can be a source for (attribute values of) entities of this entity type.
This is the union of the key sets ofgetOmExtsMappingAttrs()
andgetOmExtUidAttrs()
.- Returns:
- The (name of the) OM extensions that either have a mapping or a UID column and thus can be a source for (attribute values of) entities of this entity type.
-
getSrcAttrs
public Collection<String> getSrcAttrs()
Gets the attributes specifying the OM extensions currently providing the value of the corresponding attribute (all lower case). These source attributes are not part of the normal meta data.- Returns:
- The (name of the) attribute specifying the OM extensions currently providing the value of the corresponding attribute.
-
iterator
public Iterator<AttributeMetaData.MetaDataElement> iterator()
- Specified by:
iterator
in interfaceIterable<AttributeMetaData.MetaDataElement>
-
getMetaDataElementFor
public AttributeMetaData.MetaDataElement getMetaDataElementFor(String combAttrName)
Gets theMetaDataElement
for the entity type of this attribute meta data and the designated attribute name if it refers to an attribute of this attribute meta data. This is eithergetMetaDataEnabledAttr(EntityType, String)
for the enabled attribute of a specific OM extension (which has to be known) orgetMetaDataSourceAttr(EntityType, String)
for the OM extension source attribute of a specific (known) attribute. The designated attribute name has to be a combined attribute name either for an OM extension specific enabled attribute or OM extension source attribute for another attribute. If this is a different name or the OM extension name or the attribute are not known,null
will be returned.- Parameters:
combAttrName
- The combined attribute name either referring to an OM extension specific enabled attribute of a known OM extension or a source OM extension attribute of a known attribute.- Returns:
- The
MetaDataElement
for the designated combined attribute name of a known OM extension or a known attribute ornull
if the name is no appropriate combined attribute name.
-
getMetaDataEnabledAttr
public static AttributeMetaData.MetaDataElement getMetaDataEnabledAttr(EntityType entType, String ome)
Gets theMetaDataElement
for the enabled attribute for the designated entity type and the designated OM extension. This is separate since the corresponding meta data does not contain the corresponding meta data element but just one for the global#ENTITY_ENABLED
attribute.- Parameters:
entType
- The entity type for which to get the meta data for the OM extension-specific#ENTITY_ENABLED
attribute.ome
- The name of the OM extension for which to get the meta data for the#ENTITY_ENABLED
attribute.- Returns:
- The
MetaDataElement
for the enabled attribute for the designated entity type and the designated OM extension.
-
getMetaDataSourceAttr
public static AttributeMetaData.MetaDataElement getMetaDataSourceAttr(EntityType entType, String attrName)
Gets theMetaDataElement
for the attribute containing the source OM extension name for the designated entity type and attribute name. This is separate since the corresponding meta data does not contain the corresponding meta data element OM extension source attributes.
If the designated attribute is not valid for an attribute with OM extension mapping, e. g. UID or enabled,null
will be returned.- Parameters:
entType
- The entity type for which to get the meta data of the source OM extension attribute.attrName
- The name of the attribute for which to get the meta data for the attribute containing the OM extension name that is the current source for the value of the designated attribute.- Returns:
- The
MetaDataElement
for the OM extension source attribute for the designated entity type and the designated attribute name. This will benull
if the designated attribute is not a valid for an OM extension mapping, e. g. UID or enabled.
-
-