Class MappingUtils
- java.lang.Object
-
- com.priint.pubserver.comet.bridge.util.MappingUtils
-
public class MappingUtils extends java.lang.ObjectInternal use onlyThe MappingUtils class provides various methods to create compound IDs for entities.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMappingUtils.MediaObjectInfoThe Class MediaObjectInfo.static classMappingUtils.PubServerIdThe Class PubServerId.
-
Field Summary
Fields Modifier and Type Field Description static charID_DELIMITERThe Constant ID_DELIMITER.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringcreateBucketId(Bucket bucket, Bucket parent)Creates a compound ID for a Bucketstatic java.lang.StringcreateBucketIdWithPlanningParent(Bucket bucket, Planning parent)Creates a compound ID for a Bucket with Planning parent.static java.lang.StringcreateCordId(Cord cord, Bucket parent)Creates a compound ID for a Cord.static java.lang.StringcreateEntityId(EntityData object)Creates a compound ID for an arbitrary EntityData object.static java.lang.StringcreateEntityId(EntityData object, EntityData parent)Creates a compound ID for an arbitrary EntityData object with optional parent.static java.lang.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 java.lang.StringcreateKeyValueId(KeyValue keyValue, Bucket parent)Creates a compound ID for a KeyValue.static java.lang.StringcreateMediaAssetId(MediaAsset asset, Bucket parent)Creates a compound ID for a MediaAsset.static java.lang.StringcreateNullId(Bucket parent)Creates a null ID with optional parent.static java.lang.StringcreateNullId(Planning parent)Creates a null ID with optional Planning parent.static java.lang.StringcreatePlanningId(Planning planning)Creates a compound ID for a Planning.static java.lang.StringcreatePriceId(Price price, Bucket parent)Creates a compound ID for a Price.static java.lang.StringcreateTableDataId(TableData data, Bucket parent)Creates a compound ID for TableData.static java.lang.StringcreateTextId(Text text, Bucket parent)Creates a compound ID for a Text.static java.lang.StringcreateTocEntryId(CometTocEntry entry)Creates a compound ID for a Toc entry.static java.lang.ObjectgetEntityDataProperty(EntityData object, java.lang.String propertyName)Gets a property from a EntityData object.static java.lang.ObjectgetEntityDataProperty(EntityData object, java.lang.String propertyName, java.lang.Object defaultValue, Bucket parentOrFallback)Gets a property from an EntityData object.static java.lang.StringgetEntityDataPropertyAsString(EntityData object, java.lang.String propertyName, java.lang.Object defaultValue)Gets an EntityData property as a String.static java.lang.StringgetEntityDataPropertyAsString(EntityData object, java.lang.String propertyName, java.lang.Object defaultValue, Bucket parent)Gets an EntityData property as a String.static java.lang.StringgetId(java.lang.String comet3StringId, ParameterTags.ParameterTag tag)Gets a certain part of a compound ID.static java.lang.StringgetParentId(java.lang.String comet3StringId, ParameterTags.ParameterTag tag)Gets a certain parent part of a compound ID.static MappingUtils.PubServerIdgetPubServerId(java.lang.String comet3StringId)Gets a PubServerId representation of a compound ID.static voidsetEntityDataProperty(EntityData object, java.lang.String propertyName, java.lang.String value)Sets the entity data property.
-
-
-
Field Detail
-
ID_DELIMITER
public static final char ID_DELIMITER
The Constant ID_DELIMITER.- See Also:
- Constant Field Values
-
-
Method Detail
-
createBucketId
public static java.lang.String createBucketId(Bucket bucket, Bucket parent)
Creates a compound ID for a Bucket
.- Parameters:
bucket- the Bucketparent- parent, if applicable, or null- Returns:
- compound ID
-
createBucketIdWithPlanningParent
public static java.lang.String createBucketIdWithPlanningParent(Bucket bucket, Planning parent)
Creates a compound ID for a Bucket with Planning parent.
- Parameters:
bucket- the Bucketparent- parent, if applicable, or null- Returns:
- compound ID
-
createPlanningId
public static java.lang.String createPlanningId(Planning planning)
Creates a compound ID for a Planning.
- Parameters:
planning- the Planning- Returns:
- compound ID
-
createCordId
public static java.lang.String createCordId(Cord cord, Bucket parent)
Creates a compound ID for a Cord.
- Parameters:
cord- the Cordparent- parent, if applicable, or null- Returns:
- compound ID
-
createKeyValueId
public static java.lang.String createKeyValueId(KeyValue keyValue, Bucket parent)
Creates a compound ID for a KeyValue.
- Parameters:
keyValue- the KeyValueparent- parent, if applicable, or null- Returns:
- compund ID
-
createMediaAssetId
public static java.lang.String createMediaAssetId(MediaAsset asset, Bucket parent)
Creates a compound ID for a MediaAsset.
- Parameters:
asset- the MediaAssetparent- parent, if applicable, or null- Returns:
- compound ID
-
createPriceId
public static java.lang.String createPriceId(Price price, Bucket parent)
Creates a compound ID for a Price.
- Parameters:
price- the Priceparent- parent, if applicable, or null- Returns:
- compound ID
-
createTextId
public static java.lang.String createTextId(Text text, Bucket parent)
Creates a compound ID for a Text.
- Parameters:
text- the Textparent- parent, if applicable, or null- Returns:
- compound ID
-
createTocEntryId
public static java.lang.String createTocEntryId(CometTocEntry entry)
Creates a compound ID for a Toc entry.
- Parameters:
entry- the table of content entry- Returns:
- compound ID
-
createTableDataId
public static java.lang.String createTableDataId(TableData data, Bucket parent)
Creates a compound ID for TableData.
- Parameters:
data- the TableDataparent- parent, if applicable, or null- Returns:
- compound ID
-
createNullId
public static java.lang.String createNullId(Bucket parent)
Creates a null ID with optional parent.
- Parameters:
parent- parent, if applicable, or null- Returns:
- null ID
-
createNullId
public static java.lang.String createNullId(Planning parent)
Creates a null ID with optional Planning parent.
- Parameters:
parent- parent, if applicable, or null- Returns:
- null ID
-
getId
public static java.lang.String getId(java.lang.String comet3StringId, ParameterTags.ParameterTag tag)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
public static java.lang.String getParentId(java.lang.String comet3StringId, ParameterTags.ParameterTag tag)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
public static MappingUtils.PubServerId getPubServerId(java.lang.String comet3StringId)
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 java.lang.Object getEntityDataProperty(EntityData object, java.lang.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, java.lang.String propertyName, java.lang.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 java.lang.Object getEntityDataProperty(EntityData object, java.lang.String propertyName, java.lang.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 java.lang.String getEntityDataPropertyAsString(EntityData object, java.lang.String propertyName, java.lang.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 java.lang.String getEntityDataPropertyAsString(EntityData object, java.lang.String propertyName, java.lang.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
public static java.lang.String createEntityId(EntityData object)
Creates a compound ID for an arbitrary EntityData object.
- Parameters:
object- the EntityData object- Returns:
- compound ID
-
createEntityId
public static java.lang.String createEntityId(EntityData object, EntityData parent)
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 java.lang.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
-
-