com.konakart.blif
Interface CategoryMgrIf

All Known Implementing Classes:
CategoryMgr

public interface CategoryMgrIf

CategoryMgrIf Interface which an implementation of this manager must adhere to.


Method Summary
 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)
           
 Category[] getCategoryTree(int languageId, boolean getNumProducts)
          Returns an array of top level categories each of which includes an array of child categories etc.
 int[] getChildren(int categoryId)
          Returns an array of categoryId describing the children of the given category.
 int[] getParents(int categoryId)
          Returns an array of categoryId describing the given category and its parents.
 

Method Detail

getCategoryTree

Category[] getCategoryTree(int languageId,
                           boolean getNumProducts)
                           throws java.lang.Exception
Returns an array of top level categories each of which includes an array of child categories etc. so that the category tree structure can be navigated. Since the categories are not changed very often and the process of building the tree requires the execution of many database queries, we keep a static version of the tree which is only changed if we realise that a category has been modified by looking at the last_modified field. Since a category may also be deleted, we look at the number of categories also to see whether it has changed.

Each Category class contains a field that describes how many products exist for that category. This field is not set in the static tree and we calculate it each time on demand since it only involves one database query and the product information is a lot more dynamic than that of the categories. We only calculate it if getNumProducts is set.

Parameters:
languageId -
getNumProducts -
Returns:
Array of Category Objects
Throws:
java.lang.Exception

getCategoriesPerManufacturer

Category[] getCategoriesPerManufacturer(int manufacturerId,
                                        int languageId)
                                        throws java.lang.Exception
Returns an array of leaf Category objects for the given manufacturer.

Parameters:
manufacturerId -
languageId -
Returns:
Return an array of category objects
Throws:
java.lang.Exception

getChildren

int[] getChildren(int categoryId)
                  throws java.lang.Exception
Returns an array of categoryId describing the children of the given category. Returns null if there are no children.

Parameters:
categoryId -
Returns:
Return an array of categoryId
Throws:
java.lang.Exception

getParents

int[] getParents(int categoryId)
                 throws java.lang.Exception
Returns an array of categoryId describing the given category and its parents. Returns just the given category id in the array if there are no parents (i.e. It is a top level node).

Parameters:
categoryId -
Returns:
Return an array of categoryId
Throws:
java.lang.Exception

getCategory

Category getCategory(int categoryId,
                     int languageId)
                     throws java.lang.Exception
Parameters:
categoryId -
languageId -
Returns:
Return a fully populated single category object (no children)
Throws:
java.lang.Exception

getCategoriesPerProduct

Category[] getCategoriesPerProduct(int productId,
                                   int languageId)
                                   throws java.lang.Exception
Returns an array of Category objects that the product belongs to.

Parameters:
productId -
languageId -
Returns:
Return an array of category objects
Throws:
java.lang.Exception

getCategoriesFromIds

Category[] getCategoriesFromIds(java.util.ArrayList<java.lang.Integer> catIdList,
                                int languageId)
                                throws java.lang.Exception
Return an array of categories for the ids passed in through the catIdList parameter.

Parameters:
catIdList - An array list containing ids of categories
languageId -
Returns:
An array of categories for the ids passed in
Throws:
java.lang.Exception


Copyright © 2011 DS Data Systems UK Ltd.