it.eng.spagobi.services.modules
Class DetailModalitiesValueModule

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.DetailModalitiesValueModule
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 DetailModalitiesValueModule
extends it.eng.spago.dispatching.module.AbstractModule

Implements a module which handles all predefined List of Values (LOV) management: has methods for LOV 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
private  it.eng.spago.error.EMFErrorHandler errorHandler
           
private  it.eng.spago.base.SessionContainer session
           
 
Constructor Summary
DetailModalitiesValueModule()
           
 
Method Summary
private  ModalitiesValue addFixLovItem(it.eng.spago.base.SourceBean request, ModalitiesValue modVal)
          Inserts a new Fixed LOV item in the FixedLov Wizard.
private  void delDetailModValue(it.eng.spago.base.SourceBean request, java.lang.String mod, it.eng.spago.base.SourceBean response)
          Deletes a value choosed by user from the LOV list.
private  int findIndexOfFixedLovItemToDelete(java.lang.Object indexOfFixedLovItemToDeleteObj)
          Finds the index of the fixed lov item to delete.
private  void getDetailModValue(java.lang.String key, it.eng.spago.base.SourceBean response)
          Gets the detail of a value choosed by the user from the predefined List of Values.
 void init(it.eng.spago.base.SourceBean config)
           
 void labelControl(it.eng.spago.base.SourceBean request, java.lang.String mod)
          Controls if the label choosed by user is yet in use.
private  void loadValuesDomain(it.eng.spago.base.SourceBean response)
          Loads into the Response Source Bean all the Input Type Domain objects
private  void modDetailModValue(it.eng.spago.base.SourceBean request, java.lang.String mod, it.eng.spago.base.SourceBean response)
          Inserts/Modifies the detail of a value according to the user request.
private  void newDetailModValue(it.eng.spago.base.SourceBean response)
          Instantiates a new Value object when a new value insertion in the LOV list is required, in order to prepare the page for the insertion.
private  void prepareDetailModalitiesValuePage(ModalitiesValue modVal, java.lang.String mod, it.eng.spago.base.SourceBean response)
          Sets some attributes into the response SourceBean.
private  LovDetailList recoverLovWizardValues(it.eng.spago.base.SourceBean request, int indexOfFixedLovItemToDelete)
          Recovers all the fix lov items from the request, apart from the one with index indexOfFixedListItemToDelete, that will be ignorated.
private  QueryDetail recoverQueryWizardValues(it.eng.spago.base.SourceBean request)
          Recover all Query Wizard values when a value is inserted or modified, choosing "Query Statement" as the input type.
private  ScriptDetail recoverScriptWizardValues(it.eng.spago.base.SourceBean request)
          Recover all Script Wizard values when a value is inserted or modified, choosing "Script to Load Values" as the input type.
 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.
private  void testLovBeforeSave(it.eng.spago.base.SourceBean request, it.eng.spago.base.SourceBean response, java.lang.Object objectToTest)
          Tests the ModalitiesValue before saving and sets some attributes to the response SourceBean for the correct visualization of the test result page.
 
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

errorHandler

private it.eng.spago.error.EMFErrorHandler errorHandler

session

private it.eng.spago.base.SessionContainer session
Constructor Detail

DetailModalitiesValueModule

public DetailModalitiesValueModule()
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.

When a new value is defined, the user has to use a wizard to build all the new value definition. There are some methods written for this aim.

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

getDetailModValue

private void getDetailModValue(java.lang.String key,
                               it.eng.spago.base.SourceBean response)
                        throws EMFUserError
Gets the detail of a value choosed by the user from the predefined List of Values. It reaches the key from the request and asks to the DB all detail parameter use mode information, by calling the method loadModalitiesValueByID.

Parameters:
key - The choosed parameter use mode id key
response - The response Source Bean
Throws:
EMFUserError - If an exception occurs

modDetailModValue

private void modDetailModValue(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 value according to the user request. When a value in the LOV list is modified, the modifyModalitiesValue method is called; when a new parameter use mode is added, the inserModalitiesValue 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

prepareDetailModalitiesValuePage

private void prepareDetailModalitiesValuePage(ModalitiesValue modVal,
                                              java.lang.String mod,
                                              it.eng.spago.base.SourceBean response)
                                       throws it.eng.spago.base.SourceBeanException,
                                              EMFUserError,
                                              it.eng.spago.error.EMFInternalError
Sets some attributes into the response SourceBean. Those attributes are required for the correct visualization of the ModalitiesValue form page.

Parameters:
modVal - The ModalitiesValue to visualize
mod - The modality (insert/modify)
response - The SourceBean to set
Throws:
it.eng.spago.base.SourceBeanException
EMFUserError
it.eng.spago.error.EMFInternalError

testLovBeforeSave

private void testLovBeforeSave(it.eng.spago.base.SourceBean request,
                               it.eng.spago.base.SourceBean response,
                               java.lang.Object objectToTest)
                        throws it.eng.spago.base.SourceBeanException
Tests the ModalitiesValue before saving and sets some attributes to the response SourceBean for the correct visualization of the test result page.

Parameters:
request - The request SourceBean
response - The response SourceBean
objectToTest - The object to test. It is: - null in case on manual input; - a QueryDetail in case of query; - a LovDetailList in case of Fix Lov; - a ScriptDetail in case of script.
Throws:
it.eng.spago.base.SourceBeanException

delDetailModValue

private void delDetailModValue(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 value choosed by user from the LOV 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

newDetailModValue

private void newDetailModValue(it.eng.spago.base.SourceBean response)
                        throws EMFUserError
Instantiates a new Value object when a new value insertion in the LOV list is required, in order to prepare the page for the insertion.

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

loadValuesDomain

private void loadValuesDomain(it.eng.spago.base.SourceBean response)
                       throws EMFUserError
Loads into the Response Source Bean all the Input Type Domain objects

Parameters:
response - The response Source Bean
Throws:
EMFUserError - If any exception occurred

recoverQueryWizardValues

private QueryDetail recoverQueryWizardValues(it.eng.spago.base.SourceBean request)
Recover all Query Wizard values when a value is inserted or modified, choosing "Query Statement" as the input type.

Parameters:
request - The request SourceBean

recoverScriptWizardValues

private ScriptDetail recoverScriptWizardValues(it.eng.spago.base.SourceBean request)
Recover all Script Wizard values when a value is inserted or modified, choosing "Script to Load Values" as the input type.

Parameters:
request - The request SourceBean

addFixLovItem

private ModalitiesValue addFixLovItem(it.eng.spago.base.SourceBean request,
                                      ModalitiesValue modVal)
                               throws it.eng.spago.base.SourceBeanException
Inserts a new Fixed LOV item in the FixedLov Wizard. When this type of Input is selected dring the insertion/ modify of a Value in the LOV list, it is possible to add a series of FixLov Values, showed at runtime in a table.

Parameters:
request - The request SourceBean
modVal - The ModalitiesValue to modify with the new entry
Throws:
it.eng.spago.base.SourceBeanException - If a SourceBean Exception occurred

findIndexOfFixedLovItemToDelete

private int findIndexOfFixedLovItemToDelete(java.lang.Object indexOfFixedLovItemToDeleteObj)
Finds the index of the fixed lov item to delete.

Parameters:
indexOfFixedListItemToDeleteObj - The object obtained from the SourceBean request as an attribute with key "indexOfFixedListItemToDelete"

recoverLovWizardValues

private LovDetailList recoverLovWizardValues(it.eng.spago.base.SourceBean request,
                                             int indexOfFixedLovItemToDelete)
                                      throws java.lang.Exception
Recovers all the fix lov items from the request, apart from the one with index indexOfFixedListItemToDelete, that will be ignorated. If indexOfFixedListItemToDelete is negative, all the items will be recovered and put into the String lovProvider (representing the XML Lov detail list).

Parameters:
request - The request SourceBean
indexOfFixedListItemToDelete - The index of the item to be ignorated.
Throws:
java.lang.Exception - If an Exception occurred

labelControl

public void labelControl(it.eng.spago.base.SourceBean request,
                         java.lang.String mod)
                  throws EMFUserError
Controls if the label choosed by user is yet in use. If it is, an error is added to the error handler.

Parameters:
request - The request Source Bean
mod - The modality
Throws:
EMFUserError