com.konakartadmin.bl
Class AdminTagMgr

java.lang.Object
  extended by com.konakartadmin.bl.AdminBaseMgr
      extended by com.konakartadmin.bl.AdminTagMgr
All Implemented Interfaces:
AdminTagMgrIf

public class AdminTagMgr
extends AdminBaseMgr
implements AdminTagMgrIf

The AdminTagMgr - for Managing Tag Objects for the Admin Application


Nested Class Summary
 
Nested classes/interfaces inherited from class com.konakartadmin.bl.AdminBaseMgr
AdminBaseMgr.StaticData
 
Field Summary
protected static org.apache.commons.logging.Log log
          the log
 
Fields inherited from class com.konakartadmin.bl.AdminBaseMgr
adminEng, baseMgrMutex, baseStaticDataHM, cDataEnd, cDataStart, kkConf, kkInstanceId, mgrFactory, STORE_ID, templateBaseDir
 
Constructor Summary
AdminTagMgr(KKAdminIf eng)
          Constructor
 
Method Summary
 void addCategoriesToTagGroups(int tagGroupId, int[] categories)
          Add the array of categories to the tagGroup specified.
protected  void addTagGroupOrderBy(com.konakart.bl.KKCriteria c, AdminSearch search)
           
protected  int addTagGroupSearchCriteria(com.konakart.bl.KKCriteria c, AdminSearch search, java.lang.String aliasPrefix)
           
 void addTagGroupsToCategory(AdminTagGroup[] tagGroups, int categoryId)
          Add the array of tagGroups to the category identified by categoryId.
protected  void addTagGroupToTagOrderBy(com.konakart.bl.KKCriteria c, AdminSearch search)
           
protected  int addTagGroupToTagSearchCriteria(com.konakart.bl.KKCriteria c, AdminSearch search)
           
protected  void addTagOrderBy(com.konakart.bl.KKCriteria c, AdminSearch search)
           
protected  int addTagSearchCriteria(com.konakart.bl.KKCriteria c, AdminSearch search)
           
 void addTagsToProduct(AdminTag[] tags, int productId)
          Add the array of tags to the product identified by productId.
 void deleteTag(java.lang.String sessionId, int id)
          Delete a Tag from the database.
 void deleteTagGroup(java.lang.String sessionId, int id)
          Delete a TagGroup from the database.
protected  boolean doesTagExist(int id)
          Return true if the tag exists.
protected  boolean doesTagExist(int id, int langId)
          Return true if the tag exists.
protected  boolean doesTagGroupExist(int id)
          Return true if the tagGroup exists.
protected  boolean doesTagGroupExist(int id, int langId)
          Return true if the tagGroup exists.
 AdminTagGroupSearchResult getTagGroups(java.lang.String sessionId, AdminSearch search, int offset, int size)
          Return the TagGroup objects defined by the search criteria.
 AdminTagGroup[] getTagGroupsPerCategory(int categoryId, int languageId)
          Return an array of AdminTagGroup objects for a category.
 AdminTagGroupToTag[] getTagGroupToTags(java.lang.String sessionId, AdminSearch search, int offset, int size)
          Return the TagGroupToTag objects defined by the search criteria.
 AdminTagSearchResult getTags(java.lang.String sessionId, AdminSearch search, int offset, int size)
          Return the Tag objects defined by the search criteria.
 int getTagsCount(AdminSearch search)
          Returns a count of the number of Tags
 AdminTag[] getTagsPerProduct(int productId, int languageId)
          Fetches all of the tags for a product.
protected  AdminTag[] getTagsPerTagGroup(int tagGroupId, int languageId)
          Fetches all of the tags for a tag group
 int insertTag(java.lang.String sessionId, AdminTag tag)
          Insert a new Tag object.
 int insertTagGroup(java.lang.String sessionId, AdminTagGroup tagGroup)
          Insert a new TagGroup object.
 int insertTagGroups(java.lang.String sessionId, AdminTagGroup[] tagGroups)
          Insert an array of TagGroup objects - provide a TagGroup object for each language
protected  void insertTagGroupToTagRecords(AdminTag tag, java.sql.Connection con)
           
protected  void insertTagGroupToTagRecords(AdminTagGroup tagGroup, java.sql.Connection con)
           
protected  void insertTagGroupToTagRecords(AdminTagGroupToTag tagGroupToTag, java.sql.Connection con)
          Insert an AdminTagGroupToTag record
 void insertTagGroupToTags(AdminTagGroupToTag tagGroupToTag)
          Insert an AdminTagGroupToTag record
 int insertTags(java.lang.String sessionId, AdminTag[] tags)
          Insert an array of Tag objects - provide a Tag record for each supported language.
 void refreshConfigs()
          Refresh the configuration of the Manager
 void removeTagGroupsFromCategory(AdminTagGroup[] tagGroups, int categoryId)
          If associations exist between the tagGroups and the category identified by categoryId, then they are removed.
 void removeTagsFromProduct(AdminTag[] tags, int productId)
          If associations exist between the tags and the product identified by productId, then they are removed.
protected  void setTagCriteriaWithStandardAttributes(com.konakart.bl.KKCriteria c, int languageId)
          Set the Criteria attribute with standard attributes for a Tag object
protected  void setTagGroupCriteriaWithStandardAttributes(com.konakart.bl.KKCriteria c, int languageId)
          Set the Criteria attribute with standard attributes for a TagGroup object
 int updateTag(java.lang.String sessionId, AdminTag tag)
          Update an existing Tag object - only the Name, the SortOrder and associated TagGroups (if present) can be updated.
 int updateTagGroup(java.lang.String sessionId, AdminTagGroup tagGroup)
          Update an existing TagGroup object - You can update the name, description and the set of tags associated to the tag group if the tags attribute is non-null.
 
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

Constructor Detail

AdminTagMgr

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

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

getTags

public AdminTagSearchResult getTags(java.lang.String sessionId,
                                    AdminSearch search,
                                    int offset,
                                    int size)
                             throws KKAdminException
Return the Tag objects defined by the search criteria. If the includeChildren attribute on the AdminSearch is true we also populate the TagGroup children on the Tag objects.

Specified by:
getTags in interface AdminTagMgrIf
Parameters:
sessionId - session Id of logged in Admin user
search - the generic Admin search object that defines the tag objects to search for. If null we use the default AdminSearch object. If you specify the LanguageId in the search object, only the tag for that specified language will be returned. If you specify AdminLanguage.ALL_LANGUAGES for the languageId the search will be made on the default language, and if tags are found, tags with these tagIds for all of the languages are returned.
offset - starting offset in database - so that you can page through results
size - size of the group that will be returned - the maximum number of records returned
Returns:
an AdminTagSearchResult object
Throws:
KKAdminException

addTagSearchCriteria

protected int addTagSearchCriteria(com.konakart.bl.KKCriteria c,
                                   AdminSearch search)
                            throws java.lang.Exception
Throws:
java.lang.Exception

addTagOrderBy

protected void addTagOrderBy(com.konakart.bl.KKCriteria c,
                             AdminSearch search)

getTagsCount

public int getTagsCount(AdminSearch search)
                 throws java.lang.Exception
Returns a count of the number of Tags

Parameters:
search - Search criteria
Returns:
A count of the number of Countries
Throws:
java.lang.Exception

getTagGroups

public AdminTagGroupSearchResult getTagGroups(java.lang.String sessionId,
                                              AdminSearch search,
                                              int offset,
                                              int size)
                                       throws KKAdminException
Return the TagGroup objects defined by the search criteria. If the includeChildren attribute on the AdminSearch is true we also populate the Tag children on the TagGroup objects.

Specified by:
getTagGroups in interface AdminTagMgrIf
Parameters:
sessionId - session Id of logged in Admin user
search - the generic Admin search object that defines the tag group objects to search for
offset - starting offset in database - so that you can page through results
size - size of the group that will be returned - the maximum number of records returned
Returns:
an AdminTagSearchResult object
Throws:
KKAdminException

addTagGroupSearchCriteria

protected int addTagGroupSearchCriteria(com.konakart.bl.KKCriteria c,
                                        AdminSearch search,
                                        java.lang.String aliasPrefix)

addTagGroupOrderBy

protected void addTagGroupOrderBy(com.konakart.bl.KKCriteria c,
                                  AdminSearch search)

insertTags

public int insertTags(java.lang.String sessionId,
                      AdminTag[] tags)
               throws java.lang.Exception
Insert an array of Tag objects - provide a Tag record for each supported language.

Specified by:
insertTags in interface AdminTagMgrIf
Parameters:
sessionId - session Id of logged in Admin user
tags - the array of AdminTag objects to insert - do not fill out the Id on these as this will be created. It is assumed that all of these tags will have the same ID, and there will be one for each language.
Returns:
the id of the AdminTag object created
Throws:
java.lang.Exception

insertTag

public int insertTag(java.lang.String sessionId,
                     AdminTag tag)
              throws java.lang.Exception
Insert a new Tag object. If associated TagGroups are included in the tag object (i.e. not null and at least one of them) these are also added to the kk_tag_group_to_tag table.

Specified by:
insertTag in interface AdminTagMgrIf
Parameters:
sessionId - session Id of logged in Admin user
tag - the new AdminTag object to insert - do not fill out the Id (unless inserting a tag for a new language) as this will be created. If the tag specifies -1 (KonakartAdminConstants.DEFAULT_LANGUAGE_ID) for the languageId, we set the id of the default language before inserting)
Returns:
the id of the AdminTag object created
Throws:
java.lang.Exception

insertTagGroupToTagRecords

protected void insertTagGroupToTagRecords(AdminTag tag,
                                          java.sql.Connection con)
                                   throws java.lang.RuntimeException,
                                          org.apache.torque.TorqueException,
                                          KKAdminException
Throws:
java.lang.RuntimeException
org.apache.torque.TorqueException
KKAdminException

insertTagGroups

public int insertTagGroups(java.lang.String sessionId,
                           AdminTagGroup[] tagGroups)
                    throws KKAdminException
Insert an array of TagGroup objects - provide a TagGroup object for each language

Specified by:
insertTagGroups in interface AdminTagMgrIf
Parameters:
sessionId - session Id of logged in Admin user
tagGroups - the new AdminTagGroup object to insert - do not fill out the Id on these as this will be created. It is assumed that all of these tagGroups will have the same ID, and there will be one for each language.
Returns:
the id of the AdminTagGroup object created
Throws:
KKAdminException

insertTagGroup

public int insertTagGroup(java.lang.String sessionId,
                          AdminTagGroup tagGroup)
                   throws KKAdminException
Insert a new TagGroup object. If associated Tags are included in the tagGroup object (i.e. not null and at least one of them) these are also added to the kk_tag_group_to_tag table.

Specified by:
insertTagGroup in interface AdminTagMgrIf
Parameters:
sessionId - session Id of logged in Admin user
tagGroup - the new AdminTagGroup object to insert - do not fill out the Id as this will be created. If the tag group specifies -1 (KonakartAdminConstants.DEFAULT_LANGUAGE_ID) for the languageId, we set the id of the default language before inserting)
Returns:
the id of the AdminTagGroup object created
Throws:
KKAdminException

insertTagGroupToTagRecords

protected void insertTagGroupToTagRecords(AdminTagGroup tagGroup,
                                          java.sql.Connection con)
                                   throws java.lang.RuntimeException,
                                          org.apache.torque.TorqueException,
                                          KKAdminException
Throws:
java.lang.RuntimeException
org.apache.torque.TorqueException
KKAdminException

insertTagGroupToTags

public void insertTagGroupToTags(AdminTagGroupToTag tagGroupToTag)
                          throws KKAdminException
Insert an AdminTagGroupToTag record

Specified by:
insertTagGroupToTags in interface AdminTagMgrIf
Parameters:
tagGroupToTag -
Throws:
KKAdminException
java.lang.RuntimeException

insertTagGroupToTagRecords

protected void insertTagGroupToTagRecords(AdminTagGroupToTag tagGroupToTag,
                                          java.sql.Connection con)
                                   throws java.lang.RuntimeException,
                                          org.apache.torque.TorqueException,
                                          KKAdminException
Insert an AdminTagGroupToTag record

Parameters:
tagGroupToTag -
con - db connection - if new, a new one is created
Throws:
java.lang.RuntimeException
org.apache.torque.TorqueException
KKAdminException

updateTag

public int updateTag(java.lang.String sessionId,
                     AdminTag tag)
              throws KKAdminException
Update an existing Tag object - only the Name, the SortOrder and associated TagGroups (if present) can be updated. If the associated TagGroups attribute is null, no changes are made to the kk_tag_group_to_tag table otherwise these are updated to match the state of the input object).

Specified by:
updateTag in interface AdminTagMgrIf
Parameters:
sessionId - session Id of logged in Admin user
tag - the AdminTag object to update
Returns:
the id of the AdminTagGroup object updated
Throws:
KKAdminException

updateTagGroup

public int updateTagGroup(java.lang.String sessionId,
                          AdminTagGroup tagGroup)
                   throws KKAdminException
Update an existing TagGroup object - You can update the name, description and the set of tags associated to the tag group if the tags attribute is non-null.

Specified by:
updateTagGroup in interface AdminTagMgrIf
Parameters:
sessionId - session Id of logged in Admin user
tagGroup - the AdminTagGroup object to update
Returns:
the id of the AdminTagGroup object updated
Throws:
KKAdminException

deleteTag

public void deleteTag(java.lang.String sessionId,
                      int id)
               throws KKAdminException
Delete a Tag from the database. This will also remove this tag from all Tag Groups that it was in.

Specified by:
deleteTag in interface AdminTagMgrIf
Parameters:
sessionId - session Id of logged in Admin user
id - the id of the AdminTag to delete
Throws:
KKAdminException

doesTagExist

protected boolean doesTagExist(int id)
                        throws org.apache.torque.TorqueException,
                               KKAdminException
Return true if the tag exists.

Parameters:
id - tag id
Returns:
True if the tag exists otherwise false
Throws:
org.apache.torque.TorqueException
KKAdminException

doesTagExist

protected boolean doesTagExist(int id,
                               int langId)
                        throws org.apache.torque.TorqueException,
                               KKAdminException
Return true if the tag exists.

Parameters:
id - tag id
langId - language id
Returns:
True if the tag exists otherwise false
Throws:
org.apache.torque.TorqueException
KKAdminException

deleteTagGroup

public void deleteTagGroup(java.lang.String sessionId,
                           int id)
                    throws KKAdminException
Delete a TagGroup from the database.

Specified by:
deleteTagGroup in interface AdminTagMgrIf
Parameters:
sessionId - session Id of logged in Admin user
id - the id of the AdminTagGroup to delete
Throws:
KKAdminException

doesTagGroupExist

protected boolean doesTagGroupExist(int id)
                             throws org.apache.torque.TorqueException,
                                    KKAdminException
Return true if the tagGroup exists.

Parameters:
id - tagGroup id
Returns:
True if the tagGroup exists otherwise false
Throws:
org.apache.torque.TorqueException
KKAdminException

doesTagGroupExist

protected boolean doesTagGroupExist(int id,
                                    int langId)
                             throws org.apache.torque.TorqueException,
                                    KKAdminException
Return true if the tagGroup exists.

Parameters:
id - tagGroup id
langId - language id
Returns:
True if the tagGroup exists otherwise false
Throws:
org.apache.torque.TorqueException
KKAdminException

getTagGroupsPerCategory

public AdminTagGroup[] getTagGroupsPerCategory(int categoryId,
                                               int languageId)
                                        throws java.lang.Exception
Return an array of AdminTagGroup objects for a category. Each TagGroup is populated with an array of AdminTags which are sorted first by sort order and then by name. An empty array is returned if no TagGroup objects exist.

Specified by:
getTagGroupsPerCategory in interface AdminTagMgrIf
Parameters:
categoryId -
languageId -
Returns:
Returns an array of AdminTag groups
Throws:
java.lang.Exception

setTagGroupCriteriaWithStandardAttributes

protected void setTagGroupCriteriaWithStandardAttributes(com.konakart.bl.KKCriteria c,
                                                         int languageId)
Set the Criteria attribute with standard attributes for a TagGroup object

Parameters:
c -
languageId -

setTagCriteriaWithStandardAttributes

protected void setTagCriteriaWithStandardAttributes(com.konakart.bl.KKCriteria c,
                                                    int languageId)
Set the Criteria attribute with standard attributes for a Tag object

Parameters:
c -
languageId -

getTagsPerTagGroup

protected AdminTag[] getTagsPerTagGroup(int tagGroupId,
                                        int languageId)
                                 throws com.workingdogs.village.DataSetException,
                                        org.apache.torque.TorqueException,
                                        KKAdminException
Fetches all of the tags for a tag group

Parameters:
tagGroupId -
languageId -
Returns:
Returns all of the tags for a tag group
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKAdminException

addTagGroupsToCategory

public void addTagGroupsToCategory(AdminTagGroup[] tagGroups,
                                   int categoryId)
                            throws org.apache.torque.TorqueException,
                                   com.workingdogs.village.DataSetException,
                                   KKAdminException
Add the array of tagGroups to the category identified by categoryId. We assume that the category and the tag groups already exist in the database since this method inserts an association between a tag groups and a category rather than the actual objects.

Specified by:
addTagGroupsToCategory in interface AdminTagMgrIf
Parameters:
tagGroups -
categoryId -
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

addCategoriesToTagGroups

public void addCategoriesToTagGroups(int tagGroupId,
                                     int[] categories)
                              throws org.apache.torque.TorqueException,
                                     KKAdminException
Add the array of categories to the tagGroup specified. It is assumed that the categories and the tag group already exist in the database since this method inserts associations between a tag group and the specified categories rather than the actual objects.

Specified by:
addCategoriesToTagGroups in interface AdminTagMgrIf
Parameters:
tagGroupId - the tag group Id to link to the categories
categories - an array of category Ids to link to the Tag Group
Throws:
org.apache.torque.TorqueException
KKAdminException

removeTagGroupsFromCategory

public void removeTagGroupsFromCategory(AdminTagGroup[] tagGroups,
                                        int categoryId)
                                 throws org.apache.torque.TorqueException,
                                        KKAdminException
If associations exist between the tagGroups and the category identified by categoryId, then they are removed. If tagGroups is set to null, all associations to the category are removed.

Specified by:
removeTagGroupsFromCategory in interface AdminTagMgrIf
Parameters:
tagGroups -
categoryId -
Throws:
org.apache.torque.TorqueException
KKAdminException

getTagsPerProduct

public AdminTag[] getTagsPerProduct(int productId,
                                    int languageId)
                             throws java.lang.Exception
Fetches all of the tags for a product.

Specified by:
getTagsPerProduct in interface AdminTagMgrIf
Parameters:
productId -
languageId -
Returns:
Returns an array of Admin Tag objects
Throws:
java.lang.Exception

addTagsToProduct

public void addTagsToProduct(AdminTag[] tags,
                             int productId)
                      throws org.apache.torque.TorqueException,
                             KKAdminException
Add the array of tags to the product identified by productId. We assume that the product and the tags already exist in the database since this method inserts an association between a tag and a product rather than the actual objects.

Specified by:
addTagsToProduct in interface AdminTagMgrIf
Parameters:
tags -
productId -
Throws:
org.apache.torque.TorqueException
KKAdminException

removeTagsFromProduct

public void removeTagsFromProduct(AdminTag[] tags,
                                  int productId)
                           throws org.apache.torque.TorqueException,
                                  KKAdminException
If associations exist between the tags and the product identified by productId, then they are removed. If tags is set to null, all associations to the product are removed.

Specified by:
removeTagsFromProduct in interface AdminTagMgrIf
Parameters:
tags -
productId -
Throws:
org.apache.torque.TorqueException
KKAdminException

refreshConfigs

public void refreshConfigs()
                    throws java.lang.Exception
Refresh the configuration of the Manager

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

getTagGroupToTags

public AdminTagGroupToTag[] getTagGroupToTags(java.lang.String sessionId,
                                              AdminSearch search,
                                              int offset,
                                              int size)
                                       throws KKAdminException
Return the TagGroupToTag objects defined by the search criteria.

Specified by:
getTagGroupToTags in interface AdminTagMgrIf
Parameters:
sessionId - session Id of logged in Admin user
search - the generic Admin search object that defines the tag objects to search for. If null we use the default AdminSearch object. If id is not -1 this is used to define the tag Group Id. If id2 is not -1 this is used to define the tag Id.
offset - starting offset in database - so that you can page through results
size - size of the group that will be returned - the maximum number of records returned
Returns:
an array of AdminTagGroupToTag records
Throws:
KKAdminException

addTagGroupToTagSearchCriteria

protected int addTagGroupToTagSearchCriteria(com.konakart.bl.KKCriteria c,
                                             AdminSearch search)

addTagGroupToTagOrderBy

protected void addTagGroupToTagOrderBy(com.konakart.bl.KKCriteria c,
                                       AdminSearch search)


Copyright © 2011 DS Data Systems UK Ltd.