atg.commerce.util
Class ContextValueRetriever

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

public class ContextValueRetriever
extends GenericService

Determines the appropriate value for a profile property based on a site, and possibly what is already in the profile. Example uses of this class include determining the catalog or price list to use for a storefront page request or a call center agent helping the shopper associated with the profile.

For a multisite application that gets profile settings from the current site, configure useProfile to false. For an application that sets profile values at registration time, for example, configure useProfile to true.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  boolean mUseProfile
           
 
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
ContextValueRetriever()
           
 
Method Summary
 boolean isUseProfile()
          Indicates if profile properties have already been set to their correct values or should be assumed to be unreliable.
 RepositoryItem retrieveValue(atg.commerce.util.ContextValueRetrieverArguments pArguments)
          Determine the appropriate value for one profile property based on information provided in an arguments object.
 void setUseProfile(boolean pUseProfile)
          Sets property useProfile
 boolean shouldUseProfile(RepositoryItem pProfile)
          Indicates if profile properties have already been set to their correct values or should be ignored.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, 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, reResolveThis, 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
Class version string


mUseProfile

protected boolean mUseProfile
Constructor Detail

ContextValueRetriever

public ContextValueRetriever()
Method Detail

isUseProfile

public boolean isUseProfile()
Indicates if profile properties have already been set to their correct values or should be assumed to be unreliable.

Returns:
true if profile properties are unreliable, false if profile properties are already set

setUseProfile

public void setUseProfile(boolean pUseProfile)
Sets property useProfile


retrieveValue

public RepositoryItem retrieveValue(atg.commerce.util.ContextValueRetrieverArguments pArguments)
                             throws RepositoryException
Determine the appropriate value for one profile property based on information provided in an arguments object. This implementation uses a profile and site as possible sources for the returned value, following these steps: This implementation treats all profiles the same. If you want to use the existing profile value for special profiles and use the site value for other profiles, you can ovverride shouldUseProfile(RepositoryItem) to examine the profile to see if it is special. Customers who have more complex business rules should override this method.

Customers who need different logic for different profile properties (e.g., catalogs vs. price lists) should configure additional instances of the ContextValueRetriever component and reconfigure references to the original component.

Parameters:
pArguments - an object containing properties that define possible sources for the value to be retrieved
Returns:
a RepositoryItem (e.g., a catalog or price list)
Throws:
RepositoryException

shouldUseProfile

public boolean shouldUseProfile(RepositoryItem pProfile)
Indicates if profile properties have already been set to their correct values or should be ignored. This implementation returns the configured value of the useProfile property. Override this method to make a determination based on information stored in the profile.

Returns:
true if profile properties are already set, false if profile properties should be ignored