Class MappingUtils


  • public class MappingUtils
    extends java.lang.Object
    Internal use only

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

    • 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 Bucket
        parent - 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 Bucket
        parent - 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 Cord
        parent - 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 KeyValue
        parent - 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 MediaAsset
        parent - 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 Price
        parent - 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 Text
        parent - 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 TableData
        parent - 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 ID
        tag - 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 ID
        tag - 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 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,
                                                 java.lang.String propertyName,
                                                 java.lang.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 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 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 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 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 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 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 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 object
        parent - 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 object
        parent - parent, if applicable, or null
        mappingType - the mappingType to use
        Returns:
        compound ID