com.elasticpath.service.tax.impl
Class TaxJurisdictionServiceImpl

java.lang.Object
  extended by com.elasticpath.service.impl.AbstractEpServiceImpl
      extended by com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
          extended by com.elasticpath.service.tax.impl.TaxJurisdictionServiceImpl
All Implemented Interfaces:
EpPersistenceService, EpService, TaxJurisdictionService

public class TaxJurisdictionServiceImpl
extends AbstractEpPersistenceServiceImpl
implements TaxJurisdictionService

The default implementation of TaxJurisdictionService.


Constructor Summary
TaxJurisdictionServiceImpl()
           
 
Method Summary
 TaxJurisdiction add(TaxJurisdiction taxJurisdiction)
          Adds the given taxJurisdiction.
 TaxJurisdiction get(long taxJurisdictionUid)
          Get the taxJurisdiction with the given UID.
 java.lang.Object getObject(long uid)
          Generic load method for all persistable domain models.
 java.util.List getTaxJurisdictionChildren(TaxJurisdiction taxJurisdiction)
          Get all the child tax jurisidction belong to the given taxJurisdiction.
 Utility getUtility()
          Returns the utility instance.
 java.util.List list()
          List all taxJurisdictions stored in the database.
 java.util.List listRootTaxJurisdictions()
          Retrieve all root tax jurisdictions (the country level ones).
 TaxJurisdiction load(long taxJurisdictionUid)
          Load the taxJurisdiction with the given UID.
 void remove(TaxJurisdiction taxJurisdiction)
          Delete the taxJurisdiction.
 TaxJurisdiction retrieveTaxJurisdiction(Address address)
          Matches shipping address to the most specific matching Tax Jurisdiction level.
 void setUtility(Utility utility)
          Sets the utility.
 void update(TaxJurisdiction taxJurisdiction)
          Updates the given taxJurisdiction.
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
getPersistenceEngine, setPersistenceEngine
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpServiceImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.service.EpPersistenceService
getPersistenceEngine, setPersistenceEngine
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Constructor Detail

TaxJurisdictionServiceImpl

public TaxJurisdictionServiceImpl()
Method Detail

add

public TaxJurisdiction add(TaxJurisdiction taxJurisdiction)
                    throws TaxJurisdictionExistException
Adds the given taxJurisdiction.

Specified by:
add in interface TaxJurisdictionService
Parameters:
taxJurisdiction - the taxJurisdiction to add
Returns:
the persisted instance of taxJurisdiction
Throws:
TaxJurisdictionExistException - - if a taxJurisdiction associated with the given region already exists.

get

public TaxJurisdiction get(long taxJurisdictionUid)
                    throws EpServiceException
Get the taxJurisdiction with the given UID. Return null if no matching record exists.

Specified by:
get in interface TaxJurisdictionService
Parameters:
taxJurisdictionUid - the taxJurisdiction UID
Returns:
the taxJurisdiction if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getObject

public java.lang.Object getObject(long uid)
                           throws EpServiceException
Generic load method for all persistable domain models.

Specified by:
getObject in interface EpPersistenceService
Parameters:
uid - the persisted instance uid
Returns:
the persisted instance if exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getTaxJurisdictionChildren

public java.util.List getTaxJurisdictionChildren(TaxJurisdiction taxJurisdiction)
Get all the child tax jurisidction belong to the given taxJurisdiction.

Specified by:
getTaxJurisdictionChildren in interface TaxJurisdictionService
Parameters:
taxJurisdiction - - the taxJurisdiction to find children for.
Returns:
the list of child tax jurisidction.

getUtility

public Utility getUtility()
Returns the utility instance.

Returns:
the utility instance.

list

public java.util.List list()
                    throws EpServiceException
List all taxJurisdictions stored in the database.

Specified by:
list in interface TaxJurisdictionService
Returns:
a list of taxJurisdictions
Throws:
EpServiceException - - in case of any errors

listRootTaxJurisdictions

public java.util.List listRootTaxJurisdictions()
Retrieve all root tax jurisdictions (the country level ones).

Specified by:
listRootTaxJurisdictions in interface TaxJurisdictionService
Returns:
return all root tax jurisdictions

load

public TaxJurisdiction load(long taxJurisdictionUid)
                     throws EpServiceException
Load the taxJurisdiction with the given UID. Throw an unrecoverable exception if there is no matching database row.

Specified by:
load in interface TaxJurisdictionService
Parameters:
taxJurisdictionUid - the taxJurisdiction UID
Returns:
the taxJurisdiction if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

remove

public void remove(TaxJurisdiction taxJurisdiction)
            throws EpServiceException
Delete the taxJurisdiction.

Specified by:
remove in interface TaxJurisdictionService
Parameters:
taxJurisdiction - the taxJurisdiction to remove
Throws:
EpServiceException - - in case of any errors

retrieveTaxJurisdiction

public TaxJurisdiction retrieveTaxJurisdiction(Address address)
                                        throws EpServiceException
Matches shipping address to the most specific matching Tax Jurisdiction level.

Specified by:
retrieveTaxJurisdiction in interface TaxJurisdictionService
Parameters:
address - - the address used to retrieve the matching jurisdiction.
Returns:
the matching taxJurisdiction.
Throws:
EpServiceException - - in case of any errors

setUtility

public void setUtility(Utility utility)
Sets the utility.

Parameters:
utility - the utility to set

update

public void update(TaxJurisdiction taxJurisdiction)
            throws TaxJurisdictionExistException
Updates the given taxJurisdiction.

Specified by:
update in interface TaxJurisdictionService
Parameters:
taxJurisdiction - the taxJurisdiction to update
Throws:
TaxJurisdictionExistException - - if a taxJurisdiction associated with the given region already exists.