com.konakartadmin.bl
Class AdminCustomerBatchMgr

java.lang.Object
  extended by com.konakartadmin.bl.AdminBaseMgr
      extended by com.konakartadmin.bl.AdminBatchBaseMgr
          extended by com.konakartadmin.bl.AdminCustomerBatchMgr

public class AdminCustomerBatchMgr
extends AdminBatchBaseMgr

The CustomerBatchMgr


Nested Class Summary
protected  class AdminCustomerBatchMgr.CustRetList
          A return object containing a list of Customers and the last customer Id processed
 
Nested classes/interfaces inherited from class com.konakartadmin.bl.AdminBaseMgr
AdminBaseMgr.StaticData
 
Field Summary
 
Fields inherited from class com.konakartadmin.bl.AdminBatchBaseMgr
log
 
Fields inherited from class com.konakartadmin.bl.AdminBaseMgr
adminEng, baseMgrMutex, baseStaticDataHM, cDataEnd, cDataStart, kkConf, kkInstanceId, mgrFactory, STORE_ID, templateBaseDir
 
Constructor Summary
AdminCustomerBatchMgr(KKAdminIf eng)
           
 
Method Summary
 void countCustomersBatch(java.lang.String logName, java.lang.String appendLogStr)
          This batch is a simple example that can be used to demonstrate how the ExecuteMultiStoreBatch class can be used to execute batch jobs for each store.
protected  int deleteCustomer(AdminCustomer cust, com.konakart.bl.KKCriteria sessionCrit, com.konakart.bl.KKCriteria sessionDelCrit, AdminCustomerMgrIf custMgr)
           
 void deleteTemporaryDataBatch(java.lang.String logName, java.lang.String appendLogStr, java.lang.String numDaysStr)
          This batch is used to delete temporary data in order to keep your KonaKart store running efficiently.
 void expiredRewardPointBatch(java.lang.String logName, java.lang.String appendLogStr, java.lang.String numDaysStr)
          This batch is used to expire reward points after a certain time limit, which is entered as a number of days in the numDays parameter.
protected  com.konakart.bl.KKCriteria getCustomerCriteria(int size, int[] permanentCustTypes)
          Get the criteria object to search for customers
protected  AdminCustomerBatchMgr.CustRetList getCustomers(com.konakart.bl.KKCriteria c, int custId)
          The method returns a null list within the return object when all of the customers have been read.
protected  com.konakart.bl.KKCriteria getSessionCriteria()
          Get the criteria object to search for a customer's session
 int getTimeInSecs()
          Utility method to return the current time in seconds
protected  java.util.List<AdminOrder> getUnpaidOrders(com.konakart.bl.KKCriteria c)
          The method returns null when all of the orders have been read.
protected  boolean hasSessionExpired(int expiryInSecs)
           
 java.lang.String removeExpiredCustomersBatch(java.lang.String logName, java.lang.String appendLogStr, java.lang.String recordFetchSizeStr, java.lang.String permanentCustTypesStr)
          Each existing customer is read from the database in a loop, and for each customer object we detect whether it has one or more expired session records and no non expired record.
 
Methods inherited from class com.konakartadmin.bl.AdminBatchBaseMgr
executeQuery, getBoolean, getInt, getIntArray, getLogName, validateTemplate
 
Methods inherited from class com.konakartadmin.bl.AdminBaseMgr
addInsertAttr, addInsertAttr, checkIntIsSet, checkRequired, getAdminAddressMgr, getAdminAuditMgr, getAdminBillingMgr, getAdminBookableProductMgr, getAdminCatMgr, getAdminConfigMgr, getAdminCurrMgr, getAdminCustMgr, getAdminCustTagMgr, getAdminEmailMgr, getAdminEng, getAdminHtmlMgr, getAdminLanguageMgr, getAdminManuMgr, getAdminMessageMgr, getAdminMiscItemMgr, getAdminModulesMgr, getAdminMultiStoreMgr, getAdminOrderMgr, getAdminPdfMgr, getAdminProdAttrMgr, getAdminProdMgr, getAdminPromMgr, getAdminPublishProdMgr, getAdminReviewMgr, getAdminSearchRuleMgr, getAdminSecMgr, getAdminSolrMgr, getAdminStoreMgr, getAdminTagMgr, getAdminTaxMgr, getAdminValidationMgr, getAdminVelocityContextMgr, getAdminWishListMgr, getBooleanFromString, getExportXMLData, getIntFromString, getKkConfig, getKkInstanceId, getMode, getModeString, getMqMgr, getNewCriteria, getNewCriteria, getPostSearchText, getPreSearchText, getPropertyValue, getRecordCount, getRewardPointMgr, getSingleIntResult, getStoreId, getTemplate, getTemplateBase, getXml_io, init, isConfigSet, isEnterprise, isMultiStoreLanguagesShared, isMultiStoreMode, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareProducts, isMultiStoreSingleDBCSMode, isMultiStoreSingleDBMode, isMultiStoreSingleDBNonCSMode, manageException, refreshConfigs, removeCData, setAdminEng, setupWildCardRules, setWildCardAfter, setWildCardBefore, shutdownGracefully, shutdownGracefully, timestampStr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdminCustomerBatchMgr

public AdminCustomerBatchMgr(KKAdminIf eng)
                      throws java.lang.Exception
Parameters:
eng -
Throws:
java.lang.Exception
Method Detail

removeExpiredCustomersBatch

public java.lang.String removeExpiredCustomersBatch(java.lang.String logName,
                                                    java.lang.String appendLogStr,
                                                    java.lang.String recordFetchSizeStr,
                                                    java.lang.String permanentCustTypesStr)
                                             throws java.lang.Exception
Each existing customer is read from the database in a loop, and for each customer object we detect whether it has one or more expired session records and no non expired record. If this is the case, the customer and the session records are deleted. If no session records exist, then the creation time of the customer is read and the customer is deleted if it has existed for a few seconds, in order to avoid deleting customers that are in the process of being created and registered. This batch is used for the case where KonaKart mustn't store customer information so this information is stored only temporarily to allow a customer to place an order and then is deleted.

Parameters:
logName - The name of the log which shouldn't include the path or extension. i.e. It should be myLog rather than /logs/myLog.txt.
appendLogStr - If set to false, a new log will be created every time the batch job is run. Otherwise new data will be appended to the existing log. It defaults to false.
recordFetchSizeStr - It the batch involves reading many records in a loop, this determines the maximum number read in any one loop. It defaults to 100.
permanentCustTypesStr - An array of customer types that won't be deleted. They are in a format "3-6-8" where "-" is a delimiter between the integers.
Returns:
Returns the number of customers removed
Throws:
java.lang.Exception

deleteCustomer

protected int deleteCustomer(AdminCustomer cust,
                             com.konakart.bl.KKCriteria sessionCrit,
                             com.konakart.bl.KKCriteria sessionDelCrit,
                             AdminCustomerMgrIf custMgr)
                      throws java.lang.Exception
Throws:
java.lang.Exception

hasSessionExpired

protected boolean hasSessionExpired(int expiryInSecs)

getCustomers

protected AdminCustomerBatchMgr.CustRetList getCustomers(com.konakart.bl.KKCriteria c,
                                                         int custId)
                                                  throws java.lang.Exception
The method returns a null list within the return object when all of the customers have been read. The caller can stop looping when he receives null.

Parameters:
c -
Returns:
Returns a list of AdminCustomers and the last customer Id
Throws:
java.lang.Exception

getSessionCriteria

protected com.konakart.bl.KKCriteria getSessionCriteria()
Get the criteria object to search for a customer's session

Returns:
Returns a criteria object

getCustomerCriteria

protected com.konakart.bl.KKCriteria getCustomerCriteria(int size,
                                                         int[] permanentCustTypes)
Get the criteria object to search for customers

Parameters:
size -
permanentCustTypes -
Returns:
Returns a criteria object

expiredRewardPointBatch

public void expiredRewardPointBatch(java.lang.String logName,
                                    java.lang.String appendLogStr,
                                    java.lang.String numDaysStr)
                             throws java.lang.Exception
This batch is used to expire reward points after a certain time limit, which is entered as a number of days in the numDays parameter. The expired attribute of each expired reward points record is set to non zero by the batch.

Parameters:
logName - The name of the log which shouldn't include the path or extension. i.e. It should be myLog rather than /logs/myLog.txt.
appendLogStr - If set to false, a new log will be created every time the batch job is run. Otherwise new data will be appended to the existing log. It defaults to false.
numDaysStr - If current time - numDays is greater than the date when the reward point transaction was added, then the points added in that transaction are expired.
Throws:
java.lang.Exception

deleteTemporaryDataBatch

public void deleteTemporaryDataBatch(java.lang.String logName,
                                     java.lang.String appendLogStr,
                                     java.lang.String numDaysStr)
                              throws java.lang.Exception
This batch is used to delete temporary data in order to keep your KonaKart store running efficiently. It deletes :

Parameters:
logName - The name of the log which shouldn't include the path or extension. i.e. It should be myLog rather than /logs/myLog.txt.
appendLogStr - If set to false, a new log will be created every time the batch job is run. Otherwise new data will be appended to the existing log. It defaults to false.
numDaysStr - kk_cookie records are deleted if current time - numDays is greater than the date when the cookie was last read or actually created (for the case when it has never been read).
Throws:
java.lang.Exception

getTimeInSecs

public int getTimeInSecs()
Utility method to return the current time in seconds

Returns:
Returns the time

getUnpaidOrders

protected java.util.List<AdminOrder> getUnpaidOrders(com.konakart.bl.KKCriteria c)
                                              throws java.lang.Exception
The method returns null when all of the orders have been read. The caller can stop looping when he receives null.

Parameters:
c -
Returns:
Returns a list of AdminOrders
Throws:
java.lang.Exception

countCustomersBatch

public void countCustomersBatch(java.lang.String logName,
                                java.lang.String appendLogStr)
                         throws java.lang.Exception
This batch is a simple example that can be used to demonstrate how the ExecuteMultiStoreBatch class can be used to execute batch jobs for each store.

It simply counts the number of customers in the store and writes out this number.

Parameters:
logName - The name of the log which shouldn't include the path or extension. i.e. It should be myLog rather than /logs/myLog.txt.
appendLogStr - If set to false, a new log will be created every time the batch job is run. Otherwise new data will be appended to the existing log. It defaults to false.
Throws:
java.lang.Exception


Copyright © 2011 DS Data Systems UK Ltd.