com.konakart.blif
Interface CustomerMgrIf

All Known Implementing Classes:
CustomerMgr

public interface CustomerMgrIf

CustomerMgrIf Interface which an implementation of this manager must adhere to.


Method Summary
 int addAddressToCustomer(java.lang.String sessionId, AddressIf addr)
          The Address object is added to the customer defined by the SessionId.
 void addProductNotificationToCustomer(java.lang.String sessionId, int productId)
          Adds a product notification to the customer referenced by the session id
 void deleteAddressFromCustomer(java.lang.String sessionId, int addressId)
          The address defined by customerId and addressId is deleted.
 void deleteProductNotificationFromCustomer(java.lang.String sessionId, int productId)
          Deletes a product notification from the customer referenced by the session id
 boolean doesCustomerExistForEmail(java.lang.String emailAddr)
          Checks to see whether a customer already exists with this email address.
 void editCustomer(java.lang.String sessionId, CustomerIf cust)
          Updates the customer data with the data in the Customer object passed in as a parameter.
 void editCustomerAddress(java.lang.String sessionId, AddressIf addr)
          The Address object will replace the existing address object in the database with the same id.
 void enableCustomer(int customerId)
          Enables the customer identified by the customer id.
 int forceRegisterCustomer(CustomerRegistrationIf custReg)
          A new customer is added to the system.
 Address getAddress(int addressId)
          Returns the address object for the given address id.
 Address[] getAddressesPerCustomer(java.lang.String sessionId)
          Returns all of the addresses registered for the given customer.
 java.lang.String getAddressFormatTemplate(int id)
          Does a query on the address_format table
 CustomerGroup[] getAllCustomerGroups(int languageId)
          Returns an array of customer groups for all customer groups that have been defined in the system.
 Address getCountryAndZonePerCustomer(Customer cust)
          Returns the default address for the given customer.
 Address getCountryAndZonePerCustomer(int customerId)
          Returns the default address for the given customer.
 Address getCountryAndZonePerCustomer(java.lang.String sessionId)
          Returns the default address for the given customer.
 Customer getCustomer(java.lang.String sessionId)
          Returns the customer object for the customer defined by the given sessionId.
 Customer getCustomerForEmail(java.lang.String emailAddr)
          Checks to see whether a customer already exists with this email address.
 Customer getCustomerForId(int customerId)
          Returns the customer object for the customer defined by the given id.
 CustomerGroup getCustomerGroup(int customerGroupId, int languageId)
          Returns a customer group object for the customerGroupId passed in as a parameter.
 CustomerGroup getCustomerGroupFromCache(int customerGroupId)
          Gets the CustomerGroup object for the customerGroupId and default language from the cache.
 Address getDefaultAddressPerCustomer(Customer cust)
          Returns the default address for the given customer.
 Address getDefaultAddressPerCustomer(java.lang.String sessionId)
          Returns the default address for the given customer.
 Customer getDefaultCustomer()
          Returns the customer object for the default customer.
 java.lang.String getNameFromId(int custId)
           
 Product[] getProductNotificationsPerCustomer(java.lang.String sessionId, int languageId)
          Returns an array of products for which the customer referenced by sessionId will be notified on.
 Product[] getProductNotificationsPerCustomerWithOptions(java.lang.String sessionId, int languageId, FetchProductOptionsIf options)
          Returns an array of products for which the customer referenced by sessionId will be notified on.
 int getTempCustomerId()
          Returns an available unique temporary id.
 void incrementLogonCount(int customerId)
          This method is not exposed to the web interface because it isn't secure.
 void refreshConfigs()
          Refresh the configuration of the Customer manager
 int registerCustomer(CustomerRegistrationIf custReg)
          A new customer is added to the system.
 int registerCustomerPrivate(CustomerRegistrationIf custReg, boolean force)
          A new customer is added to the system.
 KKCriteria setAllAddrAttrs(KKCriteria c)
          Used by other managers to avoid repeating code.
 void setCustomerPassword(int customerId, java.lang.String password)
          Sets the customer password.
 void setCustomerType(int customerId, int type)
          Sets the customer type.
 void setDefaultAddressPerCustomer(java.lang.String sessionId, int addressId)
          Sets the default address for this customer to be the addressId passed in as a parameter.
 

Method Detail

forceRegisterCustomer

int forceRegisterCustomer(CustomerRegistrationIf custReg)
                          throws java.lang.Exception
A new customer is added to the system. The process for adding a new customer is to :
  1. Insert information in the Customers table where a new primary key is generated
  2. Insert address information in the address_book table
  3. Update the customer record with the address id
  4. Insert a customers_info record with the same PK as the customer
If the customer already exists, we modify the registration rather than throwing an exception.

Parameters:
custReg -
Returns:
Customer Id
Throws:
java.lang.Exception

registerCustomer

int registerCustomer(CustomerRegistrationIf custReg)
                     throws java.lang.Exception
A new customer is added to the system. The process for adding a new customer is to :
  1. Insert information in the Customers table where a new primary key is generated
  2. Insert address information in the address_book table
  3. Update the customer record with the address id
  4. Insert a customers_info record with the same PK as the customer
All of the above actions are performed as a transaction. In the case of MySQL, the transaction doesn't work unless the tables are defined as using the InnoDB or BDB engines. A table can be transformed using the following syntax : Alter table t Engine = InnoDB;. The standard engine seems to be MyIsam which doesn't support transactions.

Parameters:
custReg -
Returns:
int : Customer Id
Throws:
java.lang.Exception

registerCustomerPrivate

int registerCustomerPrivate(CustomerRegistrationIf custReg,
                            boolean force)
                            throws java.lang.Exception
A new customer is added to the system. The process for adding a new customer is to :
  1. Insert information in the Customers table where a new primary key is generated
  2. Insert address information in the address_book table
  3. Update the customer record with the address id
  4. Insert a customers_info record with the same PK as the customer
All of the above actions are performed as a transaction. In the case of MySQL, the transaction doesn't work unless the tables are defined as using the InnoDB or BDB engines. A table can be transformed using the following syntax : Alter table t Engine = InnoDB;. The standard engine seems to be MyIsam which doesn't support transactions.

Parameters:
custReg -
force - If set, then we modify the registration rather than throwing an exception if the customer already exists
Returns:
int : Customer Id
Throws:
java.lang.Exception

editCustomer

void editCustomer(java.lang.String sessionId,
                  CustomerIf cust)
                  throws java.lang.Exception
Updates the customer data with the data in the Customer object passed in as a parameter. We also update the default address of the customer if it originally existed.

Parameters:
sessionId -
cust -
Throws:
java.lang.Exception

setCustomerPassword

void setCustomerPassword(int customerId,
                         java.lang.String password)
                         throws java.lang.Exception
Sets the customer password.

Parameters:
customerId -
password -
Throws:
java.lang.Exception

setCustomerType

void setCustomerType(int customerId,
                     int type)
                     throws java.lang.Exception
Sets the customer type.

Parameters:
customerId -
type -
Throws:
java.lang.Exception

incrementLogonCount

void incrementLogonCount(int customerId)
                         throws org.apache.torque.TorqueException,
                                KKException,
                                com.workingdogs.village.DataSetException
This method is not exposed to the web interface because it isn't secure. It increments the logon count attribute of the customers_info table.

Parameters:
customerId -
Throws:
org.apache.torque.TorqueException
KKException
com.workingdogs.village.DataSetException

doesCustomerExistForEmail

boolean doesCustomerExistForEmail(java.lang.String emailAddr)
                                  throws org.apache.torque.TorqueException,
                                         KKException,
                                         com.workingdogs.village.DataSetException
Checks to see whether a customer already exists with this email address. If a customer does exist, but it is a non registered customer then we act as if no customer exists.

Parameters:
emailAddr -
Returns:
Returns true if the customer already exists
Throws:
org.apache.torque.TorqueException
KKException
com.workingdogs.village.DataSetException

getCustomerForEmail

Customer getCustomerForEmail(java.lang.String emailAddr)
                             throws java.lang.Exception
Checks to see whether a customer already exists with this email address.

Parameters:
emailAddr -
Returns:
Returns a Customer object if the customer already exists
Throws:
java.lang.Exception

getNameFromId

java.lang.String getNameFromId(int custId)
                               throws org.apache.torque.TorqueException,
                                      com.workingdogs.village.DataSetException,
                                      KKException
Parameters:
custId -
Returns:
Returns the customer's name
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getCustomer

Customer getCustomer(java.lang.String sessionId)
                     throws java.lang.Exception
Returns the customer object for the customer defined by the given sessionId. Throws an exception if the session has expired.

Parameters:
sessionId -
Returns:
Customer Object or Null if the customer doesn't exist.
Throws:
java.lang.Exception

getCustomerForId

Customer getCustomerForId(int customerId)
                          throws java.lang.Exception
Returns the customer object for the customer defined by the given id.

Parameters:
customerId -
Returns:
Customer Object or Null if the customer doesn't exist.
Throws:
java.lang.Exception

getDefaultCustomer

Customer getDefaultCustomer()
                            throws java.lang.Exception
Returns the customer object for the default customer. If more than one default customer exists, it returns one of the customers found. The default customer can be configured in the Admin App. It is a fictitious customer with a real address that is used to create a temporary order even when a customer is not logged in or hasn't registered yet. The order totals of this temporary order are displayed in the cart details screen to give an indication of shipping costs and to display any available discounts.

Returns:
Customer Object or Null if the default customer doesn't exist.
Throws:
java.lang.Exception

getAddressesPerCustomer

Address[] getAddressesPerCustomer(java.lang.String sessionId)
                                  throws java.lang.Exception
Returns all of the addresses registered for the given customer. An exception is thrown if the sessionid isn't valid.

Parameters:
sessionId -
Returns:
An array of address objects where the first one is the primary address. Returns an empty array if no addresses exist.
Throws:
java.lang.Exception

getDefaultAddressPerCustomer

Address getDefaultAddressPerCustomer(java.lang.String sessionId)
                                     throws java.lang.Exception
Returns the default address for the given customer. An exception is thrown if the sessionid isn't valid.

Parameters:
sessionId -
Returns:
An address object
Throws:
java.lang.Exception

getDefaultAddressPerCustomer

Address getDefaultAddressPerCustomer(Customer cust)
                                     throws java.lang.Exception
Returns the default address for the given customer. An exception is thrown if the cust is null.

Parameters:
cust -
Returns:
An address object
Throws:
java.lang.Exception

getCountryAndZonePerCustomer

Address getCountryAndZonePerCustomer(java.lang.String sessionId)
                                     throws java.lang.Exception
Returns the default address for the given customer. An exception is thrown if the sessionid isn't valid. The default address is only populated with countryId and zoneId.

Parameters:
sessionId -
Returns:
An address object
Throws:
java.lang.Exception

getCountryAndZonePerCustomer

Address getCountryAndZonePerCustomer(int customerId)
                                     throws java.lang.Exception
Returns the default address for the given customer. The default address is only populated with countryId and zoneId.

Parameters:
customerId -
Returns:
An address object
Throws:
java.lang.Exception

getCountryAndZonePerCustomer

Address getCountryAndZonePerCustomer(Customer cust)
                                     throws java.lang.Exception
Returns the default address for the given customer. The default address is only populated with countryId and zoneId.

Parameters:
cust -
Returns:
An address object
Throws:
java.lang.Exception

setDefaultAddressPerCustomer

void setDefaultAddressPerCustomer(java.lang.String sessionId,
                                  int addressId)
                                  throws java.lang.Exception
Sets the default address for this customer to be the addressId passed in as a parameter. First we check that an address exists with that id and that it belongs to the customer logged in with the session id.

Parameters:
sessionId -
addressId -
Throws:
java.lang.Exception

addAddressToCustomer

int addAddressToCustomer(java.lang.String sessionId,
                         AddressIf addr)
                         throws java.lang.Exception
The Address object is added to the customer defined by the SessionId. The id of the address object is ignored since it is calculated during the insertion process. The zoneId is also calculated unless addr.isUseZoneId()is set to true. In this case the zoneId from the address object is used. The customerId of the address object is also ignored. An exception is thrown if the sessionId isn't valid.

Parameters:
sessionId -
addr -
Returns:
Id of the new address object
Throws:
java.lang.Exception

deleteAddressFromCustomer

void deleteAddressFromCustomer(java.lang.String sessionId,
                               int addressId)
                               throws java.lang.Exception
The address defined by customerId and addressId is deleted. The customerId is retrieved from the session. An exception is thrown if the session isn't valid or we are trying to delete the default address.

Parameters:
sessionId -
addressId -
Throws:
java.lang.Exception

editCustomerAddress

void editCustomerAddress(java.lang.String sessionId,
                         AddressIf addr)
                         throws java.lang.Exception
The Address object will replace the existing address object in the database with the same id. A check is made to verify that the address object belongs to the customer logged in with the sessionId passed in as a parameter. The zoneId is ignored since it is calculated during the insertion process, unless addr.isUseZoneId()is set to true. In this case the zoneId from the address object is used. The addressId is used to identify the address object. The customerId of the address object is ignored since it is obtained from the sessionId. An exception is thrown if the session isn't valid.

Parameters:
sessionId -
addr -
Throws:
java.lang.Exception

getAddressFormatTemplate

java.lang.String getAddressFormatTemplate(int id)
                                          throws org.apache.torque.TorqueException,
                                                 com.workingdogs.village.DataSetException,
                                                 KKException
Does a query on the address_format table

Parameters:
id -
Returns:
Returns the template referenced by the id parameter
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

addProductNotificationToCustomer

void addProductNotificationToCustomer(java.lang.String sessionId,
                                      int productId)
                                      throws java.lang.Exception
Adds a product notification to the customer referenced by the session id

Parameters:
sessionId -
productId -
Throws:
java.lang.Exception

deleteProductNotificationFromCustomer

void deleteProductNotificationFromCustomer(java.lang.String sessionId,
                                           int productId)
                                           throws java.lang.Exception
Deletes a product notification from the customer referenced by the session id

Parameters:
sessionId -
productId -
Throws:
java.lang.Exception

getProductNotificationsPerCustomer

Product[] getProductNotificationsPerCustomer(java.lang.String sessionId,
                                             int languageId)
                                             throws java.lang.Exception
Returns an array of products for which the customer referenced by sessionId will be notified on.

Parameters:
sessionId -
languageId -
Returns:
Array of products
Throws:
java.lang.Exception

getProductNotificationsPerCustomerWithOptions

Product[] getProductNotificationsPerCustomerWithOptions(java.lang.String sessionId,
                                                        int languageId,
                                                        FetchProductOptionsIf options)
                                                        throws java.lang.Exception
Returns an array of products for which the customer referenced by sessionId will be notified on. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Parameters:
sessionId -
languageId -
options -
Returns:
Array of products
Throws:
java.lang.Exception

getTempCustomerId

int getTempCustomerId()
                      throws org.apache.torque.TorqueException,
                             KKException
Returns an available unique temporary id.

Returns:
The latest temporaryId
Throws:
org.apache.torque.TorqueException
KKException

getAllCustomerGroups

CustomerGroup[] getAllCustomerGroups(int languageId)
                                     throws java.lang.Exception
Returns an array of customer groups for all customer groups that have been defined in the system. The groups returned are those for the language defined by languageId.

Parameters:
languageId - The id for the language that will be used to determine the customer group name and description. Value of -1 selects the default language.
Returns:
An array of customer group objects.
Throws:
java.lang.Exception

getCustomerGroup

CustomerGroup getCustomerGroup(int customerGroupId,
                               int languageId)
                               throws java.lang.Exception
Returns a customer group object for the customerGroupId passed in as a parameter.

Parameters:
customerGroupId -
languageId - The id for the language that will be used to determine the customer group name and description. Value of -1 selects the default language.
Returns:
A customer group object.
Throws:
java.lang.Exception

getCustomerGroupFromCache

CustomerGroup getCustomerGroupFromCache(int customerGroupId)
                                        throws java.lang.Exception
Gets the CustomerGroup object for the customerGroupId and default language from the cache.

Parameters:
customerGroupId -
Returns:
Returns a CustomerGroup object
Throws:
java.lang.Exception

refreshConfigs

void refreshConfigs()
                    throws KKException
Refresh the configuration of the Customer manager

Throws:
KKException

getAddress

Address getAddress(int addressId)
                   throws java.lang.Exception
Returns the address object for the given address id. Returns null if it doesn't exist.

Parameters:
addressId -
Returns:
An address object or null if it doesn't exist.
Throws:
java.lang.Exception

setAllAddrAttrs

KKCriteria setAllAddrAttrs(KKCriteria c)
Used by other managers to avoid repeating code. It returns the criteria object with all address attributes set.

Parameters:
c -
Returns:
Returns the criteria object with all address attributes set

enableCustomer

void enableCustomer(int customerId)
                    throws KKException,
                           org.apache.torque.TorqueException
Enables the customer identified by the customer id. If the customer doesn't exist then an exception is thrown.

Parameters:
customerId -
Throws:
org.apache.torque.TorqueException
KKException


Copyright © 2011 DS Data Systems UK Ltd.