it.eng.spagobi.services.modules
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.services.modules.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
           
private  java.lang.String modality
           
static java.lang.String MODULE_PAGE
           
static java.lang.String PATH
           
private  java.lang.String typeFunct
           
 
Constructor Summary
DetailFunctionalityModule()
           
 
Method Summary
private  void delFunctionality(it.eng.spago.base.SourceBean request, java.lang.String mod, it.eng.spago.base.SourceBean response)
          Deletes a low functionality choosed by user from the low functionality list.
 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.
private  void getDetailFunctionality(it.eng.spago.base.SourceBean request, it.eng.spago.base.SourceBean response)
          Gets the detail of a low functionality choosed by the user from the low functionalities list.
 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.
private  void modDettaglioFunctionality(it.eng.spago.base.SourceBean request, java.lang.String mod, it.eng.spago.base.SourceBean response)
          Inserts/Modifies the detail of a low functionality according to the user request.
private  void newDettaglioFunctionality(it.eng.spago.base.SourceBean request, it.eng.spago.base.SourceBean response)
          Instantiates a new LowFunctionalitye object when a new low functionality insertion is required, in order to prepare the page for the insertion.
private  LowFunctionality recoverLowFunctionalityDetails(it.eng.spago.base.SourceBean request, java.lang.String mod)
           
 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, getPage, getSharedData, setModule, 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

modality

private java.lang.String modality

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

typeFunct

private java.lang.String typeFunct
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

getDetailFunctionality

private void getDetailFunctionality(it.eng.spago.base.SourceBean request,
                                    it.eng.spago.base.SourceBean response)
                             throws EMFUserError
Gets the detail of a low functionality choosed by the user from the low functionalities list. It reaches the key from the request and asks to the DB all detail parameter use mode information, by calling the method loadLowFunctionalityByPath.

Parameters:
key - The choosed low functionality id key
response - The response Source Bean
Throws:
EMFUserError - If an exception occurs

modDettaglioFunctionality

private void modDettaglioFunctionality(it.eng.spago.base.SourceBean request,
                                       java.lang.String mod,
                                       it.eng.spago.base.SourceBean response)
                                throws EMFUserError,
                                       it.eng.spago.base.SourceBeanException
Inserts/Modifies the detail of a low functionality according to the user request. When a parameter use mode is modified, the modifyLowFunctionality method is called; when a new parameter use mode is added, the insertLowFunctionality method is called. These two cases are differentiated by the mod String input value .

Parameters:
request - The request information contained in a SourceBean Object
mod - A request string used to differentiate insert/modify operations
response - The response SourceBean
Throws:
EMFUserError - If an exception occurs
it.eng.spago.base.SourceBeanException - If a SourceBean exception occurs

delFunctionality

private void delFunctionality(it.eng.spago.base.SourceBean request,
                              java.lang.String mod,
                              it.eng.spago.base.SourceBean response)
                       throws EMFUserError,
                              it.eng.spago.base.SourceBeanException
Deletes a low functionality choosed by user from the low functionality list.

Parameters:
request - The request SourceBean
mod - A request string used to differentiate delete operation
response - The response SourceBean
Throws:
EMFUserError - If an Exception occurs
it.eng.spago.base.SourceBeanException - If a SourceBean Exception occurs

newDettaglioFunctionality

private void newDettaglioFunctionality(it.eng.spago.base.SourceBean request,
                                       it.eng.spago.base.SourceBean response)
                                throws EMFUserError
Instantiates a new LowFunctionalitye object when a new low functionality insertion is required, in order to prepare the page for the insertion.

Parameters:
response - The response SourceBean
Throws:
EMFUserError - If an Exception occurred

recoverLowFunctionalityDetails

private LowFunctionality recoverLowFunctionalityDetails(it.eng.spago.base.SourceBean request,
                                                        java.lang.String mod)
                                                 throws EMFUserError,
                                                        it.eng.spago.base.SourceBeanException
Throws:
EMFUserError
it.eng.spago.base.SourceBeanException

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 EMFUserError,
                             it.eng.spago.cms.exceptions.BuildOperationException,
                             it.eng.spago.cms.exceptions.OperationExecutionException
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:
EMFUserError - if any EMFUserError exception occurs
it.eng.spago.cms.exceptions.BuildOperationException - if any BuildOperationException exception occurs
it.eng.spago.cms.exceptions.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