public class TypedNLDescription extends java.lang.Object implements Description
Description
interface with types and locale
information.<!-- 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>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright
|
ADMIN_DESC, MAXSIZE, SHOPPER_LONG_DESC, SHOPPER_SHORT_DESC
Constructor and Description |
---|
TypedNLDescription()
Constructor for PromotionDescription.
|
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.
|
public static final java.lang.String COPYRIGHT
public TypedNLDescription()
public java.lang.String getDescription(java.util.Locale locale, int type)
Description
getDescription
in interface Description
locale
- The Locale
of the description to be returned.type
- The type of the description to be returned.Description.getDescription(Locale, int)
public java.lang.String getDefaultDescription(int type)
Description
getDefaultDescription
in interface Description
type
- The type of the description.Description.getDefaultDescription(int)
public void addDescription(java.util.Locale locale, int type, java.lang.String description)
Description
addDescription
in interface Description
locale
- The locale for which the description is added.type
- The type of the description.description
- The text of the description.Description.addDescription(Locale, int, String)
public void removeDescription(java.util.Locale locale, int type)
Description
removeDescription
in interface Description
locale
- The locale of the description to be removed.type
- The type of the description to be removed.Description.removeDescription(Locale, int)
public void reset()
Description
reset
in interface Description
Description.reset()
public java.lang.String toXML() throws XMLizationException
XMLizable
toXML
in interface XMLizable
XMLizationException
- when this process failsXMLizable.toXML()
public static int stringToType(java.lang.String str)
str
- string name of the description typepublic static java.util.Locale stringToLocale(java.lang.String str)
str
- the string value of the description type.public void fromXML(org.w3c.dom.Node anXMLNode) throws DeXMLizationException
XMLizable
fromXML
in interface XMLizable
anXMLNode
- The node that represents an XMLizable objectDeXMLizationException
- when this process failsXMLizable.fromXML(Node)
public void setDefaultLocale(java.util.Locale aDefaultLocale)
Description
setDefaultLocale
in interface Description
aDefaultLocale
- is the defaultLocale to set.Description.setDefaultLocale(Locale)
public static java.lang.String formatToXMLCompatibleData(java.lang.String text)
text
- the original textpublic java.util.Hashtable getDescriptions()
public java.util.Locale getDefaultLocale()