com.elasticpath.domain.misc.impl
Class GeographyImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractTransientImpl
          extended by com.elasticpath.domain.misc.impl.GeographyImpl
All Implemented Interfaces:
EpDomain, Geography, Transient, java.io.Serializable

public class GeographyImpl
extends AbstractTransientImpl
implements Geography

Represents a set of countries and provides geography-related functionality such as finding the subcountries of a particular country. A subcountry is a region of a country such as a province, state, or territory. Assumptions: - The country and subcountry properties do not change at runtime.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.elasticpath.domain.impl.AbstractTransientImpl
serialVersionUID
 
Fields inherited from interface com.elasticpath.domain.misc.Geography
COUNTRY_PROPS, DEFAULT_COUNTRY, SUBCOUNTRY_PROPS_KEY_PREFIX
 
Constructor Summary
GeographyImpl()
           
 
Method Summary
 java.util.Map getAllSubCountries()
          Returns the default map of subcountries codes and their labels.
 java.util.Map getAllSubCountries(java.util.Locale locale)
          Returns a localized map of subcountry codes and their localized labels.
 java.util.Map getAvailableSubCountries()
          Return the available subcountries based on the specified list of available regions set using the setAvailableRegions method.
 java.util.Map getCountries()
          Returns a map of countries where the keys are country codes and the values are labels for the corresponding country.
 java.util.Map getCountries(java.util.Locale locale)
          Returns a map of countries where the keys are country codes and the values are localized labels for the corresponding locale & country.
 java.util.Map getCountry2SubCountries()
          Return a map of countryCode to subcountries codes/labels mapping.
 java.util.Map getCountry2SubCountries(java.util.Locale locale)
          Return a map of countryCode to subcountries codes/labels mapping.
 java.util.Map getCountry2SubCountriesMap()
          Return the default map of countryCode to subcountries codes/labels mapping.
 java.util.Map getSubCountries(java.lang.String countryCode)
          Return the default map of subcountries codes and their labels for the country with the given ISO country code.
 java.util.Map getSubCountries(java.lang.String countryCode, java.util.Locale locale)
          Return a localized map of subcountries codes and their labels for the country with the given ISO country code.
 void setAvailableRegions(java.util.List regions)
          Set the ShippingRegions that define the set of available countries and subcountries.
 void setPropertiesMap(java.util.Map propertiesMap)
          Set the properties (file) map that is used as a source of Country data.
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Constructor Detail

GeographyImpl

public GeographyImpl()
Method Detail

getAllSubCountries

public java.util.Map getAllSubCountries()
Returns the default map of subcountries codes and their labels. Subcountries are any region of a country such as a province, state, or territory. Note that this method assumes the country information does not change at runtime.

Specified by:
getAllSubCountries in interface Geography
Returns:
a map of codes to labels of subcountries for all countries.

getAllSubCountries

public java.util.Map getAllSubCountries(java.util.Locale locale)
Returns a localized map of subcountry codes and their localized labels. Subcountries are any region of a country such as a province, state, or territory. Note that this method assumes the country information does not change at runtime.

Specified by:
getAllSubCountries in interface Geography
Parameters:
locale - the current locale
Returns:
a map of codes to labels of subcountries for all countries.

getAvailableSubCountries

public java.util.Map getAvailableSubCountries()
Return the available subcountries based on the specified list of available regions set using the setAvailableRegions method.

Specified by:
getAvailableSubCountries in interface Geography
Returns:
a Map of subcountry codes to subcountry display names

getCountries

public java.util.Map getCountries()
Returns a map of countries where the keys are country codes and the values are labels for the corresponding country.

Specified by:
getCountries in interface Geography
Returns:
the map of country codes to labels

getCountries

public java.util.Map getCountries(java.util.Locale locale)
Returns a map of countries where the keys are country codes and the values are localized labels for the corresponding locale & country.

Specified by:
getCountries in interface Geography
Parameters:
locale - the current locale to load
Returns:
Map of country codes and localized labels

getCountry2SubCountries

public java.util.Map getCountry2SubCountries()
Return a map of countryCode to subcountries codes/labels mapping.

Specified by:
getCountry2SubCountries in interface Geography
Returns:
a map of countryCode to subcountries codes/labels mapping.

getCountry2SubCountries

public java.util.Map getCountry2SubCountries(java.util.Locale locale)
Return a map of countryCode to subcountries codes/labels mapping.

Specified by:
getCountry2SubCountries in interface Geography
Parameters:
locale - the current locale
Returns:
a map of countryCode to subcountries codes/localized labels mapping.

getCountry2SubCountriesMap

public java.util.Map getCountry2SubCountriesMap()
Return the default map of countryCode to subcountries codes/labels mapping.

Specified by:
getCountry2SubCountriesMap in interface Geography
Returns:
a map of countryCode to subcountries codes/labels mapping.

getSubCountries

public java.util.Map getSubCountries(java.lang.String countryCode)
Return the default map of subcountries codes and their labels for the country with the given ISO country code.

Specified by:
getSubCountries in interface Geography
Parameters:
countryCode - ISO country code
Returns:
a map of subcountries codes and their labels for the country with the given ISO country code.

getSubCountries

public java.util.Map getSubCountries(java.lang.String countryCode,
                                     java.util.Locale locale)
Return a localized map of subcountries codes and their labels for the country with the given ISO country code.

Specified by:
getSubCountries in interface Geography
Parameters:
countryCode - ISO country code
locale - the current locale
Returns:
a map of subcountries codes and their labels for the country with the given ISO country code.

setAvailableRegions

public void setAvailableRegions(java.util.List regions)
Set the ShippingRegions that define the set of available countries and subcountries.

Specified by:
setAvailableRegions in interface Geography
Parameters:
regions - a List of ShippingRegions

setPropertiesMap

public void setPropertiesMap(java.util.Map propertiesMap)
Set the properties (file) map that is used as a source of Country data.

Specified by:
setPropertiesMap in interface Geography
Parameters:
propertiesMap - the map containing properties data about countries.