com.konakart.al
Class CategoryMgr

java.lang.Object
  extended by com.konakart.al.BaseMgr
      extended by com.konakart.al.CategoryMgr

public class CategoryMgr
extends BaseMgr

Contains methods to get the category tree and manage the current category.


Field Summary
 
Fields inherited from class com.konakart.al.BaseMgr
eng, kkAppEng
 
Constructor Summary
protected CategoryMgr(com.konakart.appif.KKEngIf eng, KKAppEng kkAppEng)
          Constructor
 
Method Summary
 int createCatMenu(com.konakart.appif.CategoryIf cat, com.konakart.appif.CategoryIf selectedCat, java.util.List<com.konakart.appif.CategoryIf> catList, int foundLevel)
          This method is used to create a list of categories that can be used to create the category menu.
protected  void fetchCategoryTree()
          Fetch the category tree from the engine for all languages
 DropListElement[] getAllCatsDropList()
          This is only used for advanced product search so we can create it every time in the correct language.
 java.util.List<com.konakart.appif.CategoryIf> getCatMenuList()
          The catMenuList is used in the categories tile to display the categories.
 com.konakart.appif.CategoryIf[] getCats()
          Returns the category tree (i.e.
 com.konakart.appif.CategoryIf getCurrentCat()
          Returns the category that is currently selected in the UI.
 com.konakart.appif.CategoryIf[] getCurrentSubCats()
          Returns the sub categories of the category currently selected in the UI.
 com.konakart.appif.CategoryIf getCurrentTopCat()
          Returns the top level category for the currently selected category tree.
 java.lang.String getSHOW_COUNTS()
          Determine whether to show the number of products per category.
 boolean HasSubCats()
          Returns true if there are subcategories for the current category.
 boolean isMgrReady()
          Is the Manager Ready?
 void refreshCaches()
          Refreshes the all categories list.
 void refreshConfigs()
          Refresh the configuration variables.
 void reset()
          Puts the Category Manager back into it's original state with no categories selected
 void setCurrentCat(com.konakart.appif.CategoryIf currentCat)
          Sets the current category.
 void setCurrentCat(int catId)
          Creates a new catMenuList so that the categories tile can display the correct information.
 int setCurrentCatAndUpdateProducts1(int catId)
          Sets currentCat.
 
Methods inherited from class com.konakart.al.BaseMgr
getEng, getKkAppEng, getPages, setEng, setKkAppEng
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CategoryMgr

protected CategoryMgr(com.konakart.appif.KKEngIf eng,
                      KKAppEng kkAppEng)
               throws com.konakart.app.KKException,
                      KKAppException
Constructor

Parameters:
eng -
kkAppEng -
Throws:
KKAppException
com.konakart.app.KKException
Method Detail

refreshConfigs

public void refreshConfigs()
                    throws com.konakart.app.KKException,
                           KKAppException
Refresh the configuration variables. This is called automatically at a regular interval.

Throws:
com.konakart.app.KKException
KKAppException

refreshCaches

public void refreshCaches()
                   throws com.konakart.app.KKException,
                          KKAppException
Refreshes the all categories list. It forces a fetch of a new category tree for each language from the server.

Throws:
com.konakart.app.KKException
KKAppException

isMgrReady

public boolean isMgrReady()
Is the Manager Ready?

Overrides:
isMgrReady in class BaseMgr
Returns:
true if this manager is ready for work, otherwise returns false.

fetchCategoryTree

protected void fetchCategoryTree()
                          throws com.konakart.app.KKException,
                                 KKAppException
Fetch the category tree from the engine for all languages

Throws:
com.konakart.app.KKException
KKAppException

reset

public void reset()
Puts the Category Manager back into it's original state with no categories selected


setCurrentCatAndUpdateProducts1

public int setCurrentCatAndUpdateProducts1(int catId)
                                    throws com.konakart.app.KKException,
                                           KKAppException
Sets currentCat. If the selected category is a leaf node then the ProdContainer object is updated with the relative product and manufacturer information for the category. i.e. The manufacturers and products for that category are fetched from the server.

Parameters:
catId - The category id of the selected category
Returns:
Return the number of products found. Return a negative number if it is a category with child categories but no products of its own.
Throws:
com.konakart.app.KKException
KKAppException

createCatMenu

public int createCatMenu(com.konakart.appif.CategoryIf cat,
                         com.konakart.appif.CategoryIf selectedCat,
                         java.util.List<com.konakart.appif.CategoryIf> catList,
                         int foundLevel)
This method is used to create a list of categories that can be used to create the category menu. It is quite complicated because it is recursive and because it only has to contain the top level categories plus the tree that contains the selected category.

Parameters:
cat -
selectedCat -
catList -
foundLevel -
Returns:
The level at which the selected cat was found

setCurrentCat

public void setCurrentCat(int catId)
Creates a new catMenuList so that the categories tile can display the correct information. We do not go and get any products since this is being taken care of elsewhere. This method is called by the ProductMgr when a user selects to view the details of a product. *

Parameters:
catId - The numeric id of the current category

getSHOW_COUNTS

public java.lang.String getSHOW_COUNTS()
Determine whether to show the number of products per category. Normally called directly by the UI.

Returns:
Returns true if we should show counts. Otherwise returns false.

HasSubCats

public boolean HasSubCats()
Returns true if there are subcategories for the current category.

Returns:
Boolean to define whether subcategories exist

getCats

public com.konakart.appif.CategoryIf[] getCats()
Returns the category tree (i.e. Categories in a hierarchical tree)

Returns:
Returns an array of top level categories

getCurrentSubCats

public com.konakart.appif.CategoryIf[] getCurrentSubCats()
Returns the sub categories of the category currently selected in the UI.

Returns:
Returns the currentSubCats.

getCurrentCat

public com.konakart.appif.CategoryIf getCurrentCat()
Returns the category that is currently selected in the UI.

Returns:
Returns the currentCat.

setCurrentCat

public void setCurrentCat(com.konakart.appif.CategoryIf currentCat)
Sets the current category.

Parameters:
currentCat - The currentCat to set.

getCurrentTopCat

public com.konakart.appif.CategoryIf getCurrentTopCat()
Returns the top level category for the currently selected category tree.

Returns:
Returns the currentTopCat.

getCatMenuList

public java.util.List<com.konakart.appif.CategoryIf> getCatMenuList()
The catMenuList is used in the categories tile to display the categories.

Returns:
Returns the catMenuList.

getAllCatsDropList

public DropListElement[] getAllCatsDropList()
This is only used for advanced product search so we can create it every time in the correct language.

Returns:
Returns the static list of drop list elements.


Copyright © 2011 DS Data Systems UK Ltd.