public class BaseMgr
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
templateBaseDir
Velocity template base directory under WEB-INF/classes.
|
Constructor and Description |
---|
BaseMgr() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
acquireLock(java.lang.String lockName)
Acquire a distributed lock if a KKLockMgrIf implementation is available
|
protected static void |
addInsertAttr(org.apache.torque.util.Criteria c,
java.lang.String attrName,
int value)
A utility method to not add integers that are equal to ConstantsMgr.NOT_SET
|
protected static void |
addInsertAttr(org.apache.torque.util.Criteria c,
java.lang.String attrName,
java.lang.Object value)
A utility to not add null objects
|
protected int |
addStringRuleConstraint(KKCriteria c,
java.lang.String searchValue,
int searchRule,
org.apache.torque.Column attrId)
Add a String search constraint to the criteria.
|
protected int |
addStringRuleConstraint(KKCriteria c,
java.lang.String searchValue,
int searchRule,
java.lang.String attrId)
Add a String search constraint to the criteria.
|
protected void |
checkRequired(java.lang.Object param,
java.lang.String paramType,
java.lang.String paramName)
Throws an exception with a proper message if the required parameter is null or null or empty
for the case of a string.
|
java.lang.String |
escapeHTML(java.lang.String input)
Utility method to escape characters from a string.
|
protected java.util.List<com.workingdogs.village.Record> |
executeQuery(java.lang.String query)
Execute query that works for all engine modes
|
protected java.util.List<com.workingdogs.village.Record> |
executeQuery(java.lang.String queryString,
int start,
int numberOfResults,
java.lang.String dbName,
boolean singleRecord)
Method for performing a SELECT.
|
protected java.util.List<com.workingdogs.village.Record> |
executeQuery(java.lang.String queryString,
int start,
int numberOfResults,
java.lang.String dbName,
boolean singleRecord,
boolean retryOnDeadlock,
java.lang.String note)
Method for performing a SELECT.
|
protected java.util.List<com.workingdogs.village.Record> |
executeQuery(java.lang.String queryString,
int start,
int numberOfResults,
java.lang.String dbName,
boolean singleRecord,
boolean retryOnDeadlock,
java.lang.String note,
java.util.List<java.lang.Object> whereValues)
Method for performing a SELECT.
|
protected java.util.List<com.workingdogs.village.Record> |
executeQuery(java.lang.String query,
java.util.List<java.lang.Object> whereValues)
Execute query that works for all engine modes
|
protected AdminEngineMgrIf |
getAdminEngMgr() |
protected BasketMgrIf |
getBasketMgr() |
protected BillingMgrIf |
getBillingMgr() |
protected BookableProductMgrIf |
getBookableProductMgr() |
protected CacheMgrIf |
getCacheMgr() |
protected CategoryMgrIf |
getCatMgr() |
protected ConfigurationMgrIf |
getConfigMgr() |
protected CookieMgrIf |
getCookieMgr() |
protected CurrencyMgrIf |
getCurrMgr() |
protected CustomerMgrIf |
getCustMgr() |
protected int |
getCustomerIdFromSession(java.lang.String sessionId)
Throws an exception if the customer isn't valid.
|
protected CustomerStatsMgrIf |
getCustomerStatsMgr() |
protected CustomerTagMgrIf |
getCustomerTagMgr() |
protected EmailMgrIf |
getEmailMgr() |
KKEngIf |
getEng() |
protected EventMgrIf |
getEventMgr() |
protected ExportMgrIf |
getExportMgr() |
com.google.common.escape.Escaper |
getHTMLEscaper()
Returns the HTML Escaper
|
protected boolean |
getKonaKartConfig(java.lang.String key,
boolean def)
Get a property from konakart.properties as a boolean.
|
protected int |
getKonaKartConfig(java.lang.String key,
int def)
Get a property from konakart.properties as an integer.
|
protected long |
getKonaKartConfig(java.lang.String key,
long def)
Get a property from konakart.properties as a long integer.
|
protected LanguageMgrIf |
getLangMgr() |
protected ManufacturerMgrIf |
getManuMgr() |
protected MiscItemMgrIf |
getMiscItemMgr() |
protected MiscPriceMgrIf |
getMiscPriceMgr() |
protected int |
getMode()
Return the engine mode
|
protected java.lang.String |
getModeString()
Return the engine mode - as a descriptive String for diagnostic purposes only
|
protected MqMgrIf |
getMqMgr() |
protected MultiStoreMgrIf |
getMultiStoreMgr() |
protected KKCriteria |
getNewCriteria()
Gets a new KKCriteria object
|
protected KKCriteria |
getNewCriteria(boolean allStores)
Gets a new KKCriteria object with the option of it being for all stores when in multi-store
single db mode.
|
protected OrderIntegrationMgrInterface |
getOrderIntegrationMgr()
Used to get an instance of the OrderIntegrationMgr
|
protected OrderMgrIf |
getOrderMgr() |
protected OrderTotalMgrIf |
getOrderTotalMgr() |
protected PaymentMgrIf |
getPaymentMgr() |
protected ProductMgrIf |
getProdMgr() |
protected KKCriteria |
getProductsToCategoresCriteria()
Gets a new KKCriteria object for use with ProductsToCategories.
|
protected PromotionMgrIf |
getPromMgr() |
protected PunchOutMgrIf |
getPunchOutMgr() |
protected RewardPointMgrIf |
getRewardPointMgr() |
protected SecurityMgrIf |
getSecMgr() |
protected ShippingMgrIf |
getShippingMgr() |
protected SolrMgrIf |
getSolrMgr() |
protected java.lang.String |
getStoreId()
Return the storeId
|
protected StoreMgrIf |
getStoreMgr() |
protected java.util.Date |
getStoreTime()
Returns the local store time based on the tz database time zone of the store.
|
protected SuggestionMgrIf |
getSuggestionMgr() |
protected TaxMgrIf |
getTaxMgr() |
protected org.apache.velocity.Template |
getTemplate(org.apache.velocity.app.VelocityEngine ve,
java.lang.String configDir,
java.lang.String templateName)
Helper method to search for the velocity templates in the correct sub-directory within the
class path.
|
protected java.lang.String |
getTemplateRoot(java.lang.String configDir)
Returns the template base directory which is created by concatenating the following:
Value of the Directory configuration variable specified
current storeId
|
protected VelocityContextMgrIf |
getVelocityContextMgr() |
protected WishListMgrIf |
getWishListMgr() |
protected void |
init(KKEngIf kkEng,
org.apache.commons.logging.Log logger)
Init method called from the super class.
|
protected int |
insertKKEvent(int code,
int subCode,
int intValue) |
protected int |
insertKKEvent(int code,
int subCode,
java.lang.String value) |
protected boolean |
isBusiness()
Returns true if we are in Business Mode
|
protected boolean |
isBusinessOrEnterprise()
Returns true if we are in Business or Enterprise Mode
|
protected boolean |
isClassPresent(java.lang.String className)
Check whether the specified class is present on the classpath.
|
protected boolean |
isCommunity()
Returns true if we are in Community Mode
|
protected boolean |
isDeadlockException(java.sql.SQLException se) |
protected boolean |
isEnterprise()
Returns true if we are in Enterprise Mode
|
protected boolean |
isMultiStoreShareCategories()
Returns true if we can share categories in multi-store single db mode.
|
protected boolean |
isMultiStoreShareCustomers()
Returns true if we need to share customers in multi-store single db mode
|
protected boolean |
isMultiStoreShareCustomersOrProducts()
Returns true if we need to share customers or products in multi-store single db mode
|
protected boolean |
isMultiStoreSharedDb()
Returns true if we are running in Multi-Store Shared DB mode
|
protected boolean |
isMultiStoreShareProducts()
Returns true if we can share products in multi-store single db mode
|
boolean |
isMultiVendor()
Returns true if the store is in multi-vendor mode
|
protected boolean |
isUnix()
Is a UNIX-like operating system?
|
protected com.konakart.app.KKException |
manageThrowable(java.lang.Throwable e)
Common code to manage exceptions in the Managers
|
protected boolean |
releaseLock(java.lang.String lockName)
Release a distributed lock if a KKLockMgrIf implementation is available
|
protected boolean |
updateStaticVariablesNow(long lastUpdatedMS)
Checks whether we should update the static variables now given the last updated was as
specified.
|
protected java.lang.String templateBaseDir
protected void init(KKEngIf kkEng, org.apache.commons.logging.Log logger) throws java.lang.Exception
kkEng
- the kkEnglogger
- the loggerjava.lang.Exception
- an unexpected exceptionprotected boolean getKonaKartConfig(java.lang.String key, boolean def)
key
- key in the properties file (do not add "konakart." at the start)def
- default value to return if the property or properties file isn't foundprotected int getKonaKartConfig(java.lang.String key, int def)
key
- key in the properties file (do not add "konakart." at the start)def
- default value to return if the property or properties file isn't foundprotected long getKonaKartConfig(java.lang.String key, long def)
key
- key in the properties file (do not add "konakart." at the start)def
- default value to return if the property or properties file isn't foundprotected int insertKKEvent(int code, int subCode, int intValue) throws java.lang.Exception
code
- the codesubCode
- the subCodeintValue
- the intValuejava.lang.Exception
- an unexpected exceptionprotected int insertKKEvent(int code, int subCode, java.lang.String value) throws java.lang.Exception
code
- the codesubCode
- the subCodevalue
- the valuejava.lang.Exception
- an unexpected exceptionprotected WishListMgrIf getWishListMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected TaxMgrIf getTaxMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected LanguageMgrIf getLangMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected CustomerMgrIf getCustMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected ConfigurationMgrIf getConfigMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected ProductMgrIf getProdMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected CurrencyMgrIf getCurrMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected SecurityMgrIf getSecMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected CategoryMgrIf getCatMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected CacheMgrIf getCacheMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected EmailMgrIf getEmailMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected ManufacturerMgrIf getManuMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected VelocityContextMgrIf getVelocityContextMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected OrderMgrIf getOrderMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected PromotionMgrIf getPromMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected BasketMgrIf getBasketMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected ExportMgrIf getExportMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected CookieMgrIf getCookieMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected ShippingMgrIf getShippingMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected PaymentMgrIf getPaymentMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected OrderTotalMgrIf getOrderTotalMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected StoreMgrIf getStoreMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected SolrMgrIf getSolrMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected EventMgrIf getEventMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected PunchOutMgrIf getPunchOutMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected MiscItemMgrIf getMiscItemMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected MiscPriceMgrIf getMiscPriceMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected MultiStoreMgrIf getMultiStoreMgr()
protected CustomerTagMgrIf getCustomerTagMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected CustomerStatsMgrIf getCustomerStatsMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected BillingMgrIf getBillingMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected BookableProductMgrIf getBookableProductMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected RewardPointMgrIf getRewardPointMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected AdminEngineMgrIf getAdminEngMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected MqMgrIf getMqMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected SuggestionMgrIf getSuggestionMgr() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected static void addInsertAttr(org.apache.torque.util.Criteria c, java.lang.String attrName, int value)
c
- the cattrName
- the attrNamevalue
- the valueprotected static void addInsertAttr(org.apache.torque.util.Criteria c, java.lang.String attrName, java.lang.Object value)
c
- the cattrName
- the attrNamevalue
- the valueprotected void checkRequired(java.lang.Object param, java.lang.String paramType, java.lang.String paramName) throws com.konakart.app.KKException
param
- the paramparamType
- the paramTypeparamName
- the paramNamecom.konakart.app.KKException
- an unexpected KKException exceptionprotected int getCustomerIdFromSession(java.lang.String sessionId) throws java.lang.Exception
sessionId
- the sessionIdjava.lang.Exception
- an unexpected exceptionpublic KKEngIf getEng()
protected int getMode() throws com.konakart.app.KKException
com.konakart.app.KKException
- an unexpected KKException exceptionprotected java.lang.String getModeString() throws com.konakart.app.KKException
com.konakart.app.KKException
- an unexpected KKException exceptionprotected java.lang.String getStoreId() throws com.konakart.app.KKException
com.konakart.app.KKException
- an unexpected KKException exceptionprotected KKCriteria getNewCriteria()
protected KKCriteria getNewCriteria(boolean allStores)
allStores
- the allStoresprotected KKCriteria getProductsToCategoresCriteria()
protected boolean isBusinessOrEnterprise() throws com.konakart.app.KKException
com.konakart.app.KKException
- if the engine config has not yet been definedprotected boolean isEnterprise() throws com.konakart.app.KKException
com.konakart.app.KKException
- if the engine config has not yet been definedprotected boolean isCommunity() throws com.konakart.app.KKException
com.konakart.app.KKException
- if the engine config has not yet been definedprotected boolean isBusiness() throws com.konakart.app.KKException
com.konakart.app.KKException
- if the engine config has not yet been definedprotected boolean isUnix()
protected boolean isMultiStoreSharedDb() throws com.konakart.app.KKException
com.konakart.app.KKException
- an unexpected KKException exceptionprotected boolean isMultiStoreShareCustomers() throws com.konakart.app.KKException
com.konakart.app.KKException
- an unexpected KKException exceptionprotected boolean isMultiStoreShareCustomersOrProducts() throws com.konakart.app.KKException
com.konakart.app.KKException
- an unexpected KKException exceptionprotected boolean isMultiStoreShareProducts() throws com.konakart.app.KKException
com.konakart.app.KKException
- an unexpected KKException exceptionpublic boolean isMultiVendor() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected boolean isMultiStoreShareCategories() throws com.konakart.app.KKException
com.konakart.app.KKException
- an unexpected KKException exceptionprotected org.apache.velocity.Template getTemplate(org.apache.velocity.app.VelocityEngine ve, java.lang.String configDir, java.lang.String templateName) throws org.apache.velocity.exception.ResourceNotFoundException, org.apache.velocity.exception.ParseErrorException, com.konakart.app.KKException, java.lang.Exception
If the template isn't found, we try to find it using the default country code and write an error in the log so that the administrator is aware that the template doesn't exist.
ve
- the veconfigDir
- the configuration parameter that defines the root directory for the templatetemplateName
- the templateNamejava.lang.Exception
- an unexpected exceptioncom.konakart.app.KKException
- an unexpected KKException exceptionorg.apache.velocity.exception.ParseErrorException
- an unexpected ParseErrorException exceptionorg.apache.velocity.exception.ResourceNotFoundException
- an unexpected ResourceNotFoundException exceptionprotected java.lang.String getTemplateRoot(java.lang.String configDir) throws org.apache.torque.TorqueException, com.konakart.app.KKException, com.workingdogs.village.DataSetException, java.lang.Exception
If the config variable isn't available, a default value of the current directory is returned.
configDir
- the configuration parameter that defines the root directory for the templateorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.konakart.app.KKException
- an unexpected KKException exceptioncom.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)java.lang.Exception
- an unexpected exceptionprotected OrderIntegrationMgrInterface getOrderIntegrationMgr() throws org.apache.torque.TorqueException, com.konakart.app.KKException, com.workingdogs.village.DataSetException, java.lang.Exception
java.lang.Exception
- an unexpected exceptioncom.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)com.konakart.app.KKException
- an unexpected KKException exceptionorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)protected java.util.List<com.workingdogs.village.Record> executeQuery(java.lang.String query) throws org.apache.torque.TorqueException, com.konakart.app.KKException
query
- the queryorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.konakart.app.KKException
- an unexpected KKException exceptionprotected java.util.List<com.workingdogs.village.Record> executeQuery(java.lang.String query, java.util.List<java.lang.Object> whereValues) throws org.apache.torque.TorqueException, com.konakart.app.KKException
query
- the querywhereValues
- the whereValuesorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.konakart.app.KKException
- an unexpected KKException exceptionprotected java.util.List<com.workingdogs.village.Record> executeQuery(java.lang.String queryString, int start, int numberOfResults, java.lang.String dbName, boolean singleRecord) throws org.apache.torque.TorqueException
queryString
- A String with the sql statement to execute.start
- The first row to return.numberOfResults
- The number of rows to return.dbName
- The database to connect to.singleRecord
- Whether or not we want to select only a single record.org.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)
Any exceptions caught during processing will be re-thrown wrapped into a
TorqueException.protected java.util.List<com.workingdogs.village.Record> executeQuery(java.lang.String queryString, int start, int numberOfResults, java.lang.String dbName, boolean singleRecord, boolean retryOnDeadlock, java.lang.String note) throws org.apache.torque.TorqueException
queryString
- A String with the sql statement to execute.start
- The first row to return.numberOfResults
- The number of rows to return.dbName
- The database to connect to.singleRecord
- Whether or not we want to select only a single record.retryOnDeadlock
- if true the query is retried in the event of deadlock detectionnote
- For problem diagnosis only. This note is added to a warning message to help
identify the source of the deadlock.org.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)
Any exceptions caught during processing will be re-thrown wrapped into a
TorqueException.protected java.util.List<com.workingdogs.village.Record> executeQuery(java.lang.String queryString, int start, int numberOfResults, java.lang.String dbName, boolean singleRecord, boolean retryOnDeadlock, java.lang.String note, java.util.List<java.lang.Object> whereValues) throws org.apache.torque.TorqueException
queryString
- A String with the sql statement to execute.start
- The first row to return.numberOfResults
- The number of rows to return.dbName
- The database to connect to.singleRecord
- Whether or not we want to select only a single record.retryOnDeadlock
- if true the query is retried in the event of deadlock detectionnote
- For problem diagnosis only. This note is added to a warning message to help
identify the source of the deadlock.whereValues
- the where clause values used in prepared statementsorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)
Any exceptions caught during processing will be re-thrown wrapped into a
TorqueException.protected boolean isDeadlockException(java.sql.SQLException se)
se
- a java.sql.SQLExceptionprotected int addStringRuleConstraint(KKCriteria c, java.lang.String searchValue, int searchRule, java.lang.String attrId)
c
- the CriteriasearchValue
- value to use in the searchsearchRule
- ruleattrId
- the BasePeer attribute nameprotected int addStringRuleConstraint(KKCriteria c, java.lang.String searchValue, int searchRule, org.apache.torque.Column attrId)
c
- the CriteriasearchValue
- value to use in the searchsearchRule
- ruleattrId
- the BasePeer attribute nameprotected com.konakart.app.KKException manageThrowable(java.lang.Throwable e)
e
- the eprotected java.util.Date getStoreTime() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionpublic java.lang.String escapeHTML(java.lang.String input)
input
- the inputpublic com.google.common.escape.Escaper getHTMLEscaper()
protected boolean releaseLock(java.lang.String lockName)
lockName
- the lockNameprotected boolean acquireLock(java.lang.String lockName) throws com.konakart.app.KKException
lockName
- the lockNamecom.konakart.app.KKException
- an unexpected KKException exceptionprotected boolean updateStaticVariablesNow(long lastUpdatedMS)
lastUpdatedMS
- the last time the static variables were updated (using system time)protected boolean isClassPresent(java.lang.String className)
className
- the class nameCopyright © 2018 DS Data Systems UK Ltd.