Class OmeAttributes
- java.lang.Object
-
- de.aristaflow.adept2.model.orgmodel.OmeAttributes
-
public class OmeAttributes extends Object
This class provides attribute/column names for OM extensions, e. g. column names identifying an entity in the OM extension and column names for the OM extension-specific enabled status. It also provides the reverse, that is, determining the simple attribute/column names from a combined name.
-
-
Field Summary
Fields Modifier and Type Field Description static char
ATTR_SEPARATOR
The character separating the names of attributes with a combined name.static String
ATTR_SEPARATOR_STRING
The character separating the names of attributes with a combined name asString
.static String
ATTR_SOURCE_OM_EXTENSION_SUFFIX
The complete (lower-case) suffix identifying an attribute name as being an attribute for the OM extension source of another attribute.static String
ATTR_VALUE_SYSTEM_SOURCE
The value for the source attribute referring to the system.static String
ENTITY_OM_EXTENSION_UID
The attribute name identifying the corresponding entity in an OM extension.static String
ENTITY_SOURCE_OM_EXTENSION_SUFFIX
The suffix for the attribute identifying the OM extension that is the source of the current attribute value.static String
ENTITY_SYNC_RUN
The name of the attribute of the last synchronisation of the entity with an OM extension.
-
Constructor Summary
Constructors Constructor Description OmeAttributes()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getEnabledAttr(String omExt)
Gets the name for the attribute containing whether the entity is enabled for the designated OM extension.static String
getPlainAttrNameFor(String omExtAttrName, String omExtName)
Gets the plain name of the designated attribute if it refers to the designated OM extension, otherwisenull
.static String
getSourceOmeAttr(String attrName)
Gets the name for the attribute containing the OM extension name that is the current source for the value of the designated attribute.static String
getSyncRunAttr(String omExt)
Gets the name for an attribute uniquely identifying the last synchronisation run an entity was updated in the org model by the designated extension.static String
getUidAttr(String omExt)
Gets the name for an attribute uniquely identifying an entity in the org model of the designated extension.static Pair<String,String>
getUidAttr2OmExt(String attrName)
Gets the complete (lower-case) name of the UID attribute and the corresponding OM extension from the designated (combined) attribute name, possibly referring to a UID attribute.static boolean
isAttributeMappable(EntityType entityType, String attributeName)
Gets whether the designated attribute for the designated entity type can be mapped to a value from an OM extension.static Pair<String,String>
separateAttrName(String attrName)
Separates the designated attribute name and returns the first part of the name and optionally a second part.
-
-
-
Field Detail
-
ATTR_SEPARATOR
public static final char ATTR_SEPARATOR
The character separating the names of attributes with a combined name.- See Also:
- Constant Field Values
-
ATTR_SEPARATOR_STRING
public static final String ATTR_SEPARATOR_STRING
The character separating the names of attributes with a combined name asString
.- See Also:
- Constant Field Values
-
ENTITY_OM_EXTENSION_UID
public static final String ENTITY_OM_EXTENSION_UID
The attribute name identifying the corresponding entity in an OM extension. This will be suffixed by the corresponding OM extension name in the globally visible entity.- See Also:
- Constant Field Values
-
ENTITY_SOURCE_OM_EXTENSION_SUFFIX
public static final String ENTITY_SOURCE_OM_EXTENSION_SUFFIX
The suffix for the attribute identifying the OM extension that is the source of the current attribute value.- See Also:
- Constant Field Values
-
ATTR_SOURCE_OM_EXTENSION_SUFFIX
public static final String ATTR_SOURCE_OM_EXTENSION_SUFFIX
The complete (lower-case) suffix identifying an attribute name as being an attribute for the OM extension source of another attribute.
-
ENTITY_SYNC_RUN
public static final String ENTITY_SYNC_RUN
The name of the attribute of the last synchronisation of the entity with an OM extension. This will be suffixed by the corresponding OM extension name in the globally visible entity.- See Also:
- Constant Field Values
-
ATTR_VALUE_SYSTEM_SOURCE
public static final String ATTR_VALUE_SYSTEM_SOURCE
The value for the source attribute referring to the system. This has the highest priority with respect to all OM extensions.- See Also:
- Constant Field Values
-
-
Method Detail
-
getUidAttr
public static String getUidAttr(String omExt)
Gets the name for an attribute uniquely identifying an entity in the org model of the designated extension.- Parameters:
omExt
- The name of the OB extension for which to get the name of the attribute uniquely identifying an entity.- Returns:
- The name for the attribute uniquely identifying an entity in the org model of the designated extension.
-
getSyncRunAttr
public static String getSyncRunAttr(String omExt)
Gets the name for an attribute uniquely identifying the last synchronisation run an entity was updated in the org model by the designated extension.- Parameters:
omExt
- The name of the OB extension for which to get the name of the attribute.- Returns:
- The name for the attribute.
-
getEnabledAttr
public static String getEnabledAttr(String omExt)
Gets the name for the attribute containing whether the entity is enabled for the designated OM extension.- Parameters:
omExt
- The name of the OB extension for which to get the name of the enabled attribute.- Returns:
- The name for the attribute containing whether the entity is enabled for the designated OM extension.
-
getUidAttr2OmExt
public static Pair<String,String> getUidAttr2OmExt(String attrName)
Gets the complete (lower-case) name of the UID attribute and the corresponding OM extension from the designated (combined) attribute name, possibly referring to a UID attribute. If the designated name does not refer to a UID attribute of an OM extension,null
will be returned.- Parameters:
attrName
- The attribute name which possibly refers to an attribute being a OM extension UID attribute.- Returns:
- The designated (lower-case) attribute name and the corresponding OM extension name if
the name refers to a UID attribute,
null
otherwise.
-
getSourceOmeAttr
public static String getSourceOmeAttr(String attrName)
Gets the name for the attribute containing the OM extension name that is the current source for the value of the designated attribute.
OM extension-specific attributes like UID and enabled as well as the source attribute itself will returnnull
since for these attributes there is no separate source OME attribute.- Parameters:
attrName
- The name of the attribute for which to get the attribute containing the name of the OM extension which is the current source of its value.- Returns:
- The name for the attribute providing the OM extension name currently providing the
value of the designated attribute or
null
if the designated attribute has no separate source OME attribute.
-
getPlainAttrNameFor
public static String getPlainAttrNameFor(String omExtAttrName, String omExtName)
Gets the plain name of the designated attribute if it refers to the designated OM extension, otherwisenull
. This simply strips the OM extension name and the combining character from the attribute name and checks whether the remaining OM extension name is the same as the designated one.- Parameters:
omExtAttrName
- The name of the attribute being an OM extension attribute.omExtName
- The name of OM extension the designated attribute has to refer to.- Returns:
- The plain name of the designated attribute without the designated OM extension name or
null
if it refers to another or no OM extension.
-
separateAttrName
public static Pair<String,String> separateAttrName(String attrName)
Separates the designated attribute name and returns the first part of the name and optionally a second part. If there is no second part (due to noATTR_SEPARATOR
being in the designated name), the second element of the pair will benull
.
This allows to separate the OM extension name from the attribute name.- Parameters:
attrName
- The attribute name which to separate in two parts if appropriate.- Returns:
- The designated attribute name separated into a part before
ATTR_SEPARATOR
and after. The second part may benull
.
-
isAttributeMappable
public static boolean isAttributeMappable(EntityType entityType, String attributeName)
Gets whether the designated attribute for the designated entity type can be mapped to a value from an OM extension.- Parameters:
entityType
- The entity type of the attribute.attributeName
- The name of the attribute.- Returns:
- Whether the designated attribute for the designated entity type can be mapped to a value from an OM extension.
-
-