atg.projects.store.util
Class CountryRestrictionsService

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

public class CountryRestrictionsService
extends atg.nucleus.GenericService

This class contains different methods that are user in AvailableShippingGroups droplet


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
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
CountryRestrictionsService()
           
 
Method Summary
 boolean checkCountryInPermittedList(java.lang.String countryCode, java.util.List pPermittedCountryList)
          Checks if country is in permitted country list
static java.lang.String getCountryName(java.lang.String pCountryCode, java.util.Locale pUserLocale)
          This static method gets localized country name from the Resource Bundle based on the input locale.
 java.lang.String getDisplayNameForCode(java.util.ResourceBundle pResourceBundle, java.lang.String pCode, java.lang.String pDefault)
          This method returns the localized display name for the country code provided as input.
 java.util.List getPermittedCountryList(atg.servlet.DynamoHttpServletRequest pRequest, java.util.List pPermittedCountryCodes, java.util.List pRestrictedCountryCodes, atg.core.i18n.CountryList pCountryList)
          Gets the list of permitted country codes
 java.util.ResourceBundle getResourceBundle(atg.servlet.DynamoHttpServletRequest pRequest)
          Gets the resource bundle for user local, specified in request
 boolean isPermittedCountry(java.util.List pResultCountryList, java.lang.String pCountryCode)
          Check if country code is permitted.
 java.util.List removeCountryWithCode(java.util.ResourceBundle pResourceBundle, java.util.List pCodesToDelete, java.util.List pCountryList)
          This method removes the country codes (codesToDelete) from the country list (countryList) and returns the resultant list having localized country names.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, 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, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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 final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values
Constructor Detail

CountryRestrictionsService

public CountryRestrictionsService()
Method Detail

isPermittedCountry

public boolean isPermittedCountry(java.util.List pResultCountryList,
                                  java.lang.String pCountryCode)
Check if country code is permitted.

Parameters:
pResultCountryList - the results country list
pCountryCode - the country code
Returns:
true if pCountryCode is permitted, otherwise - false

removeCountryWithCode

public java.util.List removeCountryWithCode(java.util.ResourceBundle pResourceBundle,
                                            java.util.List pCodesToDelete,
                                            java.util.List pCountryList)
This method removes the country codes (codesToDelete) from the country list (countryList) and returns the resultant list having localized country names.

Parameters:
pResourceBundle - Resource Bundle used for country names localization.
pCodesToDelete - ArrayList Country codes to delete.
pCountryList - ArrayList List of countries.
Returns:
ArrayList List of countries with desired country codes and their localized country names.

getDisplayNameForCode

public java.lang.String getDisplayNameForCode(java.util.ResourceBundle pResourceBundle,
                                              java.lang.String pCode,
                                              java.lang.String pDefault)
This method returns the localized display name for the country code provided as input.

Parameters:
pResourceBundle - Resource Bundle used for country name localization.
pCode - String Country code.
pDefault - String Default value if localized country name is not found.
Returns:
String localized country name or the default valie if localized country name is not found.

getResourceBundle

public java.util.ResourceBundle getResourceBundle(atg.servlet.DynamoHttpServletRequest pRequest)
Gets the resource bundle for user local, specified in request

Parameters:
pRequest - the DynamoHttpServletRequest
Returns:
the resource bundle

checkCountryInPermittedList

public boolean checkCountryInPermittedList(java.lang.String countryCode,
                                           java.util.List pPermittedCountryList)
Checks if country is in permitted country list

Parameters:
countryCode - code of country to look in permitted country list
pPermittedCountryList - list of permitted country codes
Returns:
true, if countryCode is in permitted country list, false othwerwise

getPermittedCountryList

public java.util.List getPermittedCountryList(atg.servlet.DynamoHttpServletRequest pRequest,
                                              java.util.List pPermittedCountryCodes,
                                              java.util.List pRestrictedCountryCodes,
                                              atg.core.i18n.CountryList pCountryList)
Gets the list of permitted country codes

Parameters:
pRequest - the DynamoHttpServletRequest
pPermittedCountryCodes - the permitted country codes
pRestrictedCountryCodes - the restricted country codes
pCountryList - the country list
Returns:
the list of permitted country codes

getCountryName

public static java.lang.String getCountryName(java.lang.String pCountryCode,
                                              java.util.Locale pUserLocale)
                                       throws atg.droplet.DropletException
This static method gets localized country name from the Resource Bundle based on the input locale. (Provided for ShippingGroupFormHandler)

Parameters:
pCountryCode - String Country Code.
pUserLocale - Locale user locale.
Returns:
String localized country name.
Throws:
atg.droplet.DropletException - an exception within Droplet