com.elasticpath.service.customer.impl
Class CustomerGroupServiceImpl

java.lang.Object
  extended by com.elasticpath.service.impl.AbstractEpServiceImpl
      extended by com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
          extended by com.elasticpath.service.customer.impl.CustomerGroupServiceImpl
All Implemented Interfaces:
CustomerGroupService, EpPersistenceService, EpService

public class CustomerGroupServiceImpl
extends AbstractEpPersistenceServiceImpl
implements CustomerGroupService

The default implementation of CustomerGroupService.


Constructor Summary
CustomerGroupServiceImpl()
           
 
Method Summary
 CustomerGroup add(CustomerGroup customerGroup)
          Adds the given customerGroup.
 CustomerGroup findByGroupName(java.lang.String groupName)
          Find the customer group with the given group name.
 CustomerGroup get(long customerGroupUid)
          Get the customerGroup with the given UID.
 CustomerGroup getDefaultGroup()
          Return the deafalt customerGroup, namely, the group with name "PUBLIC".
 java.lang.Object getObject(long uid)
          Generic load method for all persistable domain models.
 boolean groupExists(CustomerGroup customerGroup)
          Check if a different customer group with the given customer group's name exists exists or not.
 boolean groupExists(java.lang.String groupName)
          Check the given customer group's name exists or not.
 java.util.List list()
          List all customerGroups stored in the database.
 CustomerGroup load(long customerGroupUid)
          Load the customerGroup with the given UID.
 void remove(CustomerGroup customerGroup)
          Delete the customerGroup.
 void update(CustomerGroup customerGroup)
          Updates the given customerGroup.
 
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

CustomerGroupServiceImpl

public CustomerGroupServiceImpl()
Method Detail

add

public CustomerGroup add(CustomerGroup customerGroup)
                  throws GroupExistException
Adds the given customerGroup.

Specified by:
add in interface CustomerGroupService
Parameters:
customerGroup - the customerGroup to add
Returns:
the persisted instance of customerGroup
Throws:
GroupExistException - - if a customerGroup with the specified name already exists.

findByGroupName

public CustomerGroup findByGroupName(java.lang.String groupName)
                              throws EpServiceException
Find the customer group with the given group name.

Specified by:
findByGroupName in interface CustomerGroupService
Parameters:
groupName - - the customer group name
Returns:
the customerGroup with the given name if exists, otherwise null
Throws:
EpServiceException - - in case of any errors

get

public CustomerGroup get(long customerGroupUid)
                  throws EpServiceException
Get the customerGroup with the given UID. Return null if no matching record exists.

Specified by:
get in interface CustomerGroupService
Parameters:
customerGroupUid - the customerGroup UID
Returns:
the customerGroup if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getDefaultGroup

public CustomerGroup getDefaultGroup()
                              throws EpServiceException
Return the deafalt customerGroup, namely, the group with name "PUBLIC".

Specified by:
getDefaultGroup in interface CustomerGroupService
Returns:
the default customerGroup.
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

groupExists

public boolean groupExists(CustomerGroup customerGroup)
                    throws EpServiceException
Check if a different customer group with the given customer group's name exists exists or not.

Specified by:
groupExists in interface CustomerGroupService
Parameters:
customerGroup - - the customerGroup to check
Returns:
true if a different customer group with the same name exists
Throws:
EpServiceException - - in case of any errors

groupExists

public boolean groupExists(java.lang.String groupName)
                    throws EpServiceException
Check the given customer group's name exists or not.

Specified by:
groupExists in interface CustomerGroupService
Parameters:
groupName - the group name to check
Returns:
true if the given group name exists
Throws:
EpServiceException - - in case of any errors

list

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

Specified by:
list in interface CustomerGroupService
Returns:
a list of customerGroups
Throws:
EpServiceException - - in case of any errors

load

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

Specified by:
load in interface CustomerGroupService
Parameters:
customerGroupUid - the customerGroup UID
Returns:
the customerGroup if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

remove

public void remove(CustomerGroup customerGroup)
            throws EpServiceException
Delete the customerGroup.

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

update

public void update(CustomerGroup customerGroup)
            throws GroupExistException
Updates the given customerGroup.

Specified by:
update in interface CustomerGroupService
Parameters:
customerGroup - the customerGroup to update
Throws:
GroupExistException - - if a customerGroup with the specified name already exists.