com.elasticpath.domain.tax.impl
Class TaxJurisdictionImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractPersistenceImpl
          extended by com.elasticpath.domain.impl.AbstractEntityImpl
              extended by com.elasticpath.domain.tax.impl.TaxJurisdictionImpl
All Implemented Interfaces:
Entity, EpDomain, Persistence, TaxJurisdiction, java.io.Serializable

public class TaxJurisdictionImpl
extends AbstractEntityImpl
implements TaxJurisdiction

A TaxJurisdiction represents a geographic area that has it's own distinct set of TaxCategorys and TaxValues ie a Country, a State, a City, a Municipal, or a County.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Fields inherited from interface com.elasticpath.domain.tax.TaxJurisdiction
FIELD_MATCH_CITY, FIELD_MATCH_COUNTRY, FIELD_MATCH_NONE, FIELD_MATCH_SUBCOUNTRY, FIELD_MATCH_ZIP_POSTAL_CODE, PRICE_CALCULATION_EXCLUSIVE, PRICE_CALCULATION_INCLUSIVE
 
Constructor Summary
TaxJurisdictionImpl()
           
 
Method Summary
 int getFieldMatchType()
          Retrieve the field match type for this TaxJurisdiction.
 java.util.Map getFullTaxValueMap()
          Traverse the parent TaxJurisdiction and build up a map of taxValues, keyed by TaxCategory.
 TaxJurisdiction getParent()
          Get the parent taxJurisdiction of this taxJurisdiction.
 java.lang.Boolean getPriceCalculationMethod()
          Return the price calculation method of this TaxJurisdiction.
 java.lang.String getRegionCode()
          Get the region code of the geographic area represented by the TaxJurisdiction.
 java.lang.String getRegionCodePathStr()
          Retrieve the region path of this taxJurisdiction, i.e.
 java.lang.String getRegionCodePathStrWithoutCity()
          Retrieve the region path of this taxJurisdiction, i.e.
 java.util.Map getTaxCategoryXMap()
          Get the taxCategoryUid -> TaxJurisdictionCategoryX map.
 boolean isParent(TaxJurisdiction taxJurisdiction)
          Check if this taxJurisdiction is the direct or indirect parent of the given taxJurisdiction.
 void setDefaultValues()
          Set default values for those fields that need default values.
 void setFieldMatchType(int fieldMatchType)
          Set the field match type for this TaxJurisdiction.
 void setParent(TaxJurisdiction parent)
          Set the parent taxJurisdiction of this taxJurisdiction.
 void setPriceCalculationMethod(java.lang.Boolean priceCalculationMethod)
          Set the price calculation method of this TaxJurisdiction.
 void setRegionCode(java.lang.String regionCode)
          Set the region code of the geographic area represented by the TaxJurisdiction.
 void setTaxCategoryXMap(java.util.Map taxCategoryXMap)
          Set the taxCategoryUid -> TaxJurisdictionCategoryX map.
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEntityImpl
convertAttributeGroupAttributes, getGuid, setGuid
 
Methods inherited from class com.elasticpath.domain.impl.AbstractPersistenceImpl
executeBeforePersistAction, getUidPk, isPersistent, setUidPk
 
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.Entity
getGuid, setGuid
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

TaxJurisdictionImpl

public TaxJurisdictionImpl()
Method Detail

getFieldMatchType

public int getFieldMatchType()
Retrieve the field match type for this TaxJurisdiction.

Specified by:
getFieldMatchType in interface TaxJurisdiction
Returns:
the field match type for this TaxJurisdiction.

getFullTaxValueMap

public java.util.Map getFullTaxValueMap()
Traverse the parent TaxJurisdiction and build up a map of taxValues, keyed by TaxCategory. The TaxValue specified at a lower taxJurisdiction level will be used. Since the tax value configuration should not be changed so often, so it is cached.

Specified by:
getFullTaxValueMap in interface TaxJurisdiction
Returns:
the fully populated taxValue map.

getParent

public TaxJurisdiction getParent()
Get the parent taxJurisdiction of this taxJurisdiction. Returns null if this taxJurisdiction doesn't have a parent.

Specified by:
getParent in interface TaxJurisdiction
Returns:
the parent taxJurisdiction (or null no parent).

getPriceCalculationMethod

public java.lang.Boolean getPriceCalculationMethod()
Return the price calculation method of this TaxJurisdiction. If this is not taxJurisdiction at the country level, get the priceCalculationMethod from its country level parent.

Specified by:
getPriceCalculationMethod in interface TaxJurisdiction
Returns:
the price calculation method.

getRegionCode

public java.lang.String getRegionCode()
Get the region code of the geographic area represented by the TaxJurisdiction.

Specified by:
getRegionCode in interface TaxJurisdiction
Returns:
the regionCode

getRegionCodePathStr

public java.lang.String getRegionCodePathStr()
Retrieve the region path of this taxJurisdiction, i.e. "BC CA", where BC is the region code of this taxJurisdiction and CA is the region code of its parent taxJurisdiction.

Specified by:
getRegionCodePathStr in interface TaxJurisdiction
Returns:
the region path of this taxJurisdiction

getRegionCodePathStrWithoutCity

public java.lang.String getRegionCodePathStrWithoutCity()
Retrieve the region path of this taxJurisdiction, i.e. "BC CA", where BC is the region code of this taxJurisdiction and CA is the region code of its parent taxJurisdiction. However the region code is skipped if the parent TaxJurisdiction's field match type is 3 (FIELD_MATCH_CITY).

Specified by:
getRegionCodePathStrWithoutCity in interface TaxJurisdiction
Returns:
the region path of this taxJurisdiction

getTaxCategoryXMap

public java.util.Map getTaxCategoryXMap()
Get the taxCategoryUid -> TaxJurisdictionCategoryX map.

Specified by:
getTaxCategoryXMap in interface TaxJurisdiction
Returns:
the taxCategoryUid -> TaxJurisdictionCategoryX map.

isParent

public boolean isParent(TaxJurisdiction taxJurisdiction)
Check if this taxJurisdiction is the direct or indirect parent of the given taxJurisdiction.

Specified by:
isParent in interface TaxJurisdiction
Parameters:
taxJurisdiction - the taxJurisdiction to be checked to see if it is the direct/indirect child.
Returns:
whether this taxJurisdiction is the direct or indirect parent of the given taxJurisdiction.

setDefaultValues

public void setDefaultValues()
Set default values for those fields that need default values.

Specified by:
setDefaultValues in interface Persistence
Overrides:
setDefaultValues in class AbstractEntityImpl

setFieldMatchType

public void setFieldMatchType(int fieldMatchType)
Set the field match type for this TaxJurisdiction.

Specified by:
setFieldMatchType in interface TaxJurisdiction
Parameters:
fieldMatchType - the field match type.

setParent

public void setParent(TaxJurisdiction parent)
Set the parent taxJurisdiction of this taxJurisdiction.

Specified by:
setParent in interface TaxJurisdiction
Parameters:
parent - - the parent taxJurisdiction.

setPriceCalculationMethod

public void setPriceCalculationMethod(java.lang.Boolean priceCalculationMethod)
Set the price calculation method of this TaxJurisdiction. Only the priceCalculationMethod set at the country level TaxJurisdiction will be used during tax/price calculation.

Specified by:
setPriceCalculationMethod in interface TaxJurisdiction
Parameters:
priceCalculationMethod - - the price calculation method to be set.

setRegionCode

public void setRegionCode(java.lang.String regionCode)
Set the region code of the geographic area represented by the TaxJurisdiction.

Specified by:
setRegionCode in interface TaxJurisdiction
Parameters:
regionCode - the parameter regionCode

setTaxCategoryXMap

public void setTaxCategoryXMap(java.util.Map taxCategoryXMap)
Set the taxCategoryUid -> TaxJurisdictionCategoryX map.

Specified by:
setTaxCategoryXMap in interface TaxJurisdiction
Parameters:
taxCategoryXMap - - the taxCategoryUid -> TaxJurisdictionCategoryX map.