com.konakartadmin.bl
Class AdminProductAttrMgr

java.lang.Object
  extended by com.konakartadmin.bl.AdminBaseMgr
      extended by com.konakartadmin.bl.AdminProductAttrMgr
All Implemented Interfaces:
AdminProdAttrMgrIf

public class AdminProductAttrMgr
extends AdminBaseMgr
implements AdminProdAttrMgrIf

The AdminProductAttrMgr - for managing custom product attributes


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
AdminProductAttrMgr(KKAdminIf eng)
          Constructor
 
Method Summary
protected  void addProdAttrDescOrderBy(com.konakart.bl.KKCriteria c, AdminProdAttrDescSearch search)
          Add order by constraints for AdminProdAttrDescs
protected  int addProdAttrDescSearchCriteria(com.konakart.bl.KKCriteria c, AdminProdAttrDescSearch search)
          Add search criteria for ProdAttrDescs
 void addProdAttrDescsToTemplate(AdminProdAttrDesc[] attrDescs, int templateId)
          Add the array of ProdAttrDesc objects to the template.
protected  void addProdAttrTemplateOrderBy(com.konakart.bl.KKCriteria c, AdminProdAttrTemplateSearch search)
          Add order by constraints for AdminProdAttrTemplates
protected  int addProdAttrTemplateSearchCriteria(com.konakart.bl.KKCriteria c, AdminProdAttrTemplateSearch search)
          Add search criteria for ProdAttrTemplates
 int deleteProdAttrDesc(int id)
          Delete an AdminProdAttrDesc
 int deleteProdAttrTemplate(int id)
          Delete an AdminProdAttrTemplate
 AdminProdAttrDesc[] getCustomAttrsFromXML(java.lang.String xml)
          Create an array of custom attributes from the XML
 AdminProdAttrDesc getProdAttrDesc(int id)
          Returns the AdminProdAttrDesc object for the id parameter, or Null if the AdminProdAttrDesc doesn't exist in the DB.
protected  int getProdAttrDescCount(AdminProdAttrDescSearch search)
          Returns a count of the number of ProdAttrDescs
 AdminProdAttrDescSearchResult getProdAttrDescs(AdminProdAttrDescSearch search, int offset, int size)
          This returns an AdminProdAttrDescSearchResult object.
 AdminProdAttrDesc[] getProdAttrDescsForTemplate(int templateId)
          This method fetches all of the AdminProdAttrDesc objects for the template referenced by the templateId parameter.
 AdminProdAttrTemplate getProdAttrTemplate(int id)
          Returns the AdminProdAttrTemplate object for the id parameter, or Null if the AdminProdAttrTemplate doesn't exist in the DB.
protected  int getProdAttrTemplateCount(AdminProdAttrTemplateSearch search)
          Returns a count of the number of ProdAttrTemplates
 AdminProdAttrTemplateSearchResult getProdAttrTemplates(AdminProdAttrTemplateSearch search, int offset, int size)
          This returns an AdminProdAttrTemplateSearchResult object.
 int getProductCountPerProdAttrDesc(int attrDescId)
          Returns the number of products using the product attribute descriptor
 int getProductCountPerTemplate(int templateId)
          Returns the number of products using the custom product attribute template
 int getTemplateCountPerProdAttrDesc(int attrDescId)
          Returns the number of templates using the product attribute descriptor
 java.lang.String getXMLFromCustomAttrs(AdminProdAttrDesc[] attrDescArray)
          Create an XML structure for the custom attributes
 int insertProdAttrDesc(AdminProdAttrDesc attrDesc)
          An AdminProdAttrDesc object is inserted into the database.
 int insertProdAttrTemplate(AdminProdAttrTemplate template)
          An AdminProdAttrTemplate object is inserted into the database.
 void removeProdAttrDescsFromTemplate(AdminProdAttrDesc[] attrDescs, int templateId)
          Remove an array of ProdAttrDesc objects from the template
protected  void setProdAttrDescCriteriaWithStandardAttributes(com.konakart.bl.KKCriteria c)
          Common code to avoid duplication
protected  void setProdAttrTemplateCriteriaWithStandardAttributes(com.konakart.bl.KKCriteria c)
          Common code to avoid duplication
 int updateProdAttrDesc(AdminProdAttrDesc attrDesc)
          Update an AdminProdAttrDesc object.
 int updateProdAttrTemplate(AdminProdAttrTemplate template)
          Update an AdminProdAttrTemplate object.
 int updateProductsUsingProdAttrDesc(int attrDescId)
          Loop through all templates containing the custom attribute.
 int updateProductsUsingTemplates(int[] templateIds)
          For each template, loop through the products and update the custom fields.
 
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
 

Field Detail

log

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

Constructor Detail

AdminProductAttrMgr

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

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

insertProdAttrDesc

public int insertProdAttrDesc(AdminProdAttrDesc attrDesc)
                       throws KKAdminException,
                              org.apache.torque.TorqueException
An AdminProdAttrDesc object is inserted into the database. The following attributes are compulsory: The id of the new object is returned.

Specified by:
insertProdAttrDesc in interface AdminProdAttrMgrIf
Parameters:
attrDesc -
Returns:
Returns the id of the ProdAttrDesc object
Throws:
KKAdminException
org.apache.torque.TorqueException

updateProdAttrDesc

public int updateProdAttrDesc(AdminProdAttrDesc attrDesc)
                       throws KKAdminException,
                              org.apache.torque.TorqueException,
                              com.workingdogs.village.DataSetException
Update an AdminProdAttrDesc object. If the value of an attribute is null, the current value is not updated.

Specified by:
updateProdAttrDesc in interface AdminProdAttrMgrIf
Parameters:
attrDesc - An AdminProdAttrDesc object
Returns:
returns the id of the updated AdminProdAttrDesc object
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

deleteProdAttrDesc

public int deleteProdAttrDesc(int id)
                       throws KKAdminException,
                              org.apache.torque.TorqueException
Delete an AdminProdAttrDesc

Specified by:
deleteProdAttrDesc in interface AdminProdAttrMgrIf
Parameters:
id - The id of the deleted AdminProdAttrDesc object
Returns:
Returns the id of the deleted AdminProdAttrDesc object
Throws:
KKAdminException
org.apache.torque.TorqueException

getProdAttrDesc

public AdminProdAttrDesc getProdAttrDesc(int id)
                                  throws KKAdminException,
                                         org.apache.torque.TorqueException,
                                         com.workingdogs.village.DataSetException
Returns the AdminProdAttrDesc object for the id parameter, or Null if the AdminProdAttrDesc doesn't exist in the DB.

Specified by:
getProdAttrDesc in interface AdminProdAttrMgrIf
Parameters:
id -
Returns:
Returns a AdminProdAttrDesc object
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getProdAttrDescsForTemplate

public AdminProdAttrDesc[] getProdAttrDescsForTemplate(int templateId)
                                                throws org.apache.torque.TorqueException,
                                                       KKAdminException,
                                                       com.workingdogs.village.DataSetException
This method fetches all of the AdminProdAttrDesc objects for the template referenced by the templateId parameter.

An empty array is returned if no AdminProdAttrDesc objects exist.

Specified by:
getProdAttrDescsForTemplate in interface AdminProdAttrMgrIf
Parameters:
templateId -
Returns:
Returns an array of AdminProdAttrDesc objects
Throws:
org.apache.torque.TorqueException
KKAdminException
com.workingdogs.village.DataSetException

getProdAttrDescs

public AdminProdAttrDescSearchResult getProdAttrDescs(AdminProdAttrDescSearch search,
                                                      int offset,
                                                      int size)
                                               throws org.apache.torque.TorqueException,
                                                      com.workingdogs.village.DataSetException,
                                                      KKAdminException
This returns an AdminProdAttrDescSearchResult object.

Specified by:
getProdAttrDescs in interface AdminProdAttrMgrIf
Parameters:
search -
offset - the offset in the db
size - the number of records from the specified offset
Returns:
Returns an AdminProdAttrDescSearchResult object
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKAdminException

addProdAttrDescOrderBy

protected void addProdAttrDescOrderBy(com.konakart.bl.KKCriteria c,
                                      AdminProdAttrDescSearch search)
Add order by constraints for AdminProdAttrDescs

Parameters:
c -
search -

getProdAttrDescCount

protected int getProdAttrDescCount(AdminProdAttrDescSearch search)
                            throws org.apache.torque.TorqueException,
                                   com.workingdogs.village.DataSetException,
                                   KKAdminException
Returns a count of the number of ProdAttrDescs

Parameters:
search - Search criteria
Returns:
A count of the number of ProdAttrDescs
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

addProdAttrDescSearchCriteria

protected int addProdAttrDescSearchCriteria(com.konakart.bl.KKCriteria c,
                                            AdminProdAttrDescSearch search)
Add search criteria for ProdAttrDescs

Parameters:
c -
search -
Returns:
Returns the number of constraints added

setProdAttrDescCriteriaWithStandardAttributes

protected void setProdAttrDescCriteriaWithStandardAttributes(com.konakart.bl.KKCriteria c)
Common code to avoid duplication

Parameters:
c -

insertProdAttrTemplate

public int insertProdAttrTemplate(AdminProdAttrTemplate template)
                           throws KKAdminException,
                                  org.apache.torque.TorqueException
An AdminProdAttrTemplate object is inserted into the database. The following attributes are compulsory: The id of the new object is returned.

Specified by:
insertProdAttrTemplate in interface AdminProdAttrMgrIf
Parameters:
template -
Returns:
Returns the id of the ProdAttrTemplate object
Throws:
KKAdminException
org.apache.torque.TorqueException

updateProdAttrTemplate

public int updateProdAttrTemplate(AdminProdAttrTemplate template)
                           throws KKAdminException,
                                  org.apache.torque.TorqueException,
                                  com.workingdogs.village.DataSetException
Update an AdminProdAttrTemplate object. If the value of an attribute is null, the current value is not updated.

Specified by:
updateProdAttrTemplate in interface AdminProdAttrMgrIf
Parameters:
template - An AdminProdAttrTemplate object
Returns:
returns the id of the updated AdminProdAttrTemplate object
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

deleteProdAttrTemplate

public int deleteProdAttrTemplate(int id)
                           throws KKAdminException,
                                  org.apache.torque.TorqueException
Delete an AdminProdAttrTemplate

Specified by:
deleteProdAttrTemplate in interface AdminProdAttrMgrIf
Parameters:
id - The id of the deleted AdminProdAttrTemplate object
Returns:
Returns the id of the deleted AdminProdAttrTemplate object
Throws:
KKAdminException
org.apache.torque.TorqueException

getProdAttrTemplate

public AdminProdAttrTemplate getProdAttrTemplate(int id)
                                          throws KKAdminException,
                                                 org.apache.torque.TorqueException,
                                                 com.workingdogs.village.DataSetException
Returns the AdminProdAttrTemplate object for the id parameter, or Null if the AdminProdAttrTemplate doesn't exist in the DB. If the Template contains an array of ProdAttrDesc objects, these are also fetched from the DB.

Specified by:
getProdAttrTemplate in interface AdminProdAttrMgrIf
Parameters:
id -
Returns:
Returns a AdminProdAttrTemplate object
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getProdAttrTemplates

public AdminProdAttrTemplateSearchResult getProdAttrTemplates(AdminProdAttrTemplateSearch search,
                                                              int offset,
                                                              int size)
                                                       throws org.apache.torque.TorqueException,
                                                              com.workingdogs.village.DataSetException,
                                                              KKAdminException
This returns an AdminProdAttrTemplateSearchResult object.

Specified by:
getProdAttrTemplates in interface AdminProdAttrMgrIf
Parameters:
search -
offset - the offset in the db
size - the number of records from the specified offset
Returns:
Returns an AdminProdAttrTemplateSearchResult object
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKAdminException

addProdAttrTemplateOrderBy

protected void addProdAttrTemplateOrderBy(com.konakart.bl.KKCriteria c,
                                          AdminProdAttrTemplateSearch search)
Add order by constraints for AdminProdAttrTemplates

Parameters:
c -
search -

getProdAttrTemplateCount

protected int getProdAttrTemplateCount(AdminProdAttrTemplateSearch search)
                                throws org.apache.torque.TorqueException,
                                       com.workingdogs.village.DataSetException,
                                       KKAdminException
Returns a count of the number of ProdAttrTemplates

Parameters:
search - Search criteria
Returns:
A count of the number of ProdAttrTemplates
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

addProdAttrTemplateSearchCriteria

protected int addProdAttrTemplateSearchCriteria(com.konakart.bl.KKCriteria c,
                                                AdminProdAttrTemplateSearch search)
Add search criteria for ProdAttrTemplates

Parameters:
c -
search -
Returns:
Returns the number of constraints added

setProdAttrTemplateCriteriaWithStandardAttributes

protected void setProdAttrTemplateCriteriaWithStandardAttributes(com.konakart.bl.KKCriteria c)
Common code to avoid duplication

Parameters:
c -

addProdAttrDescsToTemplate

public void addProdAttrDescsToTemplate(AdminProdAttrDesc[] attrDescs,
                                       int templateId)
                                throws org.apache.torque.TorqueException,
                                       KKAdminException
Add the array of ProdAttrDesc objects to the template. We assume that the ProdAttrDesc objects have already been inserted.

Specified by:
addProdAttrDescsToTemplate in interface AdminProdAttrMgrIf
Parameters:
attrDescs -
templateId -
Throws:
org.apache.torque.TorqueException
KKAdminException

removeProdAttrDescsFromTemplate

public void removeProdAttrDescsFromTemplate(AdminProdAttrDesc[] attrDescs,
                                            int templateId)
                                     throws org.apache.torque.TorqueException,
                                            KKAdminException
Remove an array of ProdAttrDesc objects from the template

Specified by:
removeProdAttrDescsFromTemplate in interface AdminProdAttrMgrIf
Parameters:
attrDescs -
templateId -
Throws:
org.apache.torque.TorqueException
KKAdminException

getTemplateCountPerProdAttrDesc

public int getTemplateCountPerProdAttrDesc(int attrDescId)
                                    throws com.workingdogs.village.DataSetException,
                                           KKAdminException,
                                           org.apache.torque.TorqueException
Returns the number of templates using the product attribute descriptor

Specified by:
getTemplateCountPerProdAttrDesc in interface AdminProdAttrMgrIf
Parameters:
attrDescId -
Returns:
Return the number of templates using the product attribute descriptor
Throws:
com.workingdogs.village.DataSetException
KKAdminException
org.apache.torque.TorqueException

getProductCountPerProdAttrDesc

public int getProductCountPerProdAttrDesc(int attrDescId)
                                   throws com.workingdogs.village.DataSetException,
                                          KKAdminException,
                                          org.apache.torque.TorqueException
Returns the number of products using the product attribute descriptor

Specified by:
getProductCountPerProdAttrDesc in interface AdminProdAttrMgrIf
Parameters:
attrDescId -
Returns:
Return the number of products using the product attribute descriptor
Throws:
com.workingdogs.village.DataSetException
KKAdminException
org.apache.torque.TorqueException

updateProductsUsingProdAttrDesc

public int updateProductsUsingProdAttrDesc(int attrDescId)
                                    throws java.lang.Exception
Loop through all templates containing the custom attribute. For each template, loop through the products and update the custom fields.

Specified by:
updateProductsUsingProdAttrDesc in interface AdminProdAttrMgrIf
Parameters:
attrDescId -
Returns:
Returns the number of products updated
Throws:
java.lang.Exception

updateProductsUsingTemplates

public int updateProductsUsingTemplates(int[] templateIds)
                                 throws java.lang.Exception
For each template, loop through the products and update the custom fields.

Specified by:
updateProductsUsingTemplates in interface AdminProdAttrMgrIf
Parameters:
templateIds -
Returns:
Returns the number of products updated
Throws:
java.lang.Exception

getProductCountPerTemplate

public int getProductCountPerTemplate(int templateId)
                               throws com.workingdogs.village.DataSetException,
                                      KKAdminException,
                                      org.apache.torque.TorqueException
Returns the number of products using the custom product attribute template

Specified by:
getProductCountPerTemplate in interface AdminProdAttrMgrIf
Parameters:
templateId -
Returns:
Return the number of products using the custom product attribute template
Throws:
com.workingdogs.village.DataSetException
KKAdminException
org.apache.torque.TorqueException

getXMLFromCustomAttrs

public java.lang.String getXMLFromCustomAttrs(AdminProdAttrDesc[] attrDescArray)
Create an XML structure for the custom attributes

Specified by:
getXMLFromCustomAttrs in interface AdminProdAttrMgrIf
Parameters:
attrDescArray - Array of custom attributes
Returns:
Returns an XML structure

getCustomAttrsFromXML

public AdminProdAttrDesc[] getCustomAttrsFromXML(java.lang.String xml)
Create an array of custom attributes from the XML

Specified by:
getCustomAttrsFromXML in interface AdminProdAttrMgrIf
Parameters:
xml - The custom attribute data in xml format
Returns:
Returns an array of AdminProdAttrDesc objects


Copyright © 2011 DS Data Systems UK Ltd.