atg.commerce.states
Class ObjectStates

java.lang.Object
  extended by atg.commerce.states.ObjectStates
Direct Known Subclasses:
CommerceItemStates, OrderStates, PaymentGroupStates, ShipItemRelationshipStates, ShippingGroupStates

public class ObjectStates
extends java.lang.Object

This is the base class for any class representing the possible states for an object. It provides methods for searching the state maps for the requested state value or string. Normally the state's integer representation, string representation, and description are all pulled from the configuration properties file. This does not work very well when operating in multiple languages. If translation of states is necessary, please use the methods getStateAsUserResource and getStateDescriptionAsUserResource instead of getStateAsString and getStateDescription respectively. The resource file at getResourceFileName will be used to look up string values for each of the states.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
ObjectStates()
           
 
Method Summary
 java.lang.String getDescriptionResourcePrefix()
          Return the resource key prefix for descriptions Currenty this returns resourcePrefix + "DESC"
 java.lang.String getResourceFileName()
          The name of the resource file to use for the states The default is "atg.commerce.states.StateResource"
 java.lang.String getResourcePrefix()
          Return the resource key prefix To allow for different objects to have the same states translated in different ways, this prefix will be prepended to any keys.
 java.lang.String getResourceString(java.lang.String pPrefix, java.lang.String pKey)
          This method returns a resource string by combining the given prefix with the given key and looking it up in a file using the current locale if prefix="ORDER" and key="SUBMITTED" then the resource key that is used is "ORDER.SUBMITTED" If the key is not found, then pKey is returned.
 java.lang.String getStateAsUserResource(int pState)
          This method returns a resourced value for the given state.
 java.lang.String getStateAsUserResource(java.lang.String pState)
          This method returns a resourced value for the given state.
 java.lang.String getStateAsUserResource(java.lang.String pPrefix, int pState)
          This method returns a resourced value for the given state.
 java.lang.String getStateAsUserResource(java.lang.String pPrefix, java.lang.String pState)
          This method returns a resourced value for the given state.
 java.lang.String getStateDescription(int pStateValue)
          This method gets the requested states description.
 java.lang.String getStateDescription(java.lang.String pStateString)
          This method gets the requested states description.
 java.lang.String getStateDescriptionAsUserResource(int pState)
          This method gets the requested states description from a resource file
 java.lang.String getStateDescriptionAsUserResource(java.lang.String pState)
          This method gets the requested states description from a resource file.
 java.lang.String getStateDescriptionAsUserResource(java.lang.String pPrefix, int pState)
          This method gets the requested states description from a resource file
 java.lang.String getStateDescriptionAsUserResource(java.lang.String pPrefix, java.lang.String pState)
          This method gets the requested states description from a resource file.
 java.util.Properties getStateDescriptionMap()
          stateDescriptionMap is the mapping between a state name and a description string
 int getStateFromString(java.lang.String pState)
          This method takes a states string value and returns the int value
 java.lang.String getStateString(int pState)
          This method gets the requested states string value.
 java.util.Properties getStateStringMap()
          stateStringMap is the mapping between a state name and a string
 int getStateValue(java.lang.String pStateName)
          This method gets the requested states value.
 java.util.Properties getStateValueMap()
          stateValueMap is the mapping between a state name and an integer
 void setStateDescriptionMap(java.util.Properties pProp)
           
 void setStateStringMap(java.util.Properties pProp)
           
 void setStateValueMap(java.util.Properties pProp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values
Constructor Detail

ObjectStates

public ObjectStates()
Method Detail

getResourceFileName

public java.lang.String getResourceFileName()
The name of the resource file to use for the states The default is "atg.commerce.states.StateResource"


setStateValueMap

public void setStateValueMap(java.util.Properties pProp)

getStateValueMap

public java.util.Properties getStateValueMap()
stateValueMap is the mapping between a state name and an integer


setStateStringMap

public void setStateStringMap(java.util.Properties pProp)

getStateStringMap

public java.util.Properties getStateStringMap()
stateStringMap is the mapping between a state name and a string


setStateDescriptionMap

public void setStateDescriptionMap(java.util.Properties pProp)

getStateDescriptionMap

public java.util.Properties getStateDescriptionMap()
stateDescriptionMap is the mapping between a state name and a description string


getStateValue

public int getStateValue(java.lang.String pStateName)
This method gets the requested states value.

Parameters:
pState - The name of the state we are getting the value for
Returns:
The integer value of the state

getStateDescription

public java.lang.String getStateDescription(java.lang.String pStateString)
This method gets the requested states description.

Parameters:
pState - The string value of the state we are getting the description for
Returns:
The description of the state

getStateDescription

public java.lang.String getStateDescription(int pStateValue)
This method gets the requested states description.

Parameters:
pState - The name of the state we are getting the description for
Returns:
The description of the state

getStateString

public java.lang.String getStateString(int pState)
This method gets the requested states string value.

Parameters:
pState - The value of the state we are getting the string value for
Returns:
The string value of the state

getStateFromString

public int getStateFromString(java.lang.String pState)
This method takes a states string value and returns the int value

Parameters:
pState - The string value of the state
Returns:
The int value of the state

getResourcePrefix

public java.lang.String getResourcePrefix()
Return the resource key prefix To allow for different objects to have the same states translated in different ways, this prefix will be prepended to any keys. For example the order has a state called processing. The shipping group also has a state called processing. To allow this to be translated in different ways, a prefix is prepended to the state meaning there are separate entries for: ORDER.PROCESSING and SHIPPING.PROCESSING


getDescriptionResourcePrefix

public java.lang.String getDescriptionResourcePrefix()
Return the resource key prefix for descriptions Currenty this returns resourcePrefix + "DESC"


getStateAsUserResource

public java.lang.String getStateAsUserResource(java.lang.String pState)
This method returns a resourced value for the given state. This will allow translation using a different resource for each language

Parameters:
pState - the string value of the state
Returns:
The resource for the state

getStateAsUserResource

public java.lang.String getStateAsUserResource(int pState)
This method returns a resourced value for the given state. This will allow translation using a different resource for each language

Parameters:
pState - the value of the state
Returns:
The resource for the state

getStateAsUserResource

public java.lang.String getStateAsUserResource(java.lang.String pPrefix,
                                               java.lang.String pState)
This method returns a resourced value for the given state. This will allow translation using a different resource for each language

Parameters:
pPrefix - add this to the beginning of the state that is used as the key
pState - the string value of the state
Returns:
The resource for the state

getStateAsUserResource

public java.lang.String getStateAsUserResource(java.lang.String pPrefix,
                                               int pState)
This method returns a resourced value for the given state. This will allow translation using a different resource for each language

Parameters:
pPrefix - add this to the beginning of the state that is used as the key
pState - the value of the state
Returns:
The resource for the state

getStateDescriptionAsUserResource

public java.lang.String getStateDescriptionAsUserResource(java.lang.String pState)
This method gets the requested states description from a resource file.

Parameters:
pState - The string value of the state we are getting the description for
Returns:
The description of the state

getStateDescriptionAsUserResource

public java.lang.String getStateDescriptionAsUserResource(int pState)
This method gets the requested states description from a resource file

Parameters:
pState - The value of the state we are getting the description for
Returns:
The description of the state

getStateDescriptionAsUserResource

public java.lang.String getStateDescriptionAsUserResource(java.lang.String pPrefix,
                                                          java.lang.String pState)
This method gets the requested states description from a resource file.

Parameters:
pPrefix - add this to the beginning of the state that is used as the key
pState - The string value of the state we are getting the description for
Returns:
The description of the state

getStateDescriptionAsUserResource

public java.lang.String getStateDescriptionAsUserResource(java.lang.String pPrefix,
                                                          int pState)
This method gets the requested states description from a resource file

Parameters:
pPrefix - add this to the beginning of the state that is used as the key
pState - The value of the state we are getting the description for
Returns:
The description of the state

getResourceString

public java.lang.String getResourceString(java.lang.String pPrefix,
                                          java.lang.String pKey)
This method returns a resource string by combining the given prefix with the given key and looking it up in a file using the current locale if prefix="ORDER" and key="SUBMITTED" then the resource key that is used is "ORDER.SUBMITTED" If the key is not found, then pKey is returned.

Parameters:
pPrefix - add this to the beginning of the key
pKey - the key that is used when looking up the resource
Returns:
The resource