Class MappingUtils

java.lang.Object
com.priint.pubserver.comet.bridge.util.MappingUtils

public class MappingUtils extends Object
Internal use only

The MappingUtils class provides various methods to create compound IDs for entities.

  • Field Details

    • ID_DELIMITER

      public static final char ID_DELIMITER
      The Constant ID_DELIMITER.
      See Also:
  • Method Details

    • createBucketId

      public static String createBucketId(Bucket bucket, Bucket parent)

      Creates a compound ID for a Bucket

      .
      Parameters:
      bucket - the Bucket
      parent - parent, if applicable, or null
      Returns:
      compound ID
    • createBucketIdWithPlanningParent

      public static String createBucketIdWithPlanningParent(Bucket bucket, Planning parent)

      Creates a compound ID for a Bucket with Planning parent.

      Parameters:
      bucket - the Bucket
      parent - parent, if applicable, or null
      Returns:
      compound ID
    • createPlanningId

      public static String createPlanningId(Planning planning)

      Creates a compound ID for a Planning.

      Parameters:
      planning - the Planning
      Returns:
      compound ID
    • createCordId

      public static String createCordId(Cord cord, Bucket parent)

      Creates a compound ID for a Cord.

      Parameters:
      cord - the Cord
      parent - parent, if applicable, or null
      Returns:
      compound ID
    • createKeyValueId

      public static String createKeyValueId(KeyValue keyValue, Bucket parent)

      Creates a compound ID for a KeyValue.

      Parameters:
      keyValue - the KeyValue
      parent - parent, if applicable, or null
      Returns:
      compund ID
    • createMediaAssetId

      public static String createMediaAssetId(MediaAsset asset, Bucket parent)

      Creates a compound ID for a MediaAsset.

      Parameters:
      asset - the MediaAsset
      parent - parent, if applicable, or null
      Returns:
      compound ID
    • createPriceId

      public static String createPriceId(Price price, Bucket parent)

      Creates a compound ID for a Price.

      Parameters:
      price - the Price
      parent - parent, if applicable, or null
      Returns:
      compound ID
    • createTextId

      public static String createTextId(Text text, Bucket parent)

      Creates a compound ID for a Text.

      Parameters:
      text - the Text
      parent - parent, if applicable, or null
      Returns:
      compound ID
    • createTocEntryId

      public static 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 String createTableDataId(TableData data, Bucket parent)

      Creates a compound ID for TableData.

      Parameters:
      data - the TableData
      parent - parent, if applicable, or null
      Returns:
      compound ID
    • createNullId

      public static String createNullId(Bucket parent)

      Creates a null ID with optional parent.

      Parameters:
      parent - parent, if applicable, or null
      Returns:
      null ID
    • createNullId

      public static 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 String getId(String comet3StringId, ParameterTags.ParameterTag tag)

      Gets a certain part of a compound ID.

      Parameters:
      comet3StringId - the compound ID
      tag - requested part of the ID
      Returns:
      requested part of the ID or empty string
    • getParentId

      public static String getParentId(String comet3StringId, ParameterTags.ParameterTag tag)

      Gets a certain parent part of a compound ID.

      Parameters:
      comet3StringId - the compound ID
      tag - requested part of the ID
      Returns:
      requested parent part of the ID or empty string
    • getPubServerId

      public static MappingUtils.PubServerId getPubServerId(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 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 object
      propertyName - 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 object
      propertyName - the property name
      value - 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 object
      propertyName - name of the property or virtual property
      defaultValue - default value
      parentOrFallback - 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 EntityData
      propertyName - name of the property
      defaultValue - 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 EntityData
      propertyName - name of the property
      defaultValue - default value
      parent - 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 String createEntityId(EntityData object)

      Creates a compound ID for an arbitrary EntityData object.

      Parameters:
      object - the EntityData object
      Returns:
      compound ID
    • createEntityId

      public static String createEntityId(EntityData object, EntityData parent)

      Creates a compound ID for an arbitrary EntityData object with optional parent.

      Parameters:
      object - the EntityData object
      parent - 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 object
      parent - parent, if applicable, or null
      mappingType - the mappingType to use
      Returns:
      compound ID