|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.konakart.bl.BaseMgr
com.konakart.bl.CategoryMgr
public class CategoryMgr
Manages all business logic relevant to the management of categories within the system.
| Nested Class Summary | |
|---|---|
protected class |
CategoryMgr.StaticData
Used to store the static data of this manager |
| Field Summary | |
|---|---|
protected static org.apache.commons.logging.Log |
log
the log |
protected static java.lang.String |
mutex
|
protected static java.util.Map<java.lang.String,CategoryMgr.StaticData> |
staticDataHM
Hash Map that contains the static data |
| Fields inherited from class com.konakart.bl.BaseMgr |
|---|
templateBaseDir |
| Constructor Summary | |
|---|---|
CategoryMgr(KKEngIf eng)
Constructor |
|
| Method Summary | |
|---|---|
protected void |
fillCatTreeWithProductNumbers(Category[] catTree)
Receives an array of Categories as input and compiles the numberOfProducts field for each Category |
Category[] |
getCategoriesFromIds(java.util.ArrayList<java.lang.Integer> catIdList,
int languageId)
Return an array of categories for the ids passed in through the catIdList parameter. |
Category[] |
getCategoriesPerManufacturer(int manufacturerId,
int languageId)
Returns an array of leaf Category objects for the given manufacturer. |
Category[] |
getCategoriesPerProduct(int productId,
int languageId)
Returns an array of Category objects that the product belongs to. |
Category |
getCategory(int categoryId,
int languageId)
|
protected Category[] |
getCategoryTree(int languageId)
Calls getCategoryTree(int languageId, boolean getNumProducts) |
Category[] |
getCategoryTree(int languageId,
boolean getNumProducts)
Returns an array of top level categories each of which includes an array of child categories etc. |
protected Category[] |
getChildren(Category parent,
int languageId)
Returns an array of child categories, children of the input parameter, parent. |
int[] |
getChildren(int categoryId)
Returns an array of categoryId describing the children of the given category. |
CategoryStats |
getLastModifiedData()
Retrieves the date of the last modified category and the number of categories in the database. |
protected int |
getNumProductsPerCategory(int categoryId)
Returns the number of products for a leaf category by doing a direct query on the database. |
int[] |
getParents(int categoryId)
Returns an array of categoryId describing the given category and its parents. |
protected java.util.HashMap<java.lang.Integer,java.lang.Integer> |
getProductsPerCategory()
Returns a HashMap with CategoryId as the key and Number of Products for that category as the value. |
protected Category[] |
getTopLevelCategories(int languageId)
Returns all of the top level categories which are those that have a parentId = 0. |
protected void |
initStaticVariables(CategoryStats catStats)
A synchronized method to initialise the static variables |
protected void |
setChildrenProductNumbers(Category parent,
java.util.HashMap<java.lang.Integer,java.lang.Integer> hm)
Recurses through all of the category tree setting the numberOfProducts
attribute. |
protected void |
setCriteriaWithStandardAttributes(KKCriteria c,
int languageId)
Sets the criteria with the standard attributes so as not to have to repeat this code many times. |
protected void |
setCriteriaWithStandardAttributes(KKCriteria c,
int languageId,
boolean addDescription)
Sets the criteria with the standard attributes so as not to have to repeat this code many times. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.commons.logging.Log log
protected static java.lang.String mutex
protected static java.util.Map<java.lang.String,CategoryMgr.StaticData> staticDataHM
| Constructor Detail |
|---|
public CategoryMgr(KKEngIf eng)
throws java.lang.Exception
eng -
java.lang.Exception| Method Detail |
|---|
protected Category[] getCategoryTree(int languageId)
throws java.lang.Exception
languageId -
org.apache.torque.TorqueException
java.lang.Exception
public Category[] getCategoryTree(int languageId,
boolean getNumProducts)
throws java.lang.Exception
getNumProducts is set.
getCategoryTree in interface CategoryMgrIflanguageId - getNumProducts -
java.lang.Exception
protected void initStaticVariables(CategoryStats catStats)
throws KKException
catStats -
KKException
protected Category[] getTopLevelCategories(int languageId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException
languageId -
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
protected Category[] getChildren(Category parent,
int languageId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException
parent - languageId -
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
public Category[] getCategoriesPerManufacturer(int manufacturerId,
int languageId)
throws java.lang.Exception
getCategoriesPerManufacturer in interface CategoryMgrIfmanufacturerId - languageId -
java.lang.Exception
public Category[] getCategoriesPerProduct(int productId,
int languageId)
throws java.lang.Exception
getCategoriesPerProduct in interface CategoryMgrIfproductId - languageId -
java.lang.Exception
protected java.util.HashMap<java.lang.Integer,java.lang.Integer> getProductsPerCategory()
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException
protected int getNumProductsPerCategory(int categoryId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKException
categoryId -
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException
public CategoryStats getLastModifiedData()
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException
last_modified column doesn't contain any valid dates, then we return the current
date since we have to assume worst case that some category has been modified.
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
protected void fillCatTreeWithProductNumbers(Category[] catTree)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKException
catTree -
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKException
protected void setChildrenProductNumbers(Category parent,
java.util.HashMap<java.lang.Integer,java.lang.Integer> hm)
throws com.workingdogs.village.DataSetException
numberOfProducts
attribute.
parent - The parent category.hm -
com.workingdogs.village.DataSetException
public int[] getChildren(int categoryId)
throws java.lang.Exception
getChildren in interface CategoryMgrIfcategoryId -
java.lang.Exception
public int[] getParents(int categoryId)
throws java.lang.Exception
getParents in interface CategoryMgrIfcategoryId -
java.lang.Exception
public Category getCategory(int categoryId,
int languageId)
throws java.lang.Exception
getCategory in interface CategoryMgrIfcategoryId - languageId -
java.lang.Exception
protected void setCriteriaWithStandardAttributes(KKCriteria c,
int languageId)
c - languageId -
protected void setCriteriaWithStandardAttributes(KKCriteria c,
int languageId,
boolean addDescription)
c - languageId - addDescription -
public Category[] getCategoriesFromIds(java.util.ArrayList<java.lang.Integer> catIdList,
int languageId)
throws java.lang.Exception
getCategoriesFromIds in interface CategoryMgrIfcatIdList - An array list containing ids of categorieslanguageId -
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||