Class MacMetadata


  • @ProviderType
    public class MacMetadata
    extends java.lang.Object
    Holds the Marketing Cloud Metadata which is attached to objects exported to Target. Not all objects require this metadata, so for now it's only attached to offers and activities
    • Constructor Summary

      Constructors 
      Constructor Description
      MacMetadata()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      MacMetadata addAttribute​(java.lang.String attributeName, java.lang.String attributeValue)
      Adds a Marketing Cloud Metadata attribute / value pair to this offer request.
      MacMetadata addAttribute​(java.lang.String attributeName, java.lang.String[] attributeValues)
      Adds a Marketing Cloud Metadata attribute / value pair to this offer request.
      static MacMetadata generateMandatoryMetadata​(java.lang.String editUrl, java.lang.String remoteModifiedBy)
      Generates the mandatory metadata.
      java.util.Map<java.lang.String,​java.lang.String> getMarketingCloudMetadata()
      Retrieves the list of the Marketing Cloud Metadata attributes.
      java.lang.String getValue​(java.lang.String attributeName)
      Retrieves the value of a specific attribute from this metadata set
      java.lang.String[] getValues​(java.lang.String attributeName)
      Retrieves the value of a specific attribute from this metadata set, specifying what type should the returned value be
      void removeAttribute​(java.lang.String attributeName)
      Removes a Marketing Cloud Metadata attribute from the list.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MacMetadata

        public MacMetadata()
    • Method Detail

      • addAttribute

        @Nonnull
        public MacMetadata addAttribute​(@Nonnull
                                        java.lang.String attributeName,
                                        @Nonnull
                                        java.lang.String attributeValue)
        Adds a Marketing Cloud Metadata attribute / value pair to this offer request. The following restrictions apply:
        • the attributeName or attributeValue must not exceed 250 chars in length
        • The maximum size of the MAC Metadata list is 15 items
        This method throws a RuntimeException if any of the above mentioned restrictions are hit.
        Parameters:
        attributeName - the name of the attribute
        attributeValue - the value of the attribute
        Returns:
        MacMetadata
      • addAttribute

        public MacMetadata addAttribute​(@Nonnull
                                        java.lang.String attributeName,
                                        @Nonnull
                                        java.lang.String[] attributeValues)
        Adds a Marketing Cloud Metadata attribute / value pair to this offer request. The following restrictions apply:
        • the attributeName or attributeValue must not exceed 250 chars in length
        • The maximum size of the MAC Metadata list is 15 items
        This method throws a RuntimeException if any of the above mentioned restrictions are hit.
        Parameters:
        attributeName - the name of the attribute
        attributeValues - the values of the attributes
        Returns:
        MacMetadata
      • removeAttribute

        public void removeAttribute​(@Nonnull
                                    java.lang.String attributeName)
        Removes a Marketing Cloud Metadata attribute from the list.
        Parameters:
        attributeName - the name of the attribute.
      • getMarketingCloudMetadata

        public java.util.Map<java.lang.String,​java.lang.String> getMarketingCloudMetadata()
        Retrieves the list of the Marketing Cloud Metadata attributes.
        Returns:
        a Map having the attribute names as keys and the attribute values as values.
      • getValue

        @Nullable
        public java.lang.String getValue​(@Nonnull
                                         java.lang.String attributeName)
        Retrieves the value of a specific attribute from this metadata set
        Parameters:
        attributeName - the name of the attribute
        Returns:
        a String containing the value, or null if the value is not found or it's not a String.
      • getValues

        @Nullable
        public java.lang.String[] getValues​(@Nonnull
                                            java.lang.String attributeName)
        Retrieves the value of a specific attribute from this metadata set, specifying what type should the returned value be
        Parameters:
        attributeName - the name of the attribute
        Returns:
        the value cast to the specified type
      • generateMandatoryMetadata

        @Nonnull
        public static MacMetadata generateMandatoryMetadata​(@Nonnull
                                                            java.lang.String editUrl,
                                                            @Nonnull
                                                            java.lang.String remoteModifiedBy)
        Generates the mandatory metadata. The mandatory metadata contains the following attributes:
        • The edit url of the object, i.e. the full URL used to open the object in it's editor in AEM
        • The user that perform the last modification
        • The source product name (in our case Adobe Experience Manager)
        Parameters:
        editUrl - the URL which is used to access the object
        remoteModifiedBy - the user which performed the last modification
        Returns:
        a MacMetadata object containing the three attributes above