com.softslate.commerce.businessobjects.customer
Class BasicCustomerProcessor

java.lang.Object
  extended bycom.softslate.commerce.businessobjects.core.BaseBusinessObject
      extended bycom.softslate.commerce.businessobjects.core.BaseBusinessProcessor
          extended bycom.softslate.commerce.businessobjects.customer.BasicCustomerProcessor
All Implemented Interfaces:
BusinessObject, BusinessProcessor, CustomerProcessor

public class BasicCustomerProcessor
extends BaseBusinessProcessor
implements CustomerProcessor

Processes business logic having to do with a customer's account and related objects. Created in the Struts layer in response to requests for information about an exisiting customer account, or to create new accounts.

BasicCustomerProcessor is the default implementation of the CustomerProcessor interface for the application.

Version:
$Id: BasicCustomerProcessor.java,v 1.1 2004/07/11 19:57:11 dtobey Exp $
Author:
David Tobey
See Also:
CustomerProcessor

Field Summary
private  Customer customer
           
(package private) static org.apache.commons.logging.Log log
           
 
Fields inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
 
Constructor Summary
BasicCustomerProcessor()
           
 
Method Summary
 void addCustomer(java.util.Map parameters)
           
 void deleteCustomer(java.util.Map parameters)
           
 void editCustomer(java.util.Map parameters)
           
 void editDeleteCustomers(java.util.Map parameters)
           
 Customer getCustomer()
          Retrieves the Customer object currently being processed.
 java.util.Collection loadActiveCustomers()
           
 java.util.Map loadCustomerFromID(java.util.Map parameters)
           
 void loadCustomerLostPassword(java.util.Map parameters)
          Loads the Customer property of this CustomerProcesor from the database given a Map containing the userName.
 java.util.Map loadCustomersAndCount(java.util.Map parameters)
           
 Order loadOrderDetails(java.util.Map parameters)
          Loads all of the database information corresponding to a given order number for a given customer.
 java.util.Map loadOrderHistory()
          Loads a customer's order history from the database.
 java.util.Map processLogin(java.util.Map parameters)
          Processes a login attempt given a user name and password.
 java.util.Map processRegister(java.util.Map parameters)
          Processes a request to register or add a new customer account into the system.
 void setCustomer(Customer customer)
          Sets the Customer object to be processed by this CustomerProcessor.
 java.util.Map updateAddresses(java.util.Map parameters)
          Updates a customer's address information.
 java.util.Map updateCustomer(java.util.Map parameters)
          Updates a customer's account information.
 
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
formatPrice, getBusinessObjectFactory, getDaoFactory, getSettingsBean, getUser, initialize, setBusinessObjectFactory, setDaoFactory, setSettingsBean, setUser
 
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessObject
formatDateTime, parseDateTime, prepareRequestData, sendHTTPPost
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject
initialize
 

Field Detail

log

static org.apache.commons.logging.Log log

customer

private Customer customer
Constructor Detail

BasicCustomerProcessor

public BasicCustomerProcessor()
Method Detail

getCustomer

public Customer getCustomer()
Description copied from interface: CustomerProcessor
Retrieves the Customer object currently being processed. Client code often sets this Customer property before calling processing methods, and retrieves it afterwards.

Specified by:
getCustomer in interface CustomerProcessor
Returns:
The Customer object currently being processed.

setCustomer

public void setCustomer(Customer customer)
Description copied from interface: CustomerProcessor
Sets the Customer object to be processed by this CustomerProcessor. Client code often sets this Customer property before calling processing methods, and retrieves it afterwards.

Specified by:
setCustomer in interface CustomerProcessor

processRegister

public java.util.Map processRegister(java.util.Map parameters)
                              throws java.lang.Exception
Description copied from interface: CustomerProcessor
Processes a request to register or add a new customer account into the system. The incoming Map should have at least two keys: userName and password, which will be used for the new account. If successful, the Customer property of the current User will be populated with the new account's information. If an account already exists with the same userName, an exception whose message is "userName not unique" is thrown.

Specified by:
processRegister in interface CustomerProcessor
Parameters:
parameters - A Map containing the user name and password for the new customer account.
Throws:
java.lang.Exception

processLogin

public java.util.Map processLogin(java.util.Map parameters)
                           throws java.lang.Exception
Description copied from interface: CustomerProcessor
Processes a login attempt given a user name and password. The incoming Map must have two keys: userName and password. If the login attempt succeeds, the Customer property of the current User will be populated with the database information for the customer account. If the user name and password don't match an account in the database, an exception is thrown whose message is "invalid login".

Specified by:
processLogin in interface CustomerProcessor
Parameters:
parameters - A Map containing the user name and password for the customer attempting to log in.
Throws:
java.lang.Exception

updateAddresses

public java.util.Map updateAddresses(java.util.Map parameters)
                              throws java.lang.Exception
Description copied from interface: CustomerProcessor
Updates a customer's address information. The incoming Map should contain keys corresponding to the delivery address properties of CustomerAddress, and the billing address properties of Customer. The Customer property of the current user, and the first CustomerAddress in the customerAddressCollection of the Customer are modified with the incoming address information. Then the database records for the customer and the customer address are updated in npcCustomer and npcCustomerAddress.

Specified by:
updateAddresses in interface CustomerProcessor
Parameters:
parameters - A Map containing the address information for the current user, which is to be used to update the account.
Throws:
java.lang.Exception

updateCustomer

public java.util.Map updateCustomer(java.util.Map parameters)
                             throws java.lang.Exception
Description copied from interface: CustomerProcessor
Updates a customer's account information. The incoming Map should contain keys corresponding to the properties of Customer. The Customer property of the current user is modified with the account information contained in the incoming Map. Then the database record for the customer is updated. Used to process a changed password.

Specified by:
updateCustomer in interface CustomerProcessor
Parameters:
parameters - A Map containing the account information for the current user, which is to be used to update the account.
Throws:
java.lang.Exception

loadCustomerLostPassword

public void loadCustomerLostPassword(java.util.Map parameters)
                              throws java.lang.Exception
Description copied from interface: CustomerProcessor
Loads the Customer property of this CustomerProcesor from the database given a Map containing the userName. Used in the lost password form, when a customer must be retireved from database without a password.

If the customer corresponding to the user name in the Map does not exist in the database, an exception is thrown whose message is "userName not found".

Specified by:
loadCustomerLostPassword in interface CustomerProcessor
Parameters:
parameters - A Map containing the user name of a given customer.
Throws:
java.lang.Exception

loadOrderHistory

public java.util.Map loadOrderHistory()
                               throws java.lang.Exception
Description copied from interface: CustomerProcessor
Loads a customer's order history from the database. If successful, the Customer property of the current User will have its orderHistory property populated with information from the database about all of the customer's previous orders in the store.

Specified by:
loadOrderHistory in interface CustomerProcessor
Throws:
java.lang.Exception

loadOrderDetails

public Order loadOrderDetails(java.util.Map parameters)
                       throws java.lang.Exception
Description copied from interface: CustomerProcessor
Loads all of the database information corresponding to a given order number for a given customer. Populates the orderDeliveryCollection property for the Order and the orderItemCollection properties for each OrderDelivery. Used to retireve the order details for a customer viewing his or her order history.

Specified by:
loadOrderDetails in interface CustomerProcessor
Parameters:
parameters - A Map containing a key named orderNumber with the order number of a given order.
Returns:
An Order populated with information from the database.
Throws:
java.lang.Exception

loadActiveCustomers

public java.util.Collection loadActiveCustomers()
                                         throws java.lang.Exception
Specified by:
loadActiveCustomers in interface CustomerProcessor
Throws:
java.lang.Exception

loadCustomersAndCount

public java.util.Map loadCustomersAndCount(java.util.Map parameters)
                                    throws java.lang.Exception
Specified by:
loadCustomersAndCount in interface CustomerProcessor
Throws:
java.lang.Exception

addCustomer

public void addCustomer(java.util.Map parameters)
                 throws java.lang.Exception
Specified by:
addCustomer in interface CustomerProcessor
Throws:
java.lang.Exception

loadCustomerFromID

public java.util.Map loadCustomerFromID(java.util.Map parameters)
                                 throws java.lang.Exception
Specified by:
loadCustomerFromID in interface CustomerProcessor
Throws:
java.lang.Exception

editCustomer

public void editCustomer(java.util.Map parameters)
                  throws java.lang.Exception
Specified by:
editCustomer in interface CustomerProcessor
Throws:
java.lang.Exception

editDeleteCustomers

public void editDeleteCustomers(java.util.Map parameters)
                         throws java.lang.Exception
Specified by:
editDeleteCustomers in interface CustomerProcessor
Throws:
java.lang.Exception

deleteCustomer

public void deleteCustomer(java.util.Map parameters)
                    throws java.lang.Exception
Specified by:
deleteCustomer in interface CustomerProcessor
Throws:
java.lang.Exception


Copyright © SoftSlate, Inc. 2003–2005