za.org.coefficient.modules.category
Class CategoryManagement

java.lang.Object
  extended by za.org.coefficient.modules.BaseModule
      extended by za.org.coefficient.modules.category.CategoryManagement
All Implemented Interfaces:
CoefficientEventPublisher, ModuleLocal

public class CategoryManagement
extends BaseModule

Author:
Laurie Butgerite

Field Summary
 java.lang.String ACTION
           
 java.lang.String ADD
           
 java.lang.String ADDPAGE
           
 java.lang.String ALL
           
 java.lang.String CATDISP
           
 java.lang.String CATEGORY
           
 java.lang.String CHILDID
           
 java.lang.String CLOSE
           
 java.lang.String DELETE
           
 java.lang.String DESCRIPTION
           
 java.lang.String EDIT
           
 java.lang.String ERROR
           
 java.lang.String GET
           
 java.lang.String ID
           
 java.lang.String INDEXPAGE
           
(package private)  java.lang.String[] interpretOpRoles
           
 java.lang.String LIST
           
 java.lang.String LISTPAGE
           
 java.lang.String MODULE
           
 java.lang.String MSG
           
 java.lang.String NAME
           
 java.lang.String OP
           
 java.lang.String OPEN
           
 java.lang.String PARENT
           
 java.lang.String PATH
           
 java.lang.String ROOT
           
 java.lang.String SESSION_ID
           
 java.lang.String TEMPPAGE
           
 
Constructor Summary
CategoryManagement()
           
 
Method Summary
private  CoefficientContext addCategory(CoefficientContext ctx)
           
private  boolean anyProjects(Category cat)
          return true if there are any projects using this category
 java.lang.String canExecuteForRole(CoefficientContext ctx, java.lang.String methodName, Role usersHighestRole)
          This is a base implementation that will allow all methods to be invoked without regard to roles
private  void closeCategory(CoefficientContext ctx)
           
private  void deleteCategory(CoefficientContext ctx)
           
private  Category getCategory(java.lang.String id)
           
 CoefficientContext getCategoryByName(CoefficientContext ctx)
           
 Category getCategoryByName(java.lang.String name)
           
 java.lang.String getMainMethod()
          This method is used to determine which method should be invoked when the module is requested without an operation.
 java.lang.String getModuleDescription()
          This method is used to find the description of the module
 java.lang.String getModuleDisplayName()
          This method is used to find the display name of the module
private  Category getRoot()
          see if the root category is there and if it isn't create it
private  java.util.List getSubCategories(java.lang.String id)
           
private  java.util.List getSubCategoriesForDisplay(java.lang.String id, java.util.List openList)
           
 void interpretOp(CoefficientContext ctx)
           
private  void list(java.util.List categories, java.lang.String prefix, java.util.List output)
           
 java.util.List listAll()
           
 CoefficientContext listAll(CoefficientContext ctx)
           
 java.util.List listAllCategories()
           
private  CoefficientContext openCategory(CoefficientContext ctx, java.lang.String msg)
           
private  void removeBranch(CategoryDisplayData cat, java.lang.String id)
           
private  CoefficientContext viewCategoryTree(CoefficientContext ctx, java.lang.String msg)
           
 
Methods inherited from class za.org.coefficient.modules.BaseModule
createRSSItem, displayUsersData, getCoefficientContext, getModuleName, isProjectRequired, publishEvent, setCoefficientContext, showHelp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION

public final java.lang.String ACTION
See Also:
Constant Field Values

ADD

public final java.lang.String ADD
See Also:
Constant Field Values

ADDPAGE

public final java.lang.String ADDPAGE
See Also:
Constant Field Values

ALL

public final java.lang.String ALL
See Also:
Constant Field Values

CATDISP

public final java.lang.String CATDISP
See Also:
Constant Field Values

CATEGORY

public final java.lang.String CATEGORY
See Also:
Constant Field Values

CHILDID

public final java.lang.String CHILDID
See Also:
Constant Field Values

CLOSE

public final java.lang.String CLOSE
See Also:
Constant Field Values

DELETE

public final java.lang.String DELETE
See Also:
Constant Field Values

DESCRIPTION

public final java.lang.String DESCRIPTION
See Also:
Constant Field Values

EDIT

public final java.lang.String EDIT
See Also:
Constant Field Values

ERROR

public final java.lang.String ERROR
See Also:
Constant Field Values

GET

public final java.lang.String GET
See Also:
Constant Field Values

ID

public final java.lang.String ID
See Also:
Constant Field Values

INDEXPAGE

public final java.lang.String INDEXPAGE
See Also:
Constant Field Values

LIST

public final java.lang.String LIST
See Also:
Constant Field Values

LISTPAGE

public final java.lang.String LISTPAGE
See Also:
Constant Field Values

MODULE

public final java.lang.String MODULE
See Also:
Constant Field Values

MSG

public final java.lang.String MSG
See Also:
Constant Field Values

NAME

public final java.lang.String NAME
See Also:
Constant Field Values

OP

public final java.lang.String OP
See Also:
Constant Field Values

OPEN

public final java.lang.String OPEN
See Also:
Constant Field Values

PARENT

public final java.lang.String PARENT
See Also:
Constant Field Values

PATH

public final java.lang.String PATH
See Also:
Constant Field Values

ROOT

public final java.lang.String ROOT
See Also:
Constant Field Values

SESSION_ID

public final java.lang.String SESSION_ID
See Also:
Constant Field Values

TEMPPAGE

public final java.lang.String TEMPPAGE
See Also:
Constant Field Values

interpretOpRoles

java.lang.String[] interpretOpRoles
Constructor Detail

CategoryManagement

public CategoryManagement()
Method Detail

getCategoryByName

public Category getCategoryByName(java.lang.String name)

getCategoryByName

public CoefficientContext getCategoryByName(CoefficientContext ctx)

getMainMethod

public java.lang.String getMainMethod()
Description copied from interface: ModuleLocal
This method is used to determine which method should be invoked when the module is requested without an operation.

Specified by:
getMainMethod in interface ModuleLocal
Specified by:
getMainMethod in class BaseModule
Returns:
name of the method that should be invoked

getModuleDescription

public java.lang.String getModuleDescription()
Description copied from interface: ModuleLocal
This method is used to find the description of the module

Specified by:
getModuleDescription in interface ModuleLocal
Specified by:
getModuleDescription in class BaseModule
Returns:
the description of the module

getModuleDisplayName

public java.lang.String getModuleDisplayName()
Description copied from interface: ModuleLocal
This method is used to find the display name of the module

Specified by:
getModuleDisplayName in interface ModuleLocal
Specified by:
getModuleDisplayName in class BaseModule
Returns:
the display name of the module

addCategory

private CoefficientContext addCategory(CoefficientContext ctx)

canExecuteForRole

public java.lang.String canExecuteForRole(CoefficientContext ctx,
                                          java.lang.String methodName,
                                          Role usersHighestRole)
Description copied from class: BaseModule
This is a base implementation that will allow all methods to be invoked without regard to roles

Specified by:
canExecuteForRole in interface ModuleLocal
Overrides:
canExecuteForRole in class BaseModule
Returns:
null if we can execute the method an error message if not

closeCategory

private void closeCategory(CoefficientContext ctx)

deleteCategory

private void deleteCategory(CoefficientContext ctx)

interpretOp

public void interpretOp(CoefficientContext ctx)

listAll

public java.util.List listAll()

listAll

public CoefficientContext listAll(CoefficientContext ctx)

listAllCategories

public java.util.List listAllCategories()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

openCategory

private CoefficientContext openCategory(CoefficientContext ctx,
                                        java.lang.String msg)

viewCategoryTree

private CoefficientContext viewCategoryTree(CoefficientContext ctx,
                                            java.lang.String msg)

getCategory

private Category getCategory(java.lang.String id)

getRoot

private Category getRoot()
see if the root category is there and if it isn't create it


getSubCategories

private java.util.List getSubCategories(java.lang.String id)

getSubCategoriesForDisplay

private java.util.List getSubCategoriesForDisplay(java.lang.String id,
                                                  java.util.List openList)

anyProjects

private boolean anyProjects(Category cat)
return true if there are any projects using this category


list

private void list(java.util.List categories,
                  java.lang.String prefix,
                  java.util.List output)

removeBranch

private void removeBranch(CategoryDisplayData cat,
                          java.lang.String id)


Copyright CSIR. All Rights Reserved.