atg.commerce.util
Class PlaceList

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.util.PlaceList
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class PlaceList
extends GenericService

This class represents a list of places, each of which has a code and an associated display name. For example, you might use this class to store a list of US states together with their two-letter abbreviations, or a list of countries each with a shipping code and a display name.

The class is initialized by providing a list of strings in the property strings, alternating codes and display names. For example, this properties file demonstrates initializing an instance of PlaceList with a (partial) list of US states:

PlaceLists are typically used in JHTML or JSP pages by retrieving the places property and iterating over it with a droplet like ForEach. The places property is an array, each of whose elements has properties named code and displayName.

This example shows how you might use a PlaceList in a JHTML page:

The example shown above would produce the following output:


Nested Class Summary
static class PlaceList.Place
          Inner class used to associate a code with a display name to define a single place.
 
Field Summary
static java.lang.String CLASS_VERSION
           
protected  java.lang.String[] mInitStrings
           
protected  PlaceList.Place[] mPlaces
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
PlaceList()
           
 
Method Summary
 void doStartService()
          Parse the list of initialization strings from strings into an array of Place objects and store them in places
 PlaceList.Place getPlaceForCode(java.lang.String pCode)
          Get the place object that corresponds to the input place code.
 PlaceList.Place[] getPlaces()
          Get the list of Place objects managed by this object.
 java.lang.String[] getStrings()
          Get the list of initialization strings provided to this object.
 void setStrings(java.lang.String[] pStrings)
          Specify the list of places, alternating codes and display names.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION

mInitStrings

protected java.lang.String[] mInitStrings

mPlaces

protected PlaceList.Place[] mPlaces
Constructor Detail

PlaceList

public PlaceList()
Method Detail

setStrings

public void setStrings(java.lang.String[] pStrings)
Specify the list of places, alternating codes and display names.


getStrings

public java.lang.String[] getStrings()
Get the list of initialization strings provided to this object.


getPlaces

public PlaceList.Place[] getPlaces()
Get the list of Place objects managed by this object. Each place will have String properties called code and displayName.


doStartService

public void doStartService()
                    throws ServiceException
Parse the list of initialization strings from strings into an array of Place objects and store them in places

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up

getPlaceForCode

public PlaceList.Place getPlaceForCode(java.lang.String pCode)
Get the place object that corresponds to the input place code.