com.ibm.commerce.marketing.promotion

Class TypedNLDescription

  • java.lang.Object
    • com.ibm.commerce.marketing.promotion.TypedNLDescription
  • All Implemented Interfaces:
    Description, XMLizable, java.io.Serializable


    public class TypedNLDescription
    extends java.lang.Object
    implements Description
    This is the typed national language description used by promotion. This class implements the Description interface with types and locale information.
    XML Snippet for the TypedNLDescription is as follows:
      <!-- Various descriptions of the promotion -->
      <TypedNLDescription impl="com.ibm.commerce.marketing.promotion.TypedNLDescription">
            <DefaultLocale>en_US</DefaultLocale>
            <Description locale="en_US" type="admin">A sample promotion</Description>
            <Description locale="en_US" type="long">A sample promotion</Description>
            <Description locale="en_US" type="short">A sample promotion</Description>
            <Description locale="en_US" type="custom1">A sample promotion</Description>
            <Description locale="en_US" type="custom2">A sample promotion</Description>
            <Description locale="en_US" type="custom3">A sample promotion</Description>
            <Description locale="en_US" type="custom4">A sample promotion</Description>
            <Description locale="en_US" type="custom5">A sample promotion</Description>
      </TypedNLDescription>
     
      
      
     
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      TypedNLDescription()
      Constructor for PromotionDescription.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addDescription(java.util.Locale locale, int type, java.lang.String description)
      Adds a description with a type, locale and text.
      static java.lang.String formatToXMLCompatibleData(java.lang.String text)
      Replaces illegal characters with entity references in XML.
      void fromXML(org.w3c.dom.Node anXMLNode)
      Transforms the XML node into its corresponding real Object.
      java.lang.String getDefaultDescription(int type)
      Returns the specified type of the description in the default locale.
      java.util.Locale getDefaultLocale()
      Return the default locale defined in this promotion XML string.
      java.lang.String getDescription(java.util.Locale locale, int type)
      Returns the specified type of the description in a particular locale.
      java.util.Hashtable getDescriptions()
      Return all the descriptions defined in this promotion XML string.
      void removeDescription(java.util.Locale locale, int type)
      Removes a description with a type and locale.
      void reset()
      Resets the description, removes all descriptions.
      void setDefaultLocale(java.util.Locale aDefaultLocale)
      Sets the default locale for this description object.
      static java.util.Locale stringToLocale(java.lang.String str)
      Converts a string value to a Locale object.
      static int stringToType(java.lang.String str)
      Converts string to integer values for description types
      java.lang.String toXML()
      Converts the object into its corresponding XML format representation.
      • Methods inherited from class java.lang.Object

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

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM Copyright
        See Also:
        Constant Field Values
    • Constructor Detail

      • TypedNLDescription

        public TypedNLDescription()
        Constructor for PromotionDescription.
    • Method Detail

      • getDescription

        public java.lang.String getDescription(java.util.Locale locale,
                                               int type)
        Description copied from interface: Description
        Returns the specified type of the description in a particular locale. The types of the description include the following:
        0: Administrative description
        1: Customer facing long description
        2: Customer facing short description
        Specified by:
        getDescription in interface Description
        Parameters:
        locale - The Locale of the description to be returned.
        type - The type of the description to be returned.
        Returns:
        String The specified type of the description in a locale.
        See Also:
        Description.getDescription(Locale, int)
      • getDefaultDescription

        public java.lang.String getDefaultDescription(int type)
        Description copied from interface: Description
        Returns the specified type of the description in the default locale. The types of the description include the following:
        0: Administrative description
        1: Customer facing long description
        2: Customer facing short description
        Specified by:
        getDefaultDescription in interface Description
        Parameters:
        type - The type of the description.
        Returns:
        The specified type of the description in default locale.
        See Also:
        Description.getDefaultDescription(int)
      • addDescription

        public void addDescription(java.util.Locale locale,
                                   int type,
                                   java.lang.String description)
        Description copied from interface: Description
        Adds a description with a type, locale and text. The types of the description include the following:
        0: Administrative description
        1: Customer facing long description
        2: Customer facing short description
        Specified by:
        addDescription in interface Description
        Parameters:
        locale - The locale for which the description is added.
        type - The type of the description.
        description - The text of the description.
        See Also:
        Description.addDescription(Locale, int, String)
      • removeDescription

        public void removeDescription(java.util.Locale locale,
                                      int type)
        Description copied from interface: Description
        Removes a description with a type and locale. The types of the description include the following:
        0: Administrative description
        1: Customer facing long description
        2: Customer facing short description
        Specified by:
        removeDescription in interface Description
        Parameters:
        locale - The locale of the description to be removed.
        type - The type of the description to be removed.
        See Also:
        Description.removeDescription(Locale, int)
      • stringToType

        public static int stringToType(java.lang.String str)
        Converts string to integer values for description types
        Parameters:
        str - string name of the description type
        Returns:
        int value of the description type
      • stringToLocale

        public static java.util.Locale stringToLocale(java.lang.String str)
        Converts a string value to a Locale object.
        Parameters:
        str - the string value of the description type.
        Returns:
        a Locale object represented by the string input parameter.
      • formatToXMLCompatibleData

        public static java.lang.String formatToXMLCompatibleData(java.lang.String text)
        Replaces illegal characters with entity references in XML. Replaces "&" with "&", "<" with "<", ">" with ">", "'" with "'" and "\" with """
        Parameters:
        text - the original text
        Returns:
        the text with all the illegal characters replaced by entity references
      • getDescriptions

        public java.util.Hashtable getDescriptions()
        Return all the descriptions defined in this promotion XML string.
        Returns:
        A table of descriptions referenced by the Locale keys.
      • getDefaultLocale

        public java.util.Locale getDefaultLocale()
        Return the default locale defined in this promotion XML string.
        Returns:
        A default locale predefined in this promotion XML string.