public class AdminMessageMgr extends AdminBaseMgr implements AdminMessageMgrIf
Modifier and Type | Class and Description |
---|---|
protected class |
AdminMessageMgr.StaticData |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
fileEncoding |
protected static java.lang.String |
HELP_MESSAGE_CAT_PREFIX
The prefix of the Help Message Catalogue file
|
protected static org.apache.commons.logging.Log |
log
the log
|
protected static java.lang.String |
MESSAGE_CAT_PREFIX
The prefix of the Main Message Catalogue file
|
protected static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> |
msgsMap
Hash Map containing the messages for each locale within another map.
|
static java.lang.Boolean |
msgValueAttrAnOracleCLOB
is Oracle CLOB used for msg_Value column?
|
protected static java.lang.String |
mutex
Mutex for this manager
|
protected static java.util.Map<java.lang.String,AdminMessageMgr.StaticData> |
staticDataHM
Hash Map that contains the static data
|
adminEng, baseMgrMutex, baseStaticDataHM, cDataEnd, cDataStart, debugStackTraceExclusions, kkAdminPropsFilePath, kkConf, kkInstanceId, mgrFactory, STORE_ID, templateBaseDir
Constructor and Description |
---|
AdminMessageMgr(KKAdminIf eng)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addKkMsgOrderBy(com.konakart.db.KKCriteria c,
AdminKkMsgSearch search)
Add the order by clause using the definition specified in the search criteria
|
protected void |
addKkMsgOrderBy(com.konakart.db.KKCriteria c,
java.lang.String orderBy) |
void |
addKkMsgSearchCriteria(com.konakart.db.KKCriteria c,
AdminKkMsgSearch search)
Adds the search criteria for the KkMsg search
|
void |
deleteMsg(java.lang.String key,
int type,
java.lang.String localeIn)
Delete a Message
|
void |
deleteMsgs(int type,
java.lang.String locale)
Delete all the messages with the specified type and locale
|
boolean |
doesMsgExist(java.lang.String key,
int type,
java.lang.String localeIn)
Does the message exist?
|
java.lang.String |
exportMsgs(int type,
java.lang.String locale)
Export Messages
|
protected java.lang.String |
getDefaultLanguageCode() |
protected java.lang.String |
getDefaultLocale() |
static java.lang.String |
getFileEncoding()
Returns the encoding used for the file.
|
protected java.net.URL |
getHelpMessageFileURL(java.lang.String locale)
Deprecated.
|
java.lang.String |
getHelpMsg(java.lang.String msgKey,
java.lang.String locale)
Return the help message for the specified language and the specified key.
|
protected java.lang.String |
getHelpMsgFromBundle(java.util.ResourceBundle bundle,
java.lang.String msgKey) |
java.lang.String |
getHelpMsgFromDatabase(java.lang.String msgKey,
java.lang.String locale)
Get the help screen message for the specified help message key from the database in the
specified language.
|
protected java.lang.String |
getHelpMsgFromProperties(java.util.Properties props,
java.lang.String msgKey) |
protected java.util.Set<java.lang.String> |
getKeys(java.lang.String locale,
int type)
Retrieve all the keys for the specified type and locale, add them to a Set and return them.
|
int |
getKkMsgCount(AdminKkMsgSearch search)
Returns a count of the number of Messages with the specified search criteria
|
protected java.util.Locale |
getLocaleFromString(java.lang.String locale) |
java.lang.String |
getMsg(java.lang.String msgKey)
Gets a message with the specified key from the catalog of the default language.
|
java.lang.String |
getMsg(java.lang.String msgKey,
java.lang.String localeIn)
Gets a message with the specified key from the catalog for the specified locale.
|
AdminMessageSet |
getMsgs(java.lang.String locale)
Return a set of admin application messages specified language.
|
AdminMessageSet |
getMsgsFromDatabase(java.lang.String localeIn)
Gets an AdminMessageSet for the specified locale from the database.
|
java.lang.String |
getMsgValue(java.lang.String key,
int type,
java.lang.String localeIn)
Get a Message Value
|
protected java.lang.String |
getPropertiesFileNameForCode(java.lang.String filenamePrefix,
java.lang.String languageCode) |
protected java.lang.String |
getPropertiesFileNameForLocale(java.lang.String filenamePrefix,
java.lang.String locale) |
void |
importMsgs(int type,
java.lang.String locale,
java.lang.String msgString,
boolean replace)
Import Messages
|
void |
insertMsg(java.lang.String key,
int type,
java.lang.String locale,
java.lang.String value)
Insert a Message
|
void |
insertMsg(java.lang.String key,
int type,
java.lang.String locale,
java.lang.String value,
boolean checkExists) |
static boolean |
isMsgValueAttrAnOracleCLOB()
Is the custom_attrs column is an Oracle CLOB? We only check once and save the result in a
static variable.
|
java.util.Properties |
loadMessageProperties(java.lang.String messageFilePath)
Load the contents of the file whose name is specified into a Properties object.
|
protected org.apache.commons.configuration2.Configuration |
readDefaultCatalog() |
protected org.apache.commons.configuration2.Configuration |
readDefaultCatalogFromDatabase() |
void |
refreshConfigs()
Retrieve some commonly-used properties and set the velocity log file location
|
AdminKkMsgSearchResult |
searchMsg(AdminKkMsgSearch search,
int groupSize,
int offset)
Retrieve all the messages that match the specified search criteria
|
static void |
setFileEncoding(java.lang.String fileEncoding)
Sets the encoding used for the file.
|
void |
updateMsg(java.lang.String key,
int type,
java.lang.String locale,
java.lang.String value)
Update a Message
|
addInsertAttr, addInsertAttr, addStringRuleConstraint, addStringRuleConstraint, checkAPICallEnabled, checkIntInRange, checkIntIsSet, checkRequired, executeQuery, executeQuery, getAdminAddressMgr, getAdminAuditMgr, getAdminBillingMgr, getAdminBookableProductMgr, getAdminCatMgr, getAdminConfigMgr, getAdminContentMgr, getAdminCurrMgr, getAdminCustMgr, getAdminCustPwdHistMgr, getAdminCustTagMgr, getAdminEmailMgr, getAdminEng, getAdminEngineCacheMgr, getAdminEventMgr, getAdminExecuteMgr, getAdminFileMgr, getAdminFilterMgr, getAdminHtmlMgr, getAdminImportMgr, getAdminLanguageMgr, getAdminManuMgr, getAdminMessageMgr, getAdminMiscItemMgr, getAdminMiscPriceMgr, getAdminModulesMgr, getAdminMultiStoreMgr, getAdminOrderMgr, getAdminPdfMgr, getAdminProdAttrMgr, getAdminProdMgr, getAdminPromMgr, getAdminReviewMgr, getAdminSearchRuleMgr, getAdminSecMgr, getAdminServletMgr, getAdminShipmentMgr, getAdminSolrMgr, getAdminStoreMgr, getAdminSuggestionMgr, getAdminTagMgr, getAdminTaxMgr, getAdminValidationMgr, getAdminVelocityContextMgr, getAdminWishListMgr, getBooleanFromString, getDebugStackTraceExclusions, getEmailThreadGracefulShutdownTimeout, getExportMgr, getExportMgr, getExportXMLData, getIntFromString, getKkAdminPropsFilePath, getKkConfig, getKkInstanceId, getMode, getModeString, getMqMgr, getNewCriteria, getNewCriteria, getNewCriteria, getNewCriteria, getOtherModuleByName, getPostSearchText, getPreSearchText, getProductsToCategoresCriteria, getPropertyValue, getPropertyValue, getPropertyValueAsBool, getPropertyValueAsInt, getPropertyValueAsLong, getRecordCount, getRecordCount, getRewardPointMgr, getSingleIntResult, getStoreId, getTemplate, getTemplateBase, getXml_io, init, insertKKEvent, insertKKEvent, isBusiness, isBusinessOrEnterprise, isCommunity, isConfigSet, isEnterprise, isMultiStoreLanguagesShared, isMultiStoreMode, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareCustomersOrProducts, isMultiStoreShareProducts, isMultiStoreSingleDBCSMode, isMultiStoreSingleDBMode, isMultiStoreSingleDBNonCSMode, isUnix, isWindows, manageException, manageThrowable, removeCData, sendMQMessages, setAdminEng, setDebugStackTraceExclusions, setKkAdminPropsFilePath, setupWildCardRules, setWildCardAfter, setWildCardBefore, shutdownGracefully, shutdownGracefully, timestampStr, updateStaticVariablesNow
protected static org.apache.commons.logging.Log log
protected static final java.lang.String HELP_MESSAGE_CAT_PREFIX
protected static final java.lang.String MESSAGE_CAT_PREFIX
protected static java.lang.String mutex
protected static java.util.Map<java.lang.String,AdminMessageMgr.StaticData> staticDataHM
protected static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> msgsMap
private static java.lang.String fileEncoding
public static java.lang.Boolean msgValueAttrAnOracleCLOB
public AdminMessageMgr(KKAdminIf eng) throws java.lang.Exception
eng
- KKAdmin enginejava.lang.Exception
- an unexpected exceptionpublic AdminMessageSet getMsgs(java.lang.String locale) throws KKAdminException
AdminMessageMgrIf
For file-based messages (where the configuration parameter USE_DB_FOR_MESSAGES = false) the messages are retrieved from a message properties file on the classpath that best-matches the specified language parameter. The name of the file starts with 'AdminMessages' and may have a language code or locale specification appended to it, and '.properties' added to the end. An example of such a file would be AdminMessages_de.properties. It first tries to find a file that matches the language_code exactly (this could be a full locale description such as 'de_DE' or 'pt_BR') and if no such file is found it tries to find one that matches just the first two characters (in this case 'de' and 'pt' respectively). When the specified language code is 'en' a file without any language or locale specification is used instead.
For database-based messages the language code specified must be the locale specified in the database. By default these will be the full locale names (eg. en_GB, de_DE, pt_BR etc). file for the locale or language code.
getMsgs
in interface AdminMessageMgrIf
locale
- See above... Either specify the full language locale or the 2-character language
code. If null, the language code of the default language will be used.KKAdminException
- an unexpected exception in the KonaKart Admin engineprotected java.util.Locale getLocaleFromString(java.lang.String locale)
public AdminMessageSet getMsgsFromDatabase(java.lang.String localeIn) throws KKAdminException
AdminMessageMgrIf
getMsgsFromDatabase
in interface AdminMessageMgrIf
localeIn
- the 5-letter locale code eg. en_GB, es_ES, de_DE etcKKAdminException
- an unexpected exception in the KonaKart Admin enginepublic java.lang.String getMsg(java.lang.String msgKey, java.lang.String localeIn) throws KKAdminException
AdminMessageMgrIf
This is for Admin Application messages only (type is KKConstants.MSG_TYP_ADMIN_APP)
getMsg
in interface AdminMessageMgrIf
msgKey
- the message key into the message catalog filelocaleIn
- the 5-letter locale code eg. en_GB, es_ES, de_DE etcKKAdminException
- an unexpected exception in the KonaKart Admin enginepublic java.lang.String getHelpMsg(java.lang.String msgKey, java.lang.String locale) throws KKAdminException
AdminMessageMgrIf
For file-based messages (where the configuration parameter USE_DB_FOR_MESSAGES = false) the message is retrieved from a message properties file on the classpath that best-matches the specified language parameter. The name of the file starts with 'AdminHelpMessages' and may have a language code or locale specification appended to it, and '.properties' added to the end. An example of such a file would be AdminHelpMessages_de.properties. It first tries to find a file that matches the language_code exactly (this could be a full locale description such as 'de_DE' or 'pt_BR') and if no such file is found it tries to find one that matches just the first two characters (in this case 'de' and 'pt' respectively). When the specified language code is 'en' a file without any language or locale specification is used instead.
For database-based messages the language code specified must be the locale specified in the database. By default these will be the full locale names (eg. en_GB, de_DE, pt_BR etc). file for the locale or language code.
getHelpMsg
in interface AdminMessageMgrIf
msgKey
- the key of the help message in the properties file. If null, a null help message
is returned.locale
- the language code (if null it uses the current default language)KKAdminException
- an unexpected exception in the KonaKart Admin engine@Deprecated protected java.net.URL getHelpMessageFileURL(java.lang.String locale) throws KKAdminException
KKAdminException
protected java.lang.String getHelpMsgFromBundle(java.util.ResourceBundle bundle, java.lang.String msgKey) throws KKAdminException
KKAdminException
protected java.lang.String getHelpMsgFromProperties(java.util.Properties props, java.lang.String msgKey) throws KKAdminException
KKAdminException
public java.lang.String getHelpMsgFromDatabase(java.lang.String msgKey, java.lang.String locale) throws KKAdminException
AdminMessageMgrIf
getHelpMsgFromDatabase
in interface AdminMessageMgrIf
msgKey
- the message keylocale
- the 5-letter locale code eg. en_GB, es_ES, de_DE etcKKAdminException
- an unexpected exception in the KonaKart Admin enginepublic java.util.Properties loadMessageProperties(java.lang.String messageFilePath) throws KKAdminException
AdminMessageMgrIf
loadMessageProperties
in interface AdminMessageMgrIf
messageFilePath
- the message filenameKKAdminException
- an unexpected exception in the KonaKart Admin enginepublic java.lang.String getMsg(java.lang.String msgKey) throws KKAdminException
AdminMessageMgrIf
This is for Admin Application messages only (type is KKConstants.MSG_TYP_ADMIN_APP)
getMsg
in interface AdminMessageMgrIf
msgKey
- the message key into the message catalog fileKKAdminException
- an unexpected exception in the KonaKart Admin engineprotected java.lang.String getPropertiesFileNameForCode(java.lang.String filenamePrefix, java.lang.String languageCode)
protected java.lang.String getPropertiesFileNameForLocale(java.lang.String filenamePrefix, java.lang.String locale)
protected org.apache.commons.configuration2.Configuration readDefaultCatalog() throws KKAdminException
KKAdminException
protected org.apache.commons.configuration2.Configuration readDefaultCatalogFromDatabase() throws KKAdminException
KKAdminException
protected java.lang.String getDefaultLocale()
protected java.lang.String getDefaultLanguageCode()
public boolean doesMsgExist(java.lang.String key, int type, java.lang.String localeIn) throws KKAdminException
AdminMessageMgrIf
doesMsgExist
in interface AdminMessageMgrIf
key
- the keytype
- the typelocaleIn
- the localeKKAdminException
- an unexpected exception in the KonaKart Admin enginepublic void deleteMsgs(int type, java.lang.String locale) throws KKAdminException, org.apache.torque.TorqueException
type
- the typelocale
- this must not be nullKKAdminException
- unexpected exception in the KonaKart Admin Engineorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)public void deleteMsg(java.lang.String key, int type, java.lang.String localeIn) throws KKAdminException
AdminMessageMgrIf
deleteMsg
in interface AdminMessageMgrIf
key
- the message keytype
- the message type (Use KKConstants.MSG_TYP_APPLICATION for application messages,
KKConstants.MSG_TYP_ADMIN_APP for Admin App messages,
KKConstants.MSG_TYP_Admin_HELP for Admin App Help messages)localeIn
- the message locale (eg. "en_GB"). If this is null the default locale for the store
is used.KKAdminException
- an unexpected exception in the KonaKart Admin enginepublic java.lang.String exportMsgs(int type, java.lang.String locale) throws KKAdminException, org.apache.torque.TorqueException, com.workingdogs.village.DataSetException
AdminMessageMgrIf
exportMsgs
in interface AdminMessageMgrIf
type
- the message type (Use KKConstants.MSG_TYP_APPLICATION for application messages,
KKConstants.MSG_TYP_ADMIN_APP for Admin App messages,
KKConstants.MSG_TYP_Admin_HELP for Admin App Help messages)locale
- the message locale (eg. "en_GB"). If this is null the default locale for the store
is used.KKAdminException
- an unexpected exception in the KonaKart Admin engineorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)public java.lang.String getMsgValue(java.lang.String key, int type, java.lang.String localeIn) throws java.lang.Exception, KKAdminException, org.apache.torque.TorqueException, com.workingdogs.village.DataSetException
AdminMessageMgrIf
getMsgValue
in interface AdminMessageMgrIf
key
- the message keytype
- the message type (Use KKConstants.MSG_TYP_APPLICATION for application messages,
KKConstants.MSG_TYP_ADMIN_APP for Admin App messages,
KKConstants.MSG_TYP_Admin_HELP for Admin App Help messages)localeIn
- the message locale (eg. "en_GB"). If this is null the default locale for the store
is used.java.lang.Exception
- an unexpected exceptionKKAdminException
- an unexpected exception in the KonaKart Admin engineorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)public void importMsgs(int type, java.lang.String locale, java.lang.String msgString, boolean replace) throws KKAdminException, org.apache.torque.TorqueException, com.workingdogs.village.DataSetException
AdminMessageMgrIf
importMsgs
in interface AdminMessageMgrIf
type
- the message type (Use KKConstants.MSG_TYP_APPLICATION for application messages,
KKConstants.MSG_TYP_ADMIN_APP for Admin App messages,
KKConstants.MSG_TYP_Admin_HELP for Admin App Help messages)locale
- the message locale (eg. "en_GB"). If this is null the default locale for the store
is used.msgString
- A String containing the messages to import in the format of a java properties filereplace
- if true all the current messages for the specified type and locale are removed
before importing the new messages. If false the new messages are appended and if a
message key already exists it is replaced by the new message value being imported.KKAdminException
- an unexpected exception in the KonaKart Admin engineorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)public void insertMsg(java.lang.String key, int type, java.lang.String locale, java.lang.String value) throws KKAdminException
AdminMessageMgrIf
insertMsg
in interface AdminMessageMgrIf
key
- the message keytype
- the message type (Use KKConstants.MSG_TYP_APPLICATION for application messages,
KKConstants.MSG_TYP_ADMIN_APP for Admin App messages,
KKConstants.MSG_TYP_Admin_HELP for Admin App Help messages)locale
- the message locale (eg. "en_GB"). If this is null the default locale for the store
is used.value
- the value of the message to be insertedKKAdminException
- an unexpected exception in the KonaKart Admin enginepublic void insertMsg(java.lang.String key, int type, java.lang.String locale, java.lang.String value, boolean checkExists) throws KKAdminException
key
- the keytype
- the typelocale
- the localevalue
- the valuecheckExists
- the checkExistsKKAdminException
- unexpected exception in the KonaKart Admin Enginepublic int getKkMsgCount(AdminKkMsgSearch search) throws org.apache.torque.TorqueException, com.workingdogs.village.DataSetException, KKAdminException
search
- the AdminKkMsgSearch object that defines the search criteriaorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)KKAdminException
- unexpected exception in the KonaKart Admin Enginepublic void addKkMsgSearchCriteria(com.konakart.db.KKCriteria c, AdminKkMsgSearch search)
c
- the Criteria objectsearch
- the AdminKkMsgSearch object that defines the search criteriapublic void addKkMsgOrderBy(com.konakart.db.KKCriteria c, AdminKkMsgSearch search)
c
- the KKCriteria object to updatesearch
- the search criteriaprotected void addKkMsgOrderBy(com.konakart.db.KKCriteria c, java.lang.String orderBy)
public static boolean isMsgValueAttrAnOracleCLOB()
public AdminKkMsgSearchResult searchMsg(AdminKkMsgSearch search, int groupSize, int offset) throws KKAdminException, org.apache.torque.TorqueException, com.workingdogs.village.DataSetException
AdminMessageMgrIf
searchMsg
in interface AdminMessageMgrIf
search
- the AdminKkMsgSearch object that defines the search criteriagroupSize
- a maximum of this many messages will be returned by each call (the group size)offset
- the offset in the record set that match the criteria from which records are
returnedKKAdminException
- an unexpected exception in the KonaKart Admin engineorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)public void updateMsg(java.lang.String key, int type, java.lang.String locale, java.lang.String value) throws KKAdminException
AdminMessageMgrIf
updateMsg
in interface AdminMessageMgrIf
key
- the message keytype
- the message type (Use KKConstants.MSG_TYP_APPLICATION for application messages,
KKConstants.MSG_TYP_ADMIN_APP for Admin App messages,
KKConstants.MSG_TYP_Admin_HELP for Admin App Help messages)locale
- the message locale (eg. "en_GB"). If this is null the default locale for the store
is used.value
- the new value for the messageKKAdminException
- an unexpected exception in the KonaKart Admin enginepublic void refreshConfigs() throws KKAdminException
refreshConfigs
in interface AdminMessageMgrIf
refreshConfigs
in class AdminBaseMgr
KKAdminException
- unexpected exception in the KonaKart Admin Engineprotected java.util.Set<java.lang.String> getKeys(java.lang.String locale, int type) throws KKAdminException, org.apache.torque.TorqueException, com.workingdogs.village.DataSetException
locale
- the localetype
- the message typeKKAdminException
- unexpected exception in the KonaKart Admin Engineorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)public static java.lang.String getFileEncoding()
public static void setFileEncoding(java.lang.String fileEncoding)
fileEncoding
- the fileEncodingCopyright © 2018 DS Data Systems UK Ltd.