com.elasticpath.service.customer
Interface CustomerService

All Superinterfaces:
EpPersistenceService, EpService
All Known Implementing Classes:
CustomerServiceImpl

public interface CustomerService
extends EpPersistenceService

Provide customer-related business service.


Method Summary
 Customer add(Customer customer)
          Adds the given customer.
 Customer addCustomerAddress(Customer customer, CustomerAddress address)
          Adds an address to a customer.
 Customer addCustomerCreditCard(Customer customer, CustomerCreditCard creditCard)
          Adds a credit card to a customer.
 Customer deleteCustomerAddresses(Customer customer)
          This is a workaround for deleteing address(s) since Hibernate can not cascade delete entity object in a collection if it not removed from the collection loaded in the same session.
 Customer deleteCustomerCreditCards(Customer customer)
          This is a workaround for deleteing credit card(s) since Hibernate can not cascade delete entity object in a collection if it not removed from the collection loaded in the same session.
 boolean emailExists(Customer customer)
          Check the given customer's email exists or not.
 boolean emailExists(java.lang.String email)
          Check the given email exists or not.
 java.util.List findAllUids()
          Returns all customer uids as a list.
 java.util.List findByEmail(java.lang.String email)
          Find the customer with the given email address.
 Customer findByGuid(java.lang.String guid)
          Retrieve the customer with the given guid.
 java.util.List findByUids(java.util.Collection customerUids)
          Returns a list of Customer based on the given uids.
 java.util.List findCustomerByCriteria(CustomerSearchCriteria customerSearchCriteria)
          Retrieve the list of customers, whose specified property contain the given criteria value.
 java.util.List findCustomerLike(java.lang.String propertyName, java.lang.String criteriaValue)
          Retrieve the list of customers, whose specified property contain the given criteria value.
 Customer findNonAnonymousByEmail(java.lang.String email)
          Find the non-anonymous customer with the given email address.
 java.util.List findUidsByDeletedDate(java.util.Date date)
          Retrieves list of customer uids where the deleted date is later than the specified date.
 java.util.List findUidsByModifiedDate(java.util.Date date)
          Retrieves list of Customer uids where the last modified date is later than the specified date.
 Customer get(long customerUid)
          Get the customer with the given UID.
 java.util.List list()
          List all customers stored in the database.
 Customer load(long customerUid)
          Load the customer with the given UID.
 void remove(Customer customer)
          Delete the customer.
 void resetPassword(java.lang.String email)
          Generate a new password for the customor with the given email address and send the new password to the customer by eamil.
 void setCustomerSessionService(CustomerSessionService customerSessionService)
          Set the customerSessionService instance.
 void setPassword(Customer customer, java.lang.String newPassword)
          Changes the password for the specified customer.
 Customer update(Customer customer)
          Updates the given customer.
 void validateNewCustomer(Customer customer)
          Validate the new customer has the valid email address (not used by any existing non-anonymous customer).
 
Methods inherited from interface com.elasticpath.service.EpPersistenceService
getObject, getPersistenceEngine, setPersistenceEngine
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Method Detail

add

Customer add(Customer customer)
             throws EmailExistException
Adds the given customer.

Parameters:
customer - the customer to add
Returns:
the persisted instance of customer
Throws:
EmailExistException - - if trying to add an customer using an existing email address.

addCustomerAddress

Customer addCustomerAddress(Customer customer,
                            CustomerAddress address)
Adds an address to a customer.

Parameters:
customer - The customer who is adding an address
address - The address to be added to the customer
Returns:
the updated Customer

addCustomerCreditCard

Customer addCustomerCreditCard(Customer customer,
                               CustomerCreditCard creditCard)
Adds a credit card to a customer.

Parameters:
customer - The customer who is adding a credit card
creditCard - The credit card to be added to the customer
Returns:
the updated Customer

deleteCustomerAddresses

Customer deleteCustomerAddresses(Customer customer)
This is a workaround for deleteing address(s) since Hibernate can not cascade delete entity object in a collection if it not removed from the collection loaded in the same session.

Parameters:
customer - The customer whose address list has been updated
Returns:
the updated Customer

deleteCustomerCreditCards

Customer deleteCustomerCreditCards(Customer customer)
This is a workaround for deleteing credit card(s) since Hibernate can not cascade delete entity object in a collection if it not removed from the collection loaded in the same session.

Parameters:
customer - The customer whose credit card list has been updated
Returns:
the updated Customer

emailExists

boolean emailExists(Customer customer)
                    throws EpServiceException
Check the given customer's email exists or not.

Parameters:
customer - the customer to check
Returns:
true if the given email exists
Throws:
EpServiceException - - in case of any errors

emailExists

boolean emailExists(java.lang.String email)
                    throws EpServiceException
Check the given email exists or not.

Parameters:
email - the email address
Returns:
true if the given email exists
Throws:
EpServiceException - - in case of any errors

findAllUids

java.util.List findAllUids()
Returns all customer uids as a list.

Returns:
all customer uids as a list

findByEmail

java.util.List findByEmail(java.lang.String email)
                           throws EpServiceException
Find the customer with the given email address.

Parameters:
email - the customer email address
Returns:
the customer with the given email address.
Throws:
EpServiceException - - in case of any errors

findByGuid

Customer findByGuid(java.lang.String guid)
                    throws EpServiceException
Retrieve the customer with the given guid.

Parameters:
guid - the guid of the customer
Returns:
the customer with the given guid
Throws:
EpServiceException - in case of any error

findByUids

java.util.List findByUids(java.util.Collection customerUids)
Returns a list of Customer based on the given uids. The returned customers will be populated based on the given load tuner.

Parameters:
customerUids - a collection of customer uids
Returns:
a list of Customers

findCustomerByCriteria

java.util.List findCustomerByCriteria(CustomerSearchCriteria customerSearchCriteria)
Retrieve the list of customers, whose specified property contain the given criteria value.

Parameters:
customerSearchCriteria - criteria for customer search.
Returns:
list of customers matching the given criteria.

findCustomerLike

java.util.List findCustomerLike(java.lang.String propertyName,
                                java.lang.String criteriaValue)
Retrieve the list of customers, whose specified property contain the given criteria value.

Parameters:
propertyName - customer property to search on.
criteriaValue - criteria value to be used for searching.
Returns:
list of customers matching the given criteria.

findNonAnonymousByEmail

Customer findNonAnonymousByEmail(java.lang.String email)
                                 throws EpServiceException
Find the non-anonymous customer with the given email address.

Parameters:
email - the customer email address
Returns:
the non-anonymous customer with the given email address if exists, otherwise null
Throws:
EpServiceException - - in case of any errors

findUidsByDeletedDate

java.util.List findUidsByDeletedDate(java.util.Date date)
Retrieves list of customer uids where the deleted date is later than the specified date.

Parameters:
date - date to compare with the deleted date
Returns:
list of customer uids whose deleted date is later than the specified date

findUidsByModifiedDate

java.util.List findUidsByModifiedDate(java.util.Date date)
Retrieves list of Customer uids where the last modified date is later than the specified date.

Parameters:
date - date to compare with the last modified date
Returns:
list of Customer whose last modified date is later than the specified date

get

Customer get(long customerUid)
             throws EpServiceException
Get the customer with the given UID. Return null if no matching record exists.

Parameters:
customerUid - the customer UID
Returns:
the customer if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

list

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

Returns:
a list of customers
Throws:
EpServiceException - - in case of any errors

load

Customer load(long customerUid)
              throws EpServiceException
Load the customer with the given UID. Throw an unrecoverable exception if there is no matching database row.

Parameters:
customerUid - the customer UID
Returns:
the customer if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

remove

void remove(Customer customer)
            throws EpServiceException
Delete the customer.

Parameters:
customer - the customer to remove
Throws:
EpServiceException - - in case of any errors

resetPassword

void resetPassword(java.lang.String email)
                   throws EmailNonExistException
Generate a new password for the customor with the given email address and send the new password to the customer by eamil.

Parameters:
email - the email address
Throws:
EmailNonExistException - if the given email address doesn't exist

setCustomerSessionService

void setCustomerSessionService(CustomerSessionService customerSessionService)
Set the customerSessionService instance.

Parameters:
customerSessionService - the customerSessionService instance.

setPassword

void setPassword(Customer customer,
                 java.lang.String newPassword)
Changes the password for the specified customer.

Parameters:
customer - the customer whose password is to be changed
newPassword - the new password (clear text)

update

Customer update(Customer customer)
                throws EmailExistException
Updates the given customer.

Parameters:
customer - the customer to update
Returns:
the persisted instance of customer
Throws:
EmailExistException - - if trying to add an customer using an existing email address.

validateNewCustomer

void validateNewCustomer(Customer customer)
                         throws EmailExistException
Validate the new customer has the valid email address (not used by any existing non-anonymous customer).

Parameters:
customer - the nre customer.
Throws:
EmailExistException - - if the new customer's email address already exists in system.


Copyright Elastic Path Software Inc 2006. All Rights Reserved