Class FormService


  • public class FormService
    extends java.lang.Object
    This is the service class related to the form
    • Constructor Detail

      • FormService

        public FormService()
    • Method Detail

      • saveForm

        public void saveForm​(Form form,
                             FormResponse formResponse)
        Saves the specified form *
        Parameters:
        form - the form to save
        formResponse - the form response to save
        Throws:
        MaxFormResponseException - the MaxFormResponseException Runtime Exception
      • saveFormResponse

        public void saveFormResponse​(FormResponse formResponse)
        Save the response of form
        Parameters:
        formResponse - The FormResponse
        Throws:
        MaxFormResponseException - the MaxFormResponseException Runtime Exception
      • processFormAction

        public void processFormAction​(Form form,
                                      FormResponse formResponse)
        Process action on form creation
        Parameters:
        form - the workflow form
        formResponse - the form response
      • saveFormResponseWithoutQuestionResponse

        public void saveFormResponseWithoutQuestionResponse​(FormResponse formResponse)
        Saves the form response
        Parameters:
        formResponse - the form response to save
      • saveFormForBackup

        @Transactional("forms.transactionManager")
        public void saveFormForBackup​(FormResponse formResponse)
        Saves the specified form for a backup
        Parameters:
        formResponse - The form response to save
      • removeFormBackup

        @Transactional("forms.transactionManager")
        public void removeFormBackup​(FormResponse formResponse)
        Removes the specified form's backup
        Parameters:
        formResponse - The form response to remove
      • getStepCompositeList

        public java.util.List<ICompositeDisplay> getStepCompositeList​(int nIdStep)
        Get the full children composite list of the given step
        Parameters:
        nIdStep - The step primary key
        Returns:
        the Html of the given step
      • formDisplayToComposite

        public ICompositeDisplay formDisplayToComposite​(FormDisplay formDisplay,
                                                        FormResponse formResponse,
                                                        int nIterationNumber)
        Get the right composite from the given formDisplay
        Parameters:
        formDisplay - The formDisplay
        formResponse - the form response
        nIterationNumber - the iteration number
        Returns:
        the right composite
      • removeForm

        @Transactional("forms.transactionManager")
        public void removeForm​(int nIdForm,
                               fr.paris.lutece.portal.business.user.AdminUser adminUser)
        Remove a given Form, all its steps and composites, workflow resources. Also remove all the related formResponses, QuestionsResposes, EntryResponses and entries.
        Parameters:
        nIdForm - The identifier of the form to be deleted
        adminUser - the user
      • isFileAccessAuthorized

        public boolean isFileAccessAuthorized​(javax.servlet.http.HttpServletRequest request,
                                              int nIdResponse,
                                              int nIdFile)
        Check if a user is authorized to access a File from its given identifier
        Parameters:
        request - The request to use to retrieve information of the current user
        nIdResponse - The identifier of the Response which have the file
        nIdFile - The identifier of the file to access
        Returns:
        the boolean which tell if the user is authorize to access the given File or not
      • createFormResponseManagerFromBackUp

        public FormResponseManager createFormResponseManagerFromBackUp​(Form form,
                                                                       java.lang.String strUserGuid)
        Creates a FormResponseManager object from a back up
        Parameters:
        form - The form
        strUserGuid - The user guid
        Returns:
        the created FormResponseManager object
      • fireFormResponseEventCreation

        public void fireFormResponseEventCreation​(FormResponse formResponse)
        Fire the create event on given form Response
        Parameters:
        formResponse - the form Response
      • fireFormResponseEventCreation

        public void fireFormResponseEventCreation​(Form form)
        Fire the create event on all the form responses associated to given form
        Parameters:
        form - The form
      • fireFormResponseEventUpdate

        public void fireFormResponseEventUpdate​(FormResponse formResponse)
        Fire the form response event update on given formResponse
        Parameters:
        formResponse - the formResponse
      • fireFormResponseEventUpdate

        public void fireFormResponseEventUpdate​(FormResponse formResponse,
                                                boolean updateDate)
        Fire the form response event update on given formResponse
        Parameters:
        formResponse - the formResponse
        updateDate - asks the listener to update the response update date
      • fireFormResponseEventUpdate

        public void fireFormResponseEventUpdate​(Form form)
        Fire the update event on all the form responses associated to given form
        Parameters:
        form - The form
      • fireFormResponseEventDelete

        public void fireFormResponseEventDelete​(FormResponse formResponse)
        Fire the form response deletion event
        Parameters:
        formResponse - the form response
      • fireFormResponseEventDelete

        public void fireFormResponseEventDelete​(Form form)
        Fire the delete event of all the form responses associated to given form
        Parameters:
        form - the form
      • saveOrUpdateField

        public void saveOrUpdateField​(fr.paris.lutece.plugins.genericattributes.business.Entry entry,
                                      java.lang.String fieldName,
                                      java.lang.String title,
                                      java.lang.String value)
        Save or update the field of the entry
        Parameters:
        entry -
        fieldName -
        title -
        value -
      • existCompositeResponses

        public boolean existCompositeResponses​(FormDisplay formDisplay)
        Check if responses exist for a composite (question or group of questions)
        Parameters:
        formDisplay - the form display
        Returns:
        true if responses exist, false otherwise