it.eng.spagobi.analiticalmodel.functionalitytree.service
Class DetailFunctionalityModule

java.lang.Object
  extended by it.eng.spago.dispatching.service.DefaultRequestContext
      extended by it.eng.spago.dispatching.module.AbstractModule
          extended by it.eng.spagobi.analiticalmodel.functionalitytree.service.DetailFunctionalityModule
All Implemented Interfaces:
it.eng.spago.dispatching.module.ModuleIFace, it.eng.spago.dispatching.service.RequestContextIFace, it.eng.spago.dispatching.service.ServiceIFace, it.eng.spago.init.InitializerIFace, java.io.Serializable

public class DetailFunctionalityModule
extends it.eng.spago.dispatching.module.AbstractModule

Implements a module which handles all low functionalities management: has methods for low functionalities load, detail, modify/insertion and deleting operations. The service method has a switch for all these operations, differentiated the ones from the others by a message String.

Author:
sulis
See Also:
Serialized Form

Field Summary
static java.lang.String FUNCTIONALITY_OBJ
           
static java.lang.String MODULE_PAGE
           
static java.lang.String PATH
           
 
Constructor Summary
DetailFunctionalityModule()
           
 
Method Summary
 LowFunctionality eraseRolesFromFunctionality(LowFunctionality func, java.lang.String roleId, java.lang.String roleType)
          Erases the defined input role from a functionality object, if this one has the role.The updated functionality object is returned.
 void init(it.eng.spago.base.SourceBean config)
           
 boolean isParentRule(java.lang.String rule, LowFunctionality parentLowFunct, java.lang.String roleType)
          Controls if a particular role belongs to the parent functionality.
 void loadRolesToErase(LowFunctionality lowFuncParent, java.util.Set rolesToErase)
          Defines all roles that have to be erased in order to keep functionalities tree consistence.
 void service(it.eng.spago.base.SourceBean request, it.eng.spago.base.SourceBean response)
          Reads the operation asked by the user and calls the insertion, modify, detail and deletion methods.
 
Methods inherited from class it.eng.spago.dispatching.module.AbstractModule
getConfig, getModule, getModuleMethod, getPage, getSharedData, setModule, setModuleMethod, setPage, setSharedData
 
Methods inherited from class it.eng.spago.dispatching.service.DefaultRequestContext
getErrorHandler, getRequestContainer, getResponseContainer, getServiceRequest, getServiceResponse, setRequestContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODULE_PAGE

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

FUNCTIONALITY_OBJ

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

PATH

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

DetailFunctionalityModule

public DetailFunctionalityModule()
Method Detail

init

public void init(it.eng.spago.base.SourceBean config)
Specified by:
init in interface it.eng.spago.init.InitializerIFace
Overrides:
init in class it.eng.spago.dispatching.module.AbstractModule

service

public void service(it.eng.spago.base.SourceBean request,
                    it.eng.spago.base.SourceBean response)
             throws java.lang.Exception
Reads the operation asked by the user and calls the insertion, modify, detail and deletion methods.

Parameters:
request - The Source Bean containing all request parameters
response - The Source Bean containing all response parameters
Throws:
exception - If an exception occurs
java.lang.Exception - the exception

isParentRule

public boolean isParentRule(java.lang.String rule,
                            LowFunctionality parentLowFunct,
                            java.lang.String roleType)
Controls if a particular role belongs to the parent functionality. It is called inside functionalities Jsp in ordet to identify those roles that a child functionality is able to select.

Parameters:
rule - The role id string identifying the role
parentLowFunct - the parent low functionality object
roleType - The role's type
Returns:
True if the role belongs to the parent funct, else false

loadRolesToErase

public void loadRolesToErase(LowFunctionality lowFuncParent,
                             java.util.Set rolesToErase)
                      throws it.eng.spago.error.EMFUserError
Defines all roles that have to be erased in order to keep functionalities tree consistence. When we leave some permissions to a functionality, those permissions will not be assignable to all the children functionality. If any child has a permission that his parent anymore has, this permission mus be deleted for all father's children and descendants. This metod recusively scans all father's descendants and saves inside a Set all roles that must be erased from the Database.

Parameters:
lowFuncParent - the parent Functionality
rolesToErase - the set containing all roles to erase
Throws:
it.eng.spago.error.EMFUserError - if any EMFUserError exception occurs
BuildOperationException - if any BuildOperationException exception occurs
OperationExecutionException - if any OperationExecutionException exception occurs

eraseRolesFromFunctionality

public LowFunctionality eraseRolesFromFunctionality(LowFunctionality func,
                                                    java.lang.String roleId,
                                                    java.lang.String roleType)
Erases the defined input role from a functionality object, if this one has the role.The updated functionality object is returned.

Parameters:
func - the input functionality object
roleId - the role id for the role to erase
roleType - the type of the role to erase
Returns:
the updated functionality