Class MappingUtils
The MappingUtils class provides various methods to create compound IDs for entities.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe Class MediaObjectInfo.static classThe Class PubServerId. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateBucketId(Bucket bucket, Bucket parent) Creates a compound ID for a Bucketstatic StringcreateBucketIdWithPlanningParent(Bucket bucket, Planning parent) Creates a compound ID for a Bucket with Planning parent.static StringcreateCordId(Cord cord, Bucket parent) Creates a compound ID for a Cord.static StringcreateEntityId(EntityData object) Creates a compound ID for an arbitrary EntityData object.static StringcreateEntityId(EntityData object, EntityData parent) Creates a compound ID for an arbitrary EntityData object with optional parent.static StringcreateEntityId(EntityData object, EntityData parent, CometDataMapping.IdMapping mappingType) Creates a compound ID for an arbitrary EntityData object with optional parent using the given MappingType.static StringcreateKeyValueId(KeyValue keyValue, Bucket parent) Creates a compound ID for a KeyValue.static StringcreateMediaAssetId(MediaAsset asset, Bucket parent) Creates a compound ID for a MediaAsset.static StringcreateNullId(Bucket parent) Creates a null ID with optional parent.static StringcreateNullId(Planning parent) Creates a null ID with optional Planning parent.static StringcreatePlanningId(Planning planning) Creates a compound ID for a Planning.static StringcreatePriceId(Price price, Bucket parent) Creates a compound ID for a Price.static StringcreateTableDataId(TableData data, Bucket parent) Creates a compound ID for TableData.static StringcreateTextId(Text text, Bucket parent) Creates a compound ID for a Text.static StringcreateTocEntryId(CometTocEntry entry) Creates a compound ID for a Toc entry.static ObjectgetEntityDataProperty(EntityData object, String propertyName) Gets a property from a EntityData object.static ObjectgetEntityDataProperty(EntityData object, String propertyName, Object defaultValue, Bucket parentOrFallback) Gets a property from an EntityData object.static StringgetEntityDataPropertyAsString(EntityData object, String propertyName, Object defaultValue) Gets an EntityData property as a String.static StringgetEntityDataPropertyAsString(EntityData object, String propertyName, Object defaultValue, Bucket parent) Gets an EntityData property as a String.static StringgetId(String comet3StringId, ParameterTags.ParameterTag tag) Gets a certain part of a compound ID.static StringgetParentId(String comet3StringId, ParameterTags.ParameterTag tag) Gets a certain parent part of a compound ID.static MappingUtils.PubServerIdgetPubServerId(String comet3StringId) Gets a PubServerId representation of a compound ID.static voidsetEntityDataProperty(EntityData object, String propertyName, String value) Sets the entity data property.
-
Field Details
-
ID_DELIMITER
public static final char ID_DELIMITERThe Constant ID_DELIMITER.- See Also:
-
-
Method Details
-
createBucketId
Creates a compound ID for a Bucket
.- Parameters:
bucket- the Bucketparent- parent, if applicable, or null- Returns:
- compound ID
-
createBucketIdWithPlanningParent
Creates a compound ID for a Bucket with Planning parent.
- Parameters:
bucket- the Bucketparent- parent, if applicable, or null- Returns:
- compound ID
-
createPlanningId
Creates a compound ID for a Planning.
- Parameters:
planning- the Planning- Returns:
- compound ID
-
createCordId
Creates a compound ID for a Cord.
- Parameters:
cord- the Cordparent- parent, if applicable, or null- Returns:
- compound ID
-
createKeyValueId
Creates a compound ID for a KeyValue.
- Parameters:
keyValue- the KeyValueparent- parent, if applicable, or null- Returns:
- compund ID
-
createMediaAssetId
Creates a compound ID for a MediaAsset.
- Parameters:
asset- the MediaAssetparent- parent, if applicable, or null- Returns:
- compound ID
-
createPriceId
Creates a compound ID for a Price.
- Parameters:
price- the Priceparent- parent, if applicable, or null- Returns:
- compound ID
-
createTextId
Creates a compound ID for a Text.
- Parameters:
text- the Textparent- parent, if applicable, or null- Returns:
- compound ID
-
createTocEntryId
Creates a compound ID for a Toc entry.
- Parameters:
entry- the table of content entry- Returns:
- compound ID
-
createTableDataId
Creates a compound ID for TableData.
- Parameters:
data- the TableDataparent- parent, if applicable, or null- Returns:
- compound ID
-
createNullId
Creates a null ID with optional parent.
- Parameters:
parent- parent, if applicable, or null- Returns:
- null ID
-
createNullId
Creates a null ID with optional Planning parent.
- Parameters:
parent- parent, if applicable, or null- Returns:
- null ID
-
getId
Gets a certain part of a compound ID.
- Parameters:
comet3StringId- the compound IDtag- requested part of the ID- Returns:
- requested part of the ID or empty string
-
getParentId
Gets a certain parent part of a compound ID.
- Parameters:
comet3StringId- the compound IDtag- requested part of the ID- Returns:
- requested parent part of the ID or empty string
-
getPubServerId
Gets a PubServerId representation of a compound ID.
This method parses the given compound ID and returns a PubServerId object.
- Parameters:
comet3StringId- the compund ID- Returns:
- PubServerId object
-
getEntityDataProperty
public static Object getEntityDataProperty(EntityData object, String propertyName) throws CometException Gets a property from a EntityData object.
This methods gets an arbitrary property from an EntityData object.
- Parameters:
object- the EntityData objectpropertyName- name of the property- Returns:
- value of the property or null
- Throws:
CometException- thrown, if the propertyName is illegal or cannot be accessed
-
setEntityDataProperty
public static void setEntityDataProperty(EntityData object, String propertyName, String value) throws CometException Sets the entity data property.- Parameters:
object- the objectpropertyName- the property namevalue- the value- Throws:
CometException- the comet exception
-
getEntityDataProperty
public static Object getEntityDataProperty(EntityData object, String propertyName, Object defaultValue, Bucket parentOrFallback) throws CometException Gets a property from an EntityData object.
In addition to
getEntityDataProperty(EntityData, String), this method supports some virtual properties:- CometValueDefinitionsLocal.emptyProperty: an empty String
- CometValueDefinitionsLocal.defaultProperty: the value provided as default parameter
- CometValueDefinitionsLocal.compoundId, bucketCompoundId or planingCompoundId: the compound ID
- CometValueDefinitionsLocal.contextAssortment, Country, Language, Well, Market or TargetGroup: specified context property
- Parameters:
object- the EntityData objectpropertyName- name of the property or virtual propertydefaultValue- default valueparentOrFallback- parent bucket or planning- Returns:
- value of the property
- Throws:
CometException- thrown, if the propertyName is illegal or cannot be accessed
-
getEntityDataPropertyAsString
public static String getEntityDataPropertyAsString(EntityData object, String propertyName, Object defaultValue) throws CometException Gets an EntityData property as a String.
See
getEntityDataProperty(EntityData, String, Object, Bucket)for details- Parameters:
object- the EntityDatapropertyName- name of the propertydefaultValue- default value- Returns:
- value of the property
- Throws:
CometException- thrown, if the propertyName is illegal or cannot be accessed
-
getEntityDataPropertyAsString
public static String getEntityDataPropertyAsString(EntityData object, String propertyName, Object defaultValue, Bucket parent) throws CometException Gets an EntityData property as a String.
See
getEntityDataProperty(EntityData, String, Object, Bucket)for details- Parameters:
object- the EntityDatapropertyName- name of the propertydefaultValue- default valueparent- parent, if applicable, or null- Returns:
- value of the property
- Throws:
CometException- thrown, if the propertyName is illegal or cannot be accessed
-
createEntityId
Creates a compound ID for an arbitrary EntityData object.
- Parameters:
object- the EntityData object- Returns:
- compound ID
-
createEntityId
Creates a compound ID for an arbitrary EntityData object with optional parent.
- Parameters:
object- the EntityData objectparent- parent, if applicable, or null- Returns:
- compound ID
-
createEntityId
public static String createEntityId(EntityData object, EntityData parent, CometDataMapping.IdMapping mappingType) Creates a compound ID for an arbitrary EntityData object with optional parent using the given MappingType.
- Parameters:
object- the EntityData objectparent- parent, if applicable, or nullmappingType- the mappingType to use- Returns:
- compound ID
-