Class FormService


  • public final class FormService
    extends java.lang.Object
    Service class for a form
    Author:
    Laurent Payen
    • Method Detail

      • copyForm

        public static int copyForm​(int nIdForm,
                                   java.lang.String newNameForCopy)
        Make a copy of form, with all its values
        Parameters:
        nIdForm - the Form Id to copy
        newNameForCopy - the new Name of the copy
        Returns:
        the id of the form created
      • saveForm

        public static Form saveForm​(Form form)
        Save a form in database
        Parameters:
        form - the form to save
        Returns:
        the form saved (with its id)
      • createAppointmentForm

        public static int createAppointmentForm​(AppointmentFormDTO appointmentForm)
        Create a form from an appointmentForm DTO
        Parameters:
        appointmentForm - the appointmentForm DTO
        Returns:
        the id of the form created
      • updateGlobalParameters

        public static void updateGlobalParameters​(AppointmentFormDTO appointmentForm)
        Update a form with the new values of the Global Parameters of an appointmentForm DTO
        Parameters:
        appointmentForm - the appointmentForm DTO
      • buildAllActiveAppointmentForm

        public static java.util.List<AppointmentFormDTO> buildAllActiveAppointmentForm()
        Build all the active forms
        Returns:
        the list of appointment form dto that are active
      • buildAllAppointmentFormLight

        public static java.util.List<AppointmentFormDTO> buildAllAppointmentFormLight()
        Build all the appointForm DTO of the database light because the appointFormDTO is only fill in with the form id, the title and if the form is active or not
        Returns:
        the list of all the appointmentForm DTO
      • findAllInReferenceList

        public static fr.paris.lutece.util.ReferenceList findAllInReferenceList()
        Build a list of all the forms (id, title)
        Returns:
        the reference list
      • buildAllActiveAndDisplayedOnPortletAppointmentForm

        public static java.util.List<AppointmentFormDTO> buildAllActiveAndDisplayedOnPortletAppointmentForm()
        Build all the active forms of the database
        Returns:
        a list of appointmentForm DTO
      • buildAppointmentFormLight

        public static AppointmentFormDTO buildAppointmentFormLight​(Form form)
        Build an appointmentFormDTO light
        Parameters:
        form - the form object
        Returns:
        the appointmentForm DTO
      • buildAppointmentFormLight

        public static AppointmentFormDTO buildAppointmentFormLight​(int nIdForm)
        Build an appointmentForm light
        Parameters:
        nIdForm - the form Id
        Returns:
        the appointmentForm DTO
      • buildAppointmentForm

        public static AppointmentFormDTO buildAppointmentForm​(int nIdForm,
                                                              int nIdReservationRule)
        Build an appointmentForm DTO
        Parameters:
        nIdForm - the Form Id
        nIdReservationRule - the Reservation Rule Id
        Returns:
        the apointmentForm DTO built
      • buildAppointmentForm

        public static AppointmentFormDTO buildAppointmentForm​(int nIdForm,
                                                              ReservationRule reservationRule)
        Build an appointmentForm DTO
        Parameters:
        form - the Form object
        ReservationRule - the Reservation Rule object
        Returns:
        the apointmentForm DTO built
      • buildAppointmentFormWithoutReservationRule

        public static AppointmentFormDTO buildAppointmentFormWithoutReservationRule​(int nIdForm)
        Build an appointmentForm DTO
        Parameters:
        form - the Form object
        Returns:
        the apointmentForm DTO built
      • fillAppointmentFormWithReservationRulePart

        public static void fillAppointmentFormWithReservationRulePart​(AppointmentFormDTO appointmentForm,
                                                                      ReservationRule reservationRule)
        Fill the appointmentForm DTO with the Reservation Rule
        Parameters:
        appointmentForm - the appointmentForm DTO
        reservationRule - the reservation rule
      • updateForm

        public static Form updateForm​(AppointmentFormDTO appointmentForm)
        Update a form object with the values of the appointmentForm DTO
        Parameters:
        appointmentForm - the appointmentForm DTO
        Returns:
        the Form object updated
      • updateForm

        public static Form updateForm​(Form form)
        Update a form
        Parameters:
        form - the form
        Returns:
        the form updated
      • fillInFormWithAppointmentForm

        public static Form fillInFormWithAppointmentForm​(Form form,
                                                         AppointmentFormDTO appointmentForm)
        Fill the form object with the values of the appointmentForm DTO
        Parameters:
        form - the form object
        appointmentForm - the appointmentForm DTO
        Returns:
        the form completed
      • removeForm

        public static void removeForm​(int nIdForm)
        Remove a Form from the database
        Parameters:
        nIdForm - the form id to remove
      • findAllForms

        public static java.util.List<Form> findAllForms()
        Find all the forms in the database
        Returns:
        a list of all the forms
      • findAllActiveForms

        public static java.util.List<Form> findAllActiveForms()
        Find all the active forms in database
        Returns:
        a list of all the active forms
      • findAllActiveAndDisplayedOnPortletForms

        public static java.util.List<Form> findAllActiveAndDisplayedOnPortletForms()
        Find all the active forms that have to be displayed on portlet in database
        Returns:
        a list of all the found forms
      • findFormLightByPrimaryKey

        public static Form findFormLightByPrimaryKey​(int nIdForm)
        find a form by its primary key
        Parameters:
        nIdForm - the form Id
        Returns:
        the Form
      • findFormsByTitle

        public static java.util.List<Form> findFormsByTitle​(java.lang.String strTitle)
        Find forms by the title
        Parameters:
        strTitle - the form title
        Returns:
        the Forms with this title