Class MacMetadata

java.lang.Object
com.day.cq.analytics.testandtarget.mac.MacMetadata

@ProviderType public class MacMetadata extends 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 Details

    • MacMetadata

      public MacMetadata()
  • Method Details

    • addAttribute

      @Nonnull public MacMetadata addAttribute(@Nonnull String attributeName, @Nonnull 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 String attributeName, @Nonnull 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 String attributeName)
      Removes a Marketing Cloud Metadata attribute from the list.
      Parameters:
      attributeName - the name of the attribute.
    • getMarketingCloudMetadata

      public Map<String,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 String getValue(@Nonnull 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 String[] getValues(@Nonnull 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 String editUrl, @Nonnull 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