|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.konakart.bl.BaseMgr
com.konakart.bl.CustomerMgr
public class CustomerMgr
Customer Manager
Nested Class Summary | |
---|---|
protected class |
CustomerMgr.StaticData
Used to store the static data of this manager |
Field Summary | |
---|---|
static int |
CUST_TYPE_ADMIN_USER
An Admin user |
static int |
CUST_TYPE_DEFAULT_CUST
Default customer |
static int |
CUST_TYPE_NON_REGISTERED_CUST
A customer that hasn't registered |
static int |
CUST_TYPE_REGISTERED_CUST
A customer that has registered normally |
protected static boolean |
DEFAULT_DELETE_REVIEWS
|
protected static org.apache.commons.logging.Log |
log
the log |
protected static java.lang.String |
mutex
|
protected static java.util.Map<java.lang.String,CustomerMgr.StaticData> |
staticDataHM
Hash Map that contains the static data |
Fields inherited from class com.konakart.bl.BaseMgr |
---|
templateBaseDir |
Constructor Summary | |
---|---|
CustomerMgr(KKEngIf eng)
Constructor |
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. |
protected void |
deleteCustomer(int custId)
Deletes a customer from the database. |
protected void |
deleteCustomerReviews(int custId,
java.sql.Connection con)
Deletes a customer's reviews from the database. |
void |
deleteProductNotificationFromCustomer(java.lang.String sessionId,
int productId)
Deletes a product notification from the customer referenced by the session id |
protected boolean |
deleteReviews()
Utility method to return the konakart.delete_reviews property value |
protected boolean |
doesCountryExist(int countryId)
|
boolean |
doesCustomerExistForEmail(java.lang.String emailAddr)
Checks to see whether a customer already exists with this email address. |
protected boolean |
doesCustomerExistForId(int custId)
Checks to see whether a customer already exists with this id |
protected boolean |
doesZoneExist(java.lang.String zoneDesc,
int countryId)
If a country has at least one zone defined in the database, then we assume that all zones are defined and ensure that we only allow zones that are defined in the database. |
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. |
protected Address[] |
getAddressesPerCustomer(Customer customer)
Returns all of the addresses registered for the given customer. |
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. |
protected Customer[] |
getCustomers(CustomerSearch custSearch)
Retrieves an array of customers from the database that match the specified criteria in the CustomerSearch input object. |
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. |
protected void |
populateCustomerGroupHashMap(CustomerMgr.StaticData sd)
If the hash map is set to null or the refreshCustGroupMapFlag is set, then we populated the hash map with the customer groups in the default language. |
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. |
protected void |
updateCustomerReviews(int custId,
java.sql.Connection con)
Updates a customer's reviews by setting the custId to null. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.apache.commons.logging.Log log
public static final int CUST_TYPE_REGISTERED_CUST
public static final int CUST_TYPE_ADMIN_USER
public static final int CUST_TYPE_NON_REGISTERED_CUST
public static final int CUST_TYPE_DEFAULT_CUST
protected static final boolean DEFAULT_DELETE_REVIEWS
protected static java.util.Map<java.lang.String,CustomerMgr.StaticData> staticDataHM
protected static java.lang.String mutex
Constructor Detail |
---|
public CustomerMgr(KKEngIf eng) throws java.lang.Exception
eng
-
java.lang.Exception
Method Detail |
---|
protected boolean deleteReviews()
public int forceRegisterCustomer(CustomerRegistrationIf custReg) throws java.lang.Exception
forceRegisterCustomer
in interface CustomerMgrIf
custReg
-
java.lang.Exception
public int registerCustomer(CustomerRegistrationIf custReg) throws java.lang.Exception
Alter table t Engine = InnoDB;
. The standard engine seems to be MyIsam which
doesn't support transactions.
registerCustomer
in interface CustomerMgrIf
custReg
-
java.lang.Exception
public int registerCustomerPrivate(CustomerRegistrationIf custReg, boolean force) throws java.lang.Exception
Alter table t Engine = InnoDB;
. The standard engine seems to be MyIsam which
doesn't support transactions.
registerCustomerPrivate
in interface CustomerMgrIf
custReg
- force
- If set, then we modify the registration rather than throwing an exception if the
customer already exists
java.lang.Exception
public void editCustomer(java.lang.String sessionId, CustomerIf cust) throws java.lang.Exception
editCustomer
in interface CustomerMgrIf
sessionId
- cust
-
java.lang.Exception
public void setCustomerPassword(int customerId, java.lang.String password) throws java.lang.Exception
setCustomerPassword
in interface CustomerMgrIf
customerId
- password
-
java.lang.Exception
public void setCustomerType(int customerId, int type) throws java.lang.Exception
setCustomerType
in interface CustomerMgrIf
customerId
- type
-
java.lang.Exception
public void incrementLogonCount(int customerId) throws org.apache.torque.TorqueException, KKException, com.workingdogs.village.DataSetException
incrementLogonCount
in interface CustomerMgrIf
customerId
-
org.apache.torque.TorqueException
KKException
com.workingdogs.village.DataSetException
protected Customer[] getCustomers(CustomerSearch custSearch) throws java.lang.Exception
custSearch
- CustomerSearch object
java.lang.Exception
protected void deleteCustomer(int custId) throws java.lang.Exception
Removes records from :
Parameters :
custId
-
java.lang.Exception
protected void deleteCustomerReviews(int custId, java.sql.Connection con) throws java.lang.Exception
Removes records from :
Parameters :
custId
- con
-
java.lang.Exception
protected void updateCustomerReviews(int custId, java.sql.Connection con) throws java.lang.Exception
Updates records from :
Parameters :
custId
- con
-
java.lang.Exception
public boolean doesCustomerExistForEmail(java.lang.String emailAddr) throws org.apache.torque.TorqueException, KKException, com.workingdogs.village.DataSetException
doesCustomerExistForEmail
in interface CustomerMgrIf
emailAddr
-
org.apache.torque.TorqueException
KKException
com.workingdogs.village.DataSetException
public Customer getCustomerForEmail(java.lang.String emailAddr) throws java.lang.Exception
getCustomerForEmail
in interface CustomerMgrIf
emailAddr
-
java.lang.Exception
protected boolean doesCustomerExistForId(int custId) throws org.apache.torque.TorqueException, KKException
custId
-
org.apache.torque.TorqueException
KKException
public java.lang.String getNameFromId(int custId) throws org.apache.torque.TorqueException, com.workingdogs.village.DataSetException, KKException
getNameFromId
in interface CustomerMgrIf
custId
-
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException
public Customer getCustomer(java.lang.String sessionId) throws java.lang.Exception
getCustomer
in interface CustomerMgrIf
sessionId
-
java.lang.Exception
public Customer getCustomerForId(int customerId) throws java.lang.Exception
getCustomerForId
in interface CustomerMgrIf
customerId
-
java.lang.Exception
public Customer getDefaultCustomer() throws java.lang.Exception
getDefaultCustomer
in interface CustomerMgrIf
java.lang.Exception
protected boolean doesCountryExist(int countryId) throws org.apache.torque.TorqueException, KKException
countryId
-
org.apache.torque.TorqueException
KKException
public Address[] getAddressesPerCustomer(java.lang.String sessionId) throws java.lang.Exception
getAddressesPerCustomer
in interface CustomerMgrIf
sessionId
-
java.lang.Exception
public Address getDefaultAddressPerCustomer(java.lang.String sessionId) throws java.lang.Exception
getDefaultAddressPerCustomer
in interface CustomerMgrIf
sessionId
-
java.lang.Exception
public Address getDefaultAddressPerCustomer(Customer cust) throws java.lang.Exception
getDefaultAddressPerCustomer
in interface CustomerMgrIf
cust
-
java.lang.Exception
public Address getCountryAndZonePerCustomer(java.lang.String sessionId) throws java.lang.Exception
getCountryAndZonePerCustomer
in interface CustomerMgrIf
sessionId
-
java.lang.Exception
public Address getCountryAndZonePerCustomer(int customerId) throws java.lang.Exception
getCountryAndZonePerCustomer
in interface CustomerMgrIf
customerId
-
java.lang.Exception
public Address getCountryAndZonePerCustomer(Customer cust) throws java.lang.Exception
getCountryAndZonePerCustomer
in interface CustomerMgrIf
cust
-
java.lang.Exception
public void setDefaultAddressPerCustomer(java.lang.String sessionId, int addressId) throws java.lang.Exception
setDefaultAddressPerCustomer
in interface CustomerMgrIf
sessionId
- addressId
-
java.lang.Exception
protected Address[] getAddressesPerCustomer(Customer customer) throws java.lang.Exception
customer
-
java.lang.Exception
public Address getAddress(int addressId) throws java.lang.Exception
getAddress
in interface CustomerMgrIf
addressId
-
java.lang.Exception
public int addAddressToCustomer(java.lang.String sessionId, AddressIf addr) throws java.lang.Exception
addAddressToCustomer
in interface CustomerMgrIf
sessionId
- addr
-
java.lang.Exception
public void deleteAddressFromCustomer(java.lang.String sessionId, int addressId) throws java.lang.Exception
deleteAddressFromCustomer
in interface CustomerMgrIf
sessionId
- addressId
-
java.lang.Exception
public void editCustomerAddress(java.lang.String sessionId, AddressIf addr) throws java.lang.Exception
editCustomerAddress
in interface CustomerMgrIf
sessionId
- addr
-
java.lang.Exception
public KKCriteria setAllAddrAttrs(KKCriteria c)
CustomerMgrIf
setAllAddrAttrs
in interface CustomerMgrIf
c
-
public java.lang.String getAddressFormatTemplate(int id) throws org.apache.torque.TorqueException, com.workingdogs.village.DataSetException, KKException
getAddressFormatTemplate
in interface CustomerMgrIf
id
-
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException
public void addProductNotificationToCustomer(java.lang.String sessionId, int productId) throws java.lang.Exception
CustomerMgrIf
addProductNotificationToCustomer
in interface CustomerMgrIf
sessionId
- productId
-
java.lang.Exception
public void deleteProductNotificationFromCustomer(java.lang.String sessionId, int productId) throws java.lang.Exception
CustomerMgrIf
deleteProductNotificationFromCustomer
in interface CustomerMgrIf
sessionId
- productId
-
java.lang.Exception
public Product[] getProductNotificationsPerCustomer(java.lang.String sessionId, int languageId) throws java.lang.Exception
CustomerMgrIf
getProductNotificationsPerCustomer
in interface CustomerMgrIf
sessionId
- languageId
-
java.lang.Exception
public Product[] getProductNotificationsPerCustomerWithOptions(java.lang.String sessionId, int languageId, FetchProductOptionsIf options) throws java.lang.Exception
CustomerMgrIf
getProductNotificationsPerCustomerWithOptions
in interface CustomerMgrIf
sessionId
- languageId
- options
-
java.lang.Exception
protected boolean doesZoneExist(java.lang.String zoneDesc, int countryId) throws java.lang.Exception
zoneDesc
- countryId
-
java.lang.Exception
public int getTempCustomerId() throws org.apache.torque.TorqueException, KKException
CustomerMgrIf
getTempCustomerId
in interface CustomerMgrIf
org.apache.torque.TorqueException
KKException
public CustomerGroup[] getAllCustomerGroups(int languageId) throws java.lang.Exception
getAllCustomerGroups
in interface CustomerMgrIf
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.
java.lang.Exception
public CustomerGroup getCustomerGroup(int customerGroupId, int languageId) throws java.lang.Exception
getCustomerGroup
in interface CustomerMgrIf
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.
java.lang.Exception
public CustomerGroup getCustomerGroupFromCache(int customerGroupId) throws java.lang.Exception
getCustomerGroupFromCache
in interface CustomerMgrIf
customerGroupId
-
java.lang.Exception
protected void populateCustomerGroupHashMap(CustomerMgr.StaticData sd) throws java.lang.Exception
java.lang.Exception
public void refreshConfigs() throws KKException
refreshConfigs
in interface CustomerMgrIf
KKException
public void enableCustomer(int customerId) throws KKException, org.apache.torque.TorqueException
enableCustomer
in interface CustomerMgrIf
customerId
-
org.apache.torque.TorqueException
KKException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |