com.konakartadmin.bl
Class AdminLanguageMgr

java.lang.Object
  extended by com.konakartadmin.bl.AdminBaseMgr
      extended by com.konakartadmin.bl.AdminLanguageMgr
All Implemented Interfaces:
AdminLanguageMgrIf

public class AdminLanguageMgr
extends AdminBaseMgr
implements AdminLanguageMgrIf

The AdminLanguageMgr - for Managing Language Objects for the Admin Application


Nested Class Summary
protected  class AdminLanguageMgr.StaticData
          StaticData
 
Field Summary
static int ALL_LANGUAGES
          All languages indicator.
static int DEFAULT_LANG
          Default language id is selected with a value of ConstantsMgr.NOT_SET.
protected static org.apache.commons.logging.Log log
          the log
protected static java.lang.String mutex
          Mutex for the Manager
protected static java.util.Map<java.lang.String,AdminLanguageMgr.StaticData> staticDataHM
          Hash Map that contains the static data
 
Fields inherited from class com.konakartadmin.bl.AdminBaseMgr
adminEng, baseMgrMutex, baseStaticDataHM, cDataEnd, cDataStart, kkConf, kkInstanceId, mgrFactory, STORE_ID, templateBaseDir
 
Constructor Summary
AdminLanguageMgr(KKAdminIf eng)
          Constructor
 
Method Summary
protected  int addLanguageSearchCriteria(com.konakart.bl.KKCriteria c, AdminLanguageSearch search)
           
protected  void addOrderBy(com.konakart.bl.KKCriteria c, AdminLanguageSearch search)
          Add Order By clauses
 int deleteLanguage(int langId)
          Delete a Language
protected  void deriveDataLanguage(AdminLanguage lang)
           
 boolean doesLanguageExistForId(int langId)
          Checks to see whether a language already exists with this id
 AdminLanguage fetchDefaultLanguage()
          This fetches the default language regardless of whether it's already set.
 int fetchNumLanguages()
          This fetches the number of languages from the database for the current engine/store.
 AdminLanguage[] getAllLanguages()
          Returns an array of language objects that have been defined in the system.
 AdminLanguage getDefaultLanguage()
          Returns the default language
 java.lang.String getDefaultLanguageCode()
           
 int getDefaultLanguageId()
          Returns the default language id
 java.lang.String getDefaultLocale()
           
 AdminLanguage getLanguageByCode(java.lang.String code)
          Retrieves the language object referenced by the code (i.e.
 AdminLanguage getLanguageById(int languageId)
          Returns the language referenced by the language id
 AdminLanguage getLanguageForLocale(java.lang.String locale)
          Retrieves the language for the locale
 int getLanguageIdForLocale(java.lang.String locale)
          Retrieves the language Id for the locale
 AdminLanguageSearchResult getLanguages(AdminLanguageSearch search)
          This returns an AdminLanguageSearchResult object.
 int getNumLanguages()
          Returns the total number of languages defined for the store - it does not include the display-only languages
 int insertLanguage(AdminLanguage lang)
          Insert a Language
 void refreshConfigs()
          Retrieve some commonly-used properties and set the velocity log file location
protected  void setDefaultLanguage()
          The default language is referenced by a configuration variable called DEFAULT_LANGUAGE.
 void setDefaultLanguage(java.lang.String langCode)
          Sets the default language.
protected  void setNumLanguages()
          The number of languages is retrieved from the database first time round and is then stored in a static variable.
 int updateLanguage(AdminLanguage lang)
          Update a Language
 
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, 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
 

Field Detail

log

protected static org.apache.commons.logging.Log log
the log


DEFAULT_LANG

public static final int DEFAULT_LANG
Default language id is selected with a value of ConstantsMgr.NOT_SET.

See Also:
Constant Field Values

ALL_LANGUAGES

public static final int ALL_LANGUAGES
All languages indicator.

See Also:
Constant Field Values

mutex

protected static java.lang.String mutex
Mutex for the Manager


staticDataHM

protected static java.util.Map<java.lang.String,AdminLanguageMgr.StaticData> staticDataHM
Hash Map that contains the static data

Constructor Detail

AdminLanguageMgr

public AdminLanguageMgr(KKAdminIf eng)
                 throws java.lang.Exception
Constructor

Parameters:
eng - KKAdmin engine
Throws:
java.lang.Exception
Method Detail

getAllLanguages

public AdminLanguage[] getAllLanguages()
                                throws org.apache.torque.TorqueException,
                                       com.workingdogs.village.DataSetException,
                                       KKAdminException
Returns an array of language objects that have been defined in the system. It returns all languages in the database except those that are marked as display only.

Specified by:
getAllLanguages in interface AdminLanguageMgrIf
Returns:
An array of language objects.
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

getLanguages

public AdminLanguageSearchResult getLanguages(AdminLanguageSearch search)
                                       throws org.apache.torque.TorqueException,
                                              com.workingdogs.village.DataSetException,
                                              KKAdminException
Description copied from interface: AdminLanguageMgrIf
This returns an AdminLanguageSearchResult object. It allows you to search criteria for code and name and also to define whether or not you want to retrieve the display-only languages in addition to the data languages by setting the includeDisplayOnlyLangs attribute of the AdmnLanguageSearch object to true. The default behaviour is not to return the display-only languages.

Specified by:
getLanguages in interface AdminLanguageMgrIf
Returns:
Returns an AdminLanguageSearchResult object
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

deriveDataLanguage

protected void deriveDataLanguage(AdminLanguage lang)
                           throws KKAdminException
Throws:
KKAdminException

getDefaultLanguageId

public int getDefaultLanguageId()
                         throws java.lang.Exception
Description copied from interface: AdminLanguageMgrIf
Returns the default language id

Specified by:
getDefaultLanguageId in interface AdminLanguageMgrIf
Returns:
Returns the default language id
Throws:
java.lang.Exception

getDefaultLanguage

public AdminLanguage getDefaultLanguage()
                                 throws java.lang.Exception
Description copied from interface: AdminLanguageMgrIf
Returns the default language

Specified by:
getDefaultLanguage in interface AdminLanguageMgrIf
Returns:
Returns the default language object
Throws:
java.lang.Exception

getNumLanguages

public int getNumLanguages()
                    throws java.lang.Exception
Description copied from interface: AdminLanguageMgrIf
Returns the total number of languages defined for the store - it does not include the display-only languages

Specified by:
getNumLanguages in interface AdminLanguageMgrIf
Returns:
Returns the total number of languages defined for the store
Throws:
java.lang.Exception

getLanguageById

public AdminLanguage getLanguageById(int languageId)
                              throws java.lang.Exception
Description copied from interface: AdminLanguageMgrIf
Returns the language referenced by the language id

Specified by:
getLanguageById in interface AdminLanguageMgrIf
Parameters:
languageId -
Returns:
The language object with id = languageId. Null if no object is found.
Throws:
java.lang.Exception

getLanguageByCode

public AdminLanguage getLanguageByCode(java.lang.String code)
                                throws java.lang.Exception
Retrieves the language object referenced by the code (i.e. en, de, es)

Specified by:
getLanguageByCode in interface AdminLanguageMgrIf
Parameters:
code -
Returns:
Returns a language object
Throws:
java.lang.Exception

getLanguageIdForLocale

public int getLanguageIdForLocale(java.lang.String locale)
                           throws java.lang.Exception
Retrieves the language Id for the locale

Specified by:
getLanguageIdForLocale in interface AdminLanguageMgrIf
Parameters:
locale - a 2 or 4 character locale (eg. en, de, es)
Returns:
Returns the languageId of the matching language or the languageId of the default language if no matching language was found.
Throws:
java.lang.Exception

getLanguageForLocale

public AdminLanguage getLanguageForLocale(java.lang.String locale)
                                   throws java.lang.Exception
Description copied from interface: AdminLanguageMgrIf
Retrieves the language for the locale

Specified by:
getLanguageForLocale in interface AdminLanguageMgrIf
Parameters:
locale - a 2 or 4 character locale (eg. en, de, es)
Returns:
Returns the language of the matching language or the default language if no matching language was found.
Throws:
java.lang.Exception

setDefaultLanguage

public void setDefaultLanguage(java.lang.String langCode)
                        throws java.lang.Exception
Sets the default language. Sets a configuration variable called DEFAULT_LANGUAGE.

Specified by:
setDefaultLanguage in interface AdminLanguageMgrIf
Parameters:
langCode -
Throws:
java.lang.Exception

setDefaultLanguage

protected void setDefaultLanguage()
                           throws java.lang.Exception
The default language is referenced by a configuration variable called DEFAULT_LANGUAGE. If this variable isn't set, then the method returns the id of the language with the lowest sort order value. We assume that this language is the default language and will be used when no other language is specified. The default language is retrieved from the database first time round and is then stored in a static variable.

Throws:
java.lang.Exception

setNumLanguages

protected void setNumLanguages()
                        throws java.lang.Exception
The number of languages is retrieved from the database first time round and is then stored in a static variable.

Throws:
java.lang.Exception

fetchDefaultLanguage

public AdminLanguage fetchDefaultLanguage()
                                   throws java.lang.Exception
This fetches the default language regardless of whether it's already set. The default language is referenced by a configuration variable called DEFAULT_LANGUAGE. If this variable isn't set, then the method returns the id of the language with the lowest sort order value. We assume that this language is the default language and will be used when no other language is specified. The default language is retrieved from the database first time round and is then stored in a static variable.

Returns:
the Default Language
Throws:
java.lang.Exception

fetchNumLanguages

public int fetchNumLanguages()
                      throws java.lang.Exception
This fetches the number of languages from the database for the current engine/store. It does not include the display-only languages.

Returns:
the number of languages in the database for the current engine/store
Throws:
java.lang.Exception

addLanguageSearchCriteria

protected int addLanguageSearchCriteria(com.konakart.bl.KKCriteria c,
                                        AdminLanguageSearch search)
                                 throws KKAdminException
Throws:
KKAdminException

deleteLanguage

public int deleteLanguage(int langId)
                   throws KKAdminException
Delete a Language

Specified by:
deleteLanguage in interface AdminLanguageMgrIf
Parameters:
langId - A language id
Returns:
returns the id of the deleted language
Throws:
KKAdminException

insertLanguage

public int insertLanguage(AdminLanguage lang)
                   throws KKAdminException
Insert a Language

Specified by:
insertLanguage in interface AdminLanguageMgrIf
Parameters:
lang - A language object
Returns:
returns the id of the inserted language
Throws:
KKAdminException

updateLanguage

public int updateLanguage(AdminLanguage lang)
                   throws java.lang.Exception
Update a Language

Specified by:
updateLanguage in interface AdminLanguageMgrIf
Parameters:
lang - A language object
Returns:
returns the id of the updated language
Throws:
java.lang.Exception

doesLanguageExistForId

public boolean doesLanguageExistForId(int langId)
                               throws org.apache.torque.TorqueException,
                                      KKAdminException
Checks to see whether a language already exists with this id

Specified by:
doesLanguageExistForId in interface AdminLanguageMgrIf
Parameters:
langId -
Returns:
Returns true if the customer already exists
Throws:
org.apache.torque.TorqueException
KKAdminException

addOrderBy

protected void addOrderBy(com.konakart.bl.KKCriteria c,
                          AdminLanguageSearch search)
Add Order By clauses

Parameters:
c -
search -

getDefaultLocale

public java.lang.String getDefaultLocale()
                                  throws KKAdminException
Specified by:
getDefaultLocale in interface AdminLanguageMgrIf
Returns:
Returns the default locale
Throws:
KKAdminException

getDefaultLanguageCode

public java.lang.String getDefaultLanguageCode()
                                        throws KKAdminException
Specified by:
getDefaultLanguageCode in interface AdminLanguageMgrIf
Returns:
Returns the default 2-character language code
Throws:
KKAdminException

refreshConfigs

public void refreshConfigs()
                    throws java.lang.Exception
Retrieve some commonly-used properties and set the velocity log file location

Specified by:
refreshConfigs in interface AdminLanguageMgrIf
Overrides:
refreshConfigs in class AdminBaseMgr
Throws:
java.lang.Exception


Copyright © 2011 DS Data Systems UK Ltd.