org.infoglue.cms.controllers.kernel.impl.simple
Class CategoryController

java.lang.Object
  |
  +--org.infoglue.cms.controllers.kernel.impl.simple.BaseController
        |
        +--org.infoglue.cms.controllers.kernel.impl.simple.CategoryController

public class CategoryController
extends BaseController

The CategoryController manages all actions related to persistence and querying for Categories. TODO: When we convert have Hibernate manage all of these relationships, it will pull it TODO: all back with one query and be a helluva lot faster than this pasic implementation

Author:
Frank Febbraro (frank@phase2technology.com)

Method Summary
 void delete(java.lang.Integer id)
          Deletes a CategoryVO, and all children.
 java.util.List findActiveByParent(java.lang.Integer parentId)
          Find a List of active Categories by parent.
 java.util.List findAllActiveCategories()
          Find a list of all Categories in the system.
 java.util.List findAllActiveChildren(java.lang.Integer parentId)
          Finds all children for a given parent id, recursively until no children are found.
 CategoryVO findById(java.lang.Integer id)
          Find a Category by it's identifier.
 Category findById(java.lang.Integer id, org.exolab.castor.jdo.Database db)
          Find a Category by it's identifier.
 java.util.List findByParent(java.lang.Integer parentId)
          Find a List of Categories by parent.
 CategoryVO findByPath(java.lang.String path)
          Find a Category by it's name path.
 java.util.List findRootCategories()
          Find a List of Categories that have no parent.
 CategoryVO findWithChildren(java.lang.Integer id)
          Find a Category with it's children populated.
 java.util.List getAuthorizedActiveChildren(java.lang.Integer parentId, InfoGluePrincipal infogluePrincipal)
          Finds all authorized categories parent id, recursively until no children are found.
static CategoryController getController()
           
 boolean getIsAccessApproved(java.lang.Integer categoryId, InfoGluePrincipal infoGluePrincipal)
          This method returns true if the user should have access to the contentTypeDefinition sent in.
 BaseEntityVO getNewVO()
          Implemented for BaseController
 CategoryVO moveCategory(java.lang.Integer categoryId, java.lang.Integer newParentId)
          Moves a CategoryVO to a different parent category
 CategoryVO save(CategoryVO c)
          Saves a CategoryVO whether it is new or not.
 
Methods inherited from class org.infoglue.cms.controllers.kernel.impl.simple.BaseController
deleteEntity, deleteEntity, deleteEntity, getAllVOObjects, getAllVOObjects, getAllVOObjects, getAllVOObjects, getVOWithId, getVOWithId, getVOWithId, toModifiableVOList, toVOList, updateEntity, updateEntity, updateEntity, validateEntity
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getController

public static CategoryController getController()

findById

public CategoryVO findById(java.lang.Integer id)
                    throws SystemException
Find a Category by it's identifier.

Parameters:
id - The id of the Category to find
Returns:
The CategoryVO identified by the provided id
Throws:
SystemException - If an error happens

findById

public Category findById(java.lang.Integer id,
                         org.exolab.castor.jdo.Database db)
                  throws SystemException
Find a Category by it's identifier.

Parameters:
id - The id of the Category to find
Returns:
The Category identified by the provided id
Throws:
SystemException - If an error happens

findByPath

public CategoryVO findByPath(java.lang.String path)
                      throws SystemException
Find a Category by it's name path.

Parameters:
path - The path of the Category to find in the form /categoryName/categoryName/categoryName
Returns:
The CategoryVO identified by the provided path
Throws:
SystemException - If an error happens

findByParent

public java.util.List findByParent(java.lang.Integer parentId)
                            throws SystemException
Find a List of Categories by parent.

Parameters:
parentId - The parent id of the Category to find
Returns:
A list of CategoryVOs that have the provided parentId
Throws:
SystemException - If an error happens

findActiveByParent

public java.util.List findActiveByParent(java.lang.Integer parentId)
                                  throws SystemException
Find a List of active Categories by parent.

Parameters:
parentId - The parent id of the Category to find
Returns:
A list of CategoryVOs that have the provided parentId
Throws:
SystemException - If an error happens

findWithChildren

public CategoryVO findWithChildren(java.lang.Integer id)
                            throws SystemException
Find a Category with it's children populated.

Parameters:
id - The id of the Category to find
Returns:
A list of CategoryVOs that are at the root of the category tree
Throws:
SystemException - If an error happens

findRootCategories

public java.util.List findRootCategories()
                                  throws SystemException
Find a List of Categories that have no parent.

Returns:
A list of CategoryVOs that are at the root of the category tree
Throws:
SystemException - If an error happens

findAllActiveCategories

public java.util.List findAllActiveCategories()
                                       throws SystemException
Find a list of all Categories in the system.

Returns:
A list of CategoryVOs starting at the root of the category tree
Throws:
SystemException - If an error happens

getAuthorizedActiveChildren

public java.util.List getAuthorizedActiveChildren(java.lang.Integer parentId,
                                                  InfoGluePrincipal infogluePrincipal)
                                           throws SystemException
Finds all authorized categories parent id, recursively until no children are found.

Returns:
A list of children nodes, with thier children populated
SystemException

findAllActiveChildren

public java.util.List findAllActiveChildren(java.lang.Integer parentId)
                                     throws SystemException
Finds all children for a given parent id, recursively until no children are found.

Returns:
A list of children nodes, with thier children populated
SystemException

save

public CategoryVO save(CategoryVO c)
                throws SystemException
Saves a CategoryVO whether it is new or not.

Parameters:
c - The CategoryVO to save
Returns:
The saved CategoryVO
Throws:
SystemException - If an error happens

moveCategory

public CategoryVO moveCategory(java.lang.Integer categoryId,
                               java.lang.Integer newParentId)
                        throws SystemException
Moves a CategoryVO to a different parent category

Parameters:
categoryId - The id of the CategoryVO to move
newParentId - The id of the parent to move the CategoryVO
Returns:
The saved CategoryVO
Throws:
SystemException - If an error happens

delete

public void delete(java.lang.Integer id)
            throws SystemException
Deletes a CategoryVO, and all children. TODO: The reason we delete the ContentCategory first is that once the Category TODO: is gone, Castor will never find them again. When we move to Hibernate we TODO: can probalby put this afterwards, in it's more logical place.

Parameters:
id - The id of the Category to delete
Throws:
SystemException - If an error happens

getNewVO

public BaseEntityVO getNewVO()
Implemented for BaseController

Specified by:
getNewVO in class BaseController

getIsAccessApproved

public boolean getIsAccessApproved(java.lang.Integer categoryId,
                                   InfoGluePrincipal infoGluePrincipal)
                            throws SystemException
This method returns true if the user should have access to the contentTypeDefinition sent in.

SystemException