com.elasticpath.service.shipping.impl
Class ShippingRegionServiceImpl

java.lang.Object
  extended by com.elasticpath.service.impl.AbstractEpServiceImpl
      extended by com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
          extended by com.elasticpath.service.shipping.impl.ShippingRegionServiceImpl
All Implemented Interfaces:
EpPersistenceService, EpService, ShippingRegionService

public class ShippingRegionServiceImpl
extends AbstractEpPersistenceServiceImpl
implements ShippingRegionService

Provide shipping region-related business service.


Constructor Summary
ShippingRegionServiceImpl()
           
 
Method Summary
 ShippingRegion add(ShippingRegion shippingRegion)
          Adds the given shippingRegion.
 ShippingRegion findByName(java.lang.String name)
          Find the shipping region with the given name.
 ShippingRegion get(long shippingRegionUid)
          Get the shippingRegion with the given UID.
 java.util.List getAllRegions()
          Return the List of all possible Region (country/sub country combintaion) based on the country and subcountry property configuraion.
 java.lang.Object getObject(long uid)
          Generic load method for all persistable domain models.
 PropertyService getPropertyService()
          Return the propertyService singleton.
 java.util.List list()
          List all shippingRegions stored in the database.
 ShippingRegion load(long shippingRegionUid)
          Load the shippingRegion with the given UID.
 boolean nameExists(ShippingRegion shippingRegion)
          Check if a different shipping region with the given shipping region's name exists exists or not.
 boolean nameExists(java.lang.String name)
          Check the given shipping region's name exists or not.
 void remove(ShippingRegion shippingRegion)
          Delete the shippingRegion.
 void setPropertyService(PropertyService propertyService)
          Set the propertyService singleton.
 void update(ShippingRegion shippingRegion)
          Updates the given shippingRegion.
 
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

ShippingRegionServiceImpl

public ShippingRegionServiceImpl()
Method Detail

add

public ShippingRegion add(ShippingRegion shippingRegion)
                   throws ShippingRegionExistException
Adds the given shippingRegion.

Specified by:
add in interface ShippingRegionService
Parameters:
shippingRegion - the shippingRegion to add
Returns:
the persisted instance of shippingRegion
Throws:
ShippingRegionExistException - - If a shipping region with the same name already exists.

findByName

public ShippingRegion findByName(java.lang.String name)
                          throws EpServiceException
Find the shipping region with the given name.

Specified by:
findByName in interface ShippingRegionService
Parameters:
name - - the shipping region name
Returns:
the shippingRegion with the given name if exists, otherwise null
Throws:
EpServiceException - - in case of any errors

get

public ShippingRegion get(long shippingRegionUid)
                   throws EpServiceException
Get the shippingRegion with the given UID. Return null if no matching record exists.

Specified by:
get in interface ShippingRegionService
Parameters:
shippingRegionUid - the shippingRegion UID
Returns:
the shippingRegion if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getAllRegions

public java.util.List getAllRegions()
Return the List of all possible Region (country/sub country combintaion) based on the country and subcountry property configuraion.

Specified by:
getAllRegions in interface ShippingRegionService
Returns:
the list of all possible Region.

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

getPropertyService

public PropertyService getPropertyService()
Return the propertyService singleton.

Specified by:
getPropertyService in interface ShippingRegionService
Returns:
the propertyService singleton.

list

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

Specified by:
list in interface ShippingRegionService
Returns:
a list of shippingRegions
Throws:
EpServiceException - - in case of any errors

load

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

Specified by:
load in interface ShippingRegionService
Parameters:
shippingRegionUid - the shippingRegion UID
Returns:
the shippingRegion if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

nameExists

public boolean nameExists(ShippingRegion shippingRegion)
                   throws EpServiceException
Check if a different shipping region with the given shipping region's name exists exists or not.

Specified by:
nameExists in interface ShippingRegionService
Parameters:
shippingRegion - - the shippingRegion to check
Returns:
true if a different shipping region with the same name exists
Throws:
EpServiceException - - in case of any errors

nameExists

public boolean nameExists(java.lang.String name)
                   throws EpServiceException
Check the given shipping region's name exists or not.

Specified by:
nameExists in interface ShippingRegionService
Parameters:
name - - the shipping region's name to check
Returns:
true if the given shipping region name exists
Throws:
EpServiceException - - in case of any errors

remove

public void remove(ShippingRegion shippingRegion)
            throws EpServiceException
Delete the shippingRegion.

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

setPropertyService

public void setPropertyService(PropertyService propertyService)
Set the propertyService singleton.

Specified by:
setPropertyService in interface ShippingRegionService
Parameters:
propertyService - - the propertyService singleton.

update

public void update(ShippingRegion shippingRegion)
            throws ShippingRegionExistException
Updates the given shippingRegion.

Specified by:
update in interface ShippingRegionService
Parameters:
shippingRegion - the shippingRegion to update
Throws:
ShippingRegionExistException - - If a shipping region with the same name already exists.