fr.paris.lutece.plugins.appointment.service
Class AppointmentFormService

java.lang.Object
  extended by fr.paris.lutece.plugins.appointment.service.AppointmentFormService
All Implemented Interfaces:
Serializable

public class AppointmentFormService
extends Object
implements Serializable

Service for appointment forms

See Also:
Serialized Form

Field Summary
static String BEAN_NAME
          Name of the bean of the service
 
Constructor Summary
AppointmentFormService()
           
 
Method Summary
 void convertMapResponseToList(AppointmentDTO appointment)
          Convert an AppointmentDTO to an Appointment by transferring response from the map of class AppointmentDTO to the list of class Appointment.
 boolean doMakeAppointment(Appointment appointment, AppointmentForm form, boolean bIsAdmin)
          Do check if an appointment can be made and make an appointment.
 AppointmentDTO getAppointmentFromSession(javax.servlet.http.HttpSession session)
          Get the current appointment form from the session
 AppointmentFormMessages getDefaultAppointmentFormMessage()
          Get the default form message with values loaded from properties.
 String getEntryUrl(fr.paris.lutece.plugins.genericattributes.business.Entry entry)
          Get the URL of the anchor of an entry
 void getHtmlEntry(int nIdEntry, StringBuffer stringBuffer, Locale locale, boolean bDisplayFront, javax.servlet.http.HttpServletRequest request)
          Insert in the string buffer the content of the HTML code of the entry
 String getHtmlForm(AppointmentForm form, AppointmentFormMessages formMessages, Locale locale, boolean bDisplayFront, javax.servlet.http.HttpServletRequest request)
          Return the HTML code of the form
 List<fr.paris.lutece.plugins.genericattributes.business.GenericAttributeError> getResponseEntry(javax.servlet.http.HttpServletRequest request, int nIdEntry, Locale locale, AppointmentDTO appointment)
          Get the responses associated with an entry.
 Appointment getValidatedAppointmentFromSession(javax.servlet.http.HttpSession session)
          Get a validated appointment from the session
 Boolean isFieldInTheResponseList(int nIdField, List<fr.paris.lutece.plugins.genericattributes.business.Response> listResponse)
          Check if a field is in a response list
 boolean isFormFirstStep()
          Check if the form is the first step of the creation of appointments, or if it is the calendar.
 void removeAppointmentFromSession(javax.servlet.http.HttpSession session)
          Remove any appointment form responses stored in the session of the user
 void removeValidatedAppointmentFromSession(javax.servlet.http.HttpSession session)
          Remove a validated appointment stored in the session of the user
 void saveAppointmentInSession(javax.servlet.http.HttpSession session, AppointmentDTO appointment)
          Save an appointment in the session of the user
 void saveValidatedAppointmentForm(javax.servlet.http.HttpSession session, Appointment appointment)
          Save a validated appointment into the session of the user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEAN_NAME

public static final String BEAN_NAME
Name of the bean of the service

See Also:
Constant Field Values
Constructor Detail

AppointmentFormService

public AppointmentFormService()
Method Detail

getHtmlForm

public String getHtmlForm(AppointmentForm form,
                          AppointmentFormMessages formMessages,
                          Locale locale,
                          boolean bDisplayFront,
                          javax.servlet.http.HttpServletRequest request)
Return the HTML code of the form

Parameters:
form - the form which HTML code must be return
formMessages - The form messages associated with the form
locale - the locale
bDisplayFront - True if the entry will be displayed in Front Office, false if it will be displayed in Back Office.
request - HttpServletRequest
Returns:
the HTML code of the form

getHtmlEntry

public void getHtmlEntry(int nIdEntry,
                         StringBuffer stringBuffer,
                         Locale locale,
                         boolean bDisplayFront,
                         javax.servlet.http.HttpServletRequest request)
Insert in the string buffer the content of the HTML code of the entry

Parameters:
nIdEntry - the key of the entry which HTML code must be insert in the stringBuffer
stringBuffer - the buffer which contains the HTML code
locale - the locale
bDisplayFront - True if the entry will be displayed in Front Office, false if it will be displayed in Back Office.
request - HttpServletRequest

getResponseEntry

public List<fr.paris.lutece.plugins.genericattributes.business.GenericAttributeError> getResponseEntry(javax.servlet.http.HttpServletRequest request,
                                                                                                       int nIdEntry,
                                                                                                       Locale locale,
                                                                                                       AppointmentDTO appointment)
Get the responses associated with an entry.
Return null if there is no error in the response, or return the list of errors Response created are stored the map of AppointmentDTO. The key of the map is this id of the entry, and the value the list of responses

Parameters:
request - the request
nIdEntry - the key of the entry
locale - the locale
appointment - The appointment
Returns:
null if there is no error in the response or the list of errors found

isFieldInTheResponseList

public Boolean isFieldInTheResponseList(int nIdField,
                                        List<fr.paris.lutece.plugins.genericattributes.business.Response> listResponse)
Check if a field is in a response list

Parameters:
nIdField - the id of the field to search
listResponse - the list of responses
Returns:
true if the field is in the response list, false otherwise

getEntryUrl

public String getEntryUrl(fr.paris.lutece.plugins.genericattributes.business.Entry entry)
Get the URL of the anchor of an entry

Parameters:
entry - the entry
Returns:
The URL of the anchor of an entry

saveAppointmentInSession

public void saveAppointmentInSession(javax.servlet.http.HttpSession session,
                                     AppointmentDTO appointment)
Save an appointment in the session of the user

Parameters:
session - The session
appointment - The appointment to save

getAppointmentFromSession

public AppointmentDTO getAppointmentFromSession(javax.servlet.http.HttpSession session)
Get the current appointment form from the session

Parameters:
session - The session of the user
Returns:
The appointment form

removeAppointmentFromSession

public void removeAppointmentFromSession(javax.servlet.http.HttpSession session)
Remove any appointment form responses stored in the session of the user

Parameters:
session - The session

saveValidatedAppointmentForm

public void saveValidatedAppointmentForm(javax.servlet.http.HttpSession session,
                                         Appointment appointment)
Save a validated appointment into the session of the user

Parameters:
session - The session
appointment - The appointment to save

getValidatedAppointmentFromSession

public Appointment getValidatedAppointmentFromSession(javax.servlet.http.HttpSession session)
Get a validated appointment from the session

Parameters:
session - The session of the user
Returns:
The appointment

removeValidatedAppointmentFromSession

public void removeValidatedAppointmentFromSession(javax.servlet.http.HttpSession session)
Remove a validated appointment stored in the session of the user

Parameters:
session - The session

getDefaultAppointmentFormMessage

public AppointmentFormMessages getDefaultAppointmentFormMessage()
Get the default form message with values loaded from properties.

Returns:
The default form message. The form message is not associated with any appointment form

convertMapResponseToList

public void convertMapResponseToList(AppointmentDTO appointment)
Convert an AppointmentDTO to an Appointment by transferring response from the map of class AppointmentDTO to the list of class Appointment.

Parameters:
appointment - The appointment to convert

isFormFirstStep

public boolean isFormFirstStep()
Check if the form is the first step of the creation of appointments, or if it is the calendar.

Returns:
True if the form is the first step of the creation of appointments, false otherwise

doMakeAppointment

public boolean doMakeAppointment(Appointment appointment,
                                 AppointmentForm form,
                                 boolean bIsAdmin)
Do check if an appointment can be made and make an appointment.

Parameters:
appointment - The appointment to make
form - The appointment form associated with the appointment
bIsAdmin - True if this method was called by an admin, false if it was called by a regular user
Returns:
True if the appointment was successfully made, false if the selected slot is empty or does not exist


Copyright © 2014 Mairie de Paris. All Rights Reserved.