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 for AttributeMetaData.MetaDataElement-objects, supposed to conveniently hold all available meta information about the attributes of one entity type.
See Also:
  • Field Details

    • 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 is omExt2Attrs.keySet() unified with omExt2Uid.keySet().
    • srcAttrs

      protected Collection<String> srcAttrs
      The source OM extensions attributes (all lower case).
  • Constructor Details

  • Method Details

    • 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.
      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 not null, 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 of AttributeMetaData.MetaDataElements held by this container (without the OM extension-specific attributes).
      Returns:
      The amount of AttributeMetaData.MetaDataElements held by this container (without the OM extension-specific attributes).
    • getCount

      public int getCount(boolean includeOmExtAttributes)
      Gets the amount of AttributeMetaData.MetaDataElements 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.MetaDataElements held by this container, optionally including the OM extension-specific attributes (hidden source and enabled attributes).
    • get

      public AttributeMetaData.MetaDataElement get(int index)
      Returns the AttributeMetaData.MetaDataElement at the given index.
      Parameters:
      index - the index for which the AttributeMetaData.MetaDataElement should be returned
      Returns:
      the AttributeMetaData.MetaDataElement at the given index
    • get

      Returns the AttributeMetaData.MetaDataElement for the given attribute name or null if none is contained for this attribute name.
      Parameters:
      attrName - the attribute name for which the AttributeMetaData.MetaDataElement should be returned
      Returns:
      the AttributeMetaData.MetaDataElement for the given attribute name or null if none is contained for this attribute name
    • toArray

      Returns an array containing all AttributeMetaData.MetaDataElements.
      Returns:
      an array containing all AttributeMetaData.MetaDataElements
    • 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 of getOmExtsMappingAttrs() and getOmExtUidAttrs().
      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

      Specified by:
      iterator in interface Iterable<AttributeMetaData.MetaDataElement>
    • getMetaDataElementFor

      public AttributeMetaData.MetaDataElement getMetaDataElementFor(String combAttrName)
      Gets the MetaDataElement 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 either getMetaDataEnabledAttr(EntityType, String) for the enabled attribute of a specific OM extension (which has to be known) or getMetaDataSourceAttr(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 or null if the name is no appropriate combined attribute name.
    • getMetaDataEnabledAttr

      public static AttributeMetaData.MetaDataElement getMetaDataEnabledAttr(EntityType entType, String ome)
      Gets the MetaDataElement 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 the MetaDataElement 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 be null if the designated attribute is not a valid for an OM extension mapping, e. g. UID or enabled.