View Javadoc
1   /*
2    * Copyright (c) 2002-2018, Mairie de Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.plugins.appointment.service;
35  
36  import java.time.LocalDateTime;
37  import java.util.ArrayList;
38  import java.util.HashMap;
39  import java.util.List;
40  import java.util.StringJoiner;
41  
42  import org.apache.commons.collections.CollectionUtils;
43  import org.apache.commons.lang3.StringUtils;
44  
45  import fr.paris.lutece.plugins.appointment.business.appointment.Appointment;
46  import fr.paris.lutece.plugins.appointment.business.appointment.AppointmentHome;
47  import fr.paris.lutece.plugins.appointment.business.form.Form;
48  import fr.paris.lutece.plugins.appointment.business.slot.Slot;
49  import fr.paris.lutece.plugins.appointment.business.user.User;
50  import fr.paris.lutece.plugins.appointment.service.listeners.AppointmentListenerManager;
51  import fr.paris.lutece.plugins.appointment.web.dto.AppointmentDTO;
52  import fr.paris.lutece.plugins.appointment.web.dto.AppointmentFilterDTO;
53  import fr.paris.lutece.plugins.genericattributes.business.Response;
54  import fr.paris.lutece.plugins.genericattributes.business.ResponseHome;
55  import fr.paris.lutece.portal.business.user.AdminUser;
56  import fr.paris.lutece.portal.business.user.AdminUserHome;
57  import fr.paris.lutece.portal.service.util.AppLogService;
58  import fr.paris.lutece.portal.service.util.AppPropertiesService;
59  import fr.paris.lutece.portal.service.util.CryptoService;
60  import fr.paris.lutece.portal.service.workflow.WorkflowService;
61  
62  /**
63   * Service class for an appointment
64   * 
65   * @author Laurent Payen
66   *
67   */
68  public final class AppointmentService
69  {
70  
71      private static final String PROPERTY_REF_ENCRYPTION_ALGORITHM = "appointment.refEncryptionAlgorithm";
72      private static final String CONSTANT_SHA256 = "SHA-256";
73      private static final String PROPERTY_REF_SIZE_RANDOM_PART = "appointment.refSizeRandomPart";
74      private static final String CONSTANT_SEPARATOR = "$";
75  
76      /**
77       * Get the number of characters of the random part of appointment reference
78       */
79      private static final int CONSTANT_REF_SIZE_RANDOM_PART = 5;
80  
81      /**
82       * Private constructor - this class does not need to be instantiated
83       */
84      private AppointmentService( )
85      {
86      }
87  
88      /**
89       * Find all the appointments of the slots given in parameter
90       * 
91       * @param listSlot
92       *            the list of slots
93       * @return a list of the appointments on these slots
94       */
95      public static List<Appointment> findListAppointmentByListSlot( List<Slot> listSlot )
96      {
97          List<Appointment> listAppointment = new ArrayList<>( );
98          for ( Slot slot : listSlot )
99          {
100             listAppointment.addAll( AppointmentService.findListAppointmentBySlot( slot.getIdSlot( ) ) );
101         }
102         return listAppointment;
103     }
104 
105     /**
106      * Find the appointments of a slot
107      * 
108      * @param nIdSlot
109      *            the slot Id
110      * @return the appointments of the slot
111      */
112     public static List<Appointment> findListAppointmentBySlot( int nIdSlot )
113     {
114         return AppointmentHome.findByIdSlot( nIdSlot );
115     }
116 
117     /**
118      * Find the appointments of a user
119      * 
120      * @param nIdUser
121      *            the user Id
122      * @return the appointment of the user
123      */
124     public static List<Appointment> findListAppointmentByUserId( int nIdUser )
125     {
126         return AppointmentHome.findByIdUser( nIdUser );
127     }
128 
129     /**
130      * Find the appointments by form
131      * 
132      * @param nIdForm
133      *            the form Id
134      * 
135      * @return the appointments that matches the criteria
136      */
137     public static List<Appointment> findListAppointmentByIdForm( int nIdForm )
138     {
139         return AppointmentHome.findByIdForm( nIdForm );
140     }
141 
142     /**
143      * Save an appointment in database
144      * 
145      * @param appointmentDTO
146      *            the appointment dto
147      * @return the id of the appointment saved
148      */
149     public static int saveAppointment( AppointmentDTO appointmentDTO )
150     {
151         // if it's an update for modification of the date of the appointment
152         if ( appointmentDTO.getIdAppointment( ) != 0 && appointmentDTO.getSlot( ).getIdSlot( ) != appointmentDTO.getIdSlot( ) )
153         {
154             // Need to update the old slot
155             Slot oldSlot = SlotService.findSlotById( appointmentDTO.getIdSlot( ) );
156             updateRemaningPlacesWithAppointmentMovedDeletedOrCanceled( appointmentDTO.getNbBookedSeats( ), oldSlot );
157             // Need to remove the workflow resource to reload again the workflow
158             // at the first step
159             try
160             {
161                 WorkflowService.getInstance( ).doRemoveWorkFlowResource( appointmentDTO.getIdAppointment( ), Appointment.APPOINTMENT_RESOURCE_TYPE );
162             }
163             catch( Exception e )
164             {
165                 AppLogService.error( "Workflow", e );
166             }
167         }
168         // Update of the remaining places of the slot
169         Slot slot = appointmentDTO.getSlot( );
170         int oldNbRemainingPLaces = slot.getNbRemainingPlaces( );
171         int nbMaxPotentialBookedSeats = appointmentDTO.getNbMaxPotentialBookedSeats( );
172         int oldNbPotentialRemaningPlaces = slot.getNbPotentialRemainingPlaces( );
173         int oldNbPlacesTaken = slot.getNbPlacesTaken( );
174         int effectiveBookedSeats = appointmentDTO.getNbBookedSeats( );
175         int newNbRemainingPlaces = 0;
176         int newPotentialRemaningPlaces = 0;
177         int newNbPlacesTaken = 0;
178         if ( appointmentDTO.getIdAppointment( ) == 0 || appointmentDTO.getSlot( ).getIdSlot( ) != appointmentDTO.getIdSlot( ) )
179         {
180             newNbRemainingPlaces = oldNbRemainingPLaces - effectiveBookedSeats;
181             newPotentialRemaningPlaces = oldNbPotentialRemaningPlaces + nbMaxPotentialBookedSeats - effectiveBookedSeats;
182             newNbPlacesTaken = oldNbPlacesTaken + effectiveBookedSeats;
183         }
184         else
185         {
186             // It is an update of the appointment
187             Appointment oldAppointment = AppointmentService.findAppointmentById( appointmentDTO.getIdAppointment( ) );
188             newNbRemainingPlaces = oldNbRemainingPLaces + oldAppointment.getNbPlaces( ) - effectiveBookedSeats;
189             newPotentialRemaningPlaces = oldNbPotentialRemaningPlaces + nbMaxPotentialBookedSeats - effectiveBookedSeats;
190             newNbPlacesTaken = oldNbPlacesTaken - oldAppointment.getNbPlaces( ) + effectiveBookedSeats;
191         }
192         slot.setNbRemainingPlaces( newNbRemainingPlaces );
193         slot.setNbPlacestaken( newNbPlacesTaken );
194         slot.setNbPotentialRemainingPlaces( Math.min( newPotentialRemaningPlaces, newNbRemainingPlaces ) );
195 
196         slot = SlotService.saveSlot( slot );
197         // Create or update the user
198         User user = UserService.saveUser( appointmentDTO );
199         // Create or update the appointment
200         Appointment appointment = buildAndCreateAppointment( appointmentDTO, user, slot );
201         String strEmailLastNameFirstName = new StringJoiner( StringUtils.SPACE ).add( user.getEmail( ) ).add( CONSTANT_SEPARATOR ).add( user.getLastName( ) )
202                 .add( CONSTANT_SEPARATOR ).add( user.getFirstName( ) ).toString( );
203         // Create a unique reference for a new appointment
204         if ( appointmentDTO.getIdAppointment( ) == 0 )
205         {
206             String strReference = appointment.getIdAppointment( )
207                     + CryptoService.encrypt( appointment.getIdAppointment( ) + strEmailLastNameFirstName,
208                             AppPropertiesService.getProperty( PROPERTY_REF_ENCRYPTION_ALGORITHM, CONSTANT_SHA256 ) ).substring( 0,
209                             AppPropertiesService.getPropertyInt( PROPERTY_REF_SIZE_RANDOM_PART, CONSTANT_REF_SIZE_RANDOM_PART ) );
210             appointment.setReference( strReference );
211             AppointmentHome.update( appointment );
212         }
213         else
214         {
215             AppointmentResponseService.removeResponsesByIdAppointment( appointment.getIdAppointment( ) );
216         }
217         if ( CollectionUtils.isNotEmpty( appointmentDTO.getListResponse( ) ) )
218         {
219             for ( Response response : appointmentDTO.getListResponse( ) )
220             {
221                 ResponseHome.create( response );
222                 AppointmentResponseService.insertAppointmentResponse( appointment.getIdAppointment( ), response.getIdResponse( ) );
223             }
224         }
225         Form form = FormService.findFormLightByPrimaryKey( slot.getIdForm( ) );
226         if ( form.getIdWorkflow( ) > 0 )
227         {
228             try
229             {
230                 WorkflowService.getInstance( ).getState( appointment.getIdAppointment( ), Appointment.APPOINTMENT_RESOURCE_TYPE, form.getIdWorkflow( ),
231                         form.getIdForm( ) );
232                 WorkflowService.getInstance( ).executeActionAutomatic( appointment.getIdAppointment( ), Appointment.APPOINTMENT_RESOURCE_TYPE,
233                         form.getIdWorkflow( ), form.getIdForm( ) );
234             }
235             catch( Exception e )
236             {
237                 AppLogService.error( "Error Workflow", e );
238             }
239         }
240         return appointment.getIdAppointment( );
241     }
242 
243     /**
244      * Build and create in database an appointment from the dto
245      * 
246      * @param appointmentDTO
247      *            the appointment dto
248      * @param user
249      *            the user
250      * @param slot
251      *            the slot
252      * @return the appointment created
253      */
254     private static Appointment buildAndCreateAppointment( AppointmentDTO appointmentDTO, User user, Slot slot )
255     {
256         Appointment appointment = new Appointment( );
257         if ( appointmentDTO.getIdAppointment( ) != 0 )
258         {
259             appointment = AppointmentService.findAppointmentById( appointmentDTO.getIdAppointment( ) );
260         }
261         if ( appointmentDTO.getIdAdminUser( ) != 0 )
262         {
263             appointment.setIdAdminUser( appointmentDTO.getIdAdminUser( ) );
264         }
265         appointment.setNbPlaces( appointmentDTO.getNbBookedSeats( ) );
266         appointment.setIdSlot( slot.getIdSlot( ) );
267         appointment.setIdUser( user.getIdUser( ) );
268         if ( appointment.getIdAppointment( ) == 0 )
269         {
270             appointment = AppointmentHome.create( appointment );
271         }
272         else
273         {
274             AppLogService.info( "Update Appointment: " + appointment.getIdAppointment( ) + " on Slot: " + appointment.getIdSlot( ) );
275             appointment = AppointmentHome.update( appointment );
276         }
277         return appointment;
278     }
279 
280     /**
281      * Find an appointment by its primary key
282      * 
283      * @param nIdAppointment
284      *            the appointment Id
285      * @return the appointment
286      */
287     public static Appointment findAppointmentById( int nIdAppointment )
288     {
289         return AppointmentHome.findByPrimaryKey( nIdAppointment );
290     }
291 
292     /**
293      * Find an appointment by its reference
294      * 
295      * @param strReference
296      *            the appointment Reference
297      * @return the appointment
298      */
299     public static Appointment findAppointmentByReference( String strReference )
300     {
301         return AppointmentHome.findByReference( strReference );
302     }
303 
304     /**
305      * Find a list of appointments matching the filter
306      * 
307      * @param appointmentFilter
308      *            the filter
309      * @return a list of appointments
310      */
311     public static List<AppointmentDTO> findListAppointmentsDTOByFilter( AppointmentFilterDTO appointmentFilter )
312     {
313         List<AppointmentDTO> listAppointmentsDTO = new ArrayList<>( );
314         for ( Appointment appointment : AppointmentHome.findByFilter( appointmentFilter ) )
315         {
316             listAppointmentsDTO.add( buildAppointmentDTO( appointment ) );
317         }
318         return listAppointmentsDTO;
319     }
320 
321     public static List<Appointment> findListAppointmentsByFilter( AppointmentFilterDTO appointmentFilter )
322     {
323         return AppointmentHome.findByFilter( appointmentFilter );
324     }
325 
326     /**
327      * Build an appointment dto from an appointment business object
328      * 
329      * @param appointment
330      *            the appointment business object
331      * @return the appointment DTO
332      */
333     private static AppointmentDTO buildAppointmentDTO( Appointment appointment )
334     {
335         AppointmentDTO appointmentDTO = new AppointmentDTO( );
336         appointmentDTO.setIdForm( appointment.getSlot( ).getIdForm( ) );
337         appointmentDTO.setIdUser( appointment.getIdUser( ) );
338         appointmentDTO.setIdSlot( appointment.getIdSlot( ) );
339         appointmentDTO.setIdAppointment( appointment.getIdAppointment( ) );
340         appointmentDTO.setFirstName( appointment.getUser( ).getFirstName( ) );
341         appointmentDTO.setLastName( appointment.getUser( ).getLastName( ) );
342         appointmentDTO.setEmail( appointment.getUser( ).getEmail( ) );
343         appointmentDTO.setGuid( appointment.getUser( ).getGuid( ) );
344         appointmentDTO.setReference( appointment.getReference( ) );
345         LocalDateTime startingDateTime = appointment.getSlot( ).getStartingDateTime( );
346         appointmentDTO.setStartingDateTime( startingDateTime );
347         appointmentDTO.setDateOfTheAppointment( startingDateTime.toLocalDate( ).format( Utilities.getFormatter( ) ) );
348         appointmentDTO.setStartingTime( startingDateTime.toLocalTime( ) );
349         appointmentDTO.setEndingTime( appointment.getSlot( ).getEndingDateTime( ).toLocalTime( ) );
350         appointmentDTO.setIsCancelled( appointment.getIsCancelled( ) );
351         appointmentDTO.setNbBookedSeats( appointment.getNbPlaces( ) );
352         SlotService.addDateAndTimeToSlot( appointment.getSlot( ) );
353         appointmentDTO.setSlot( appointment.getSlot( ) );
354         appointmentDTO.setUser( appointment.getUser( ) );
355         if ( appointment.getIdAdminUser( ) != 0 )
356         {
357             AdminUser adminUser = AdminUserHome.findByPrimaryKey( appointment.getIdAdminUser( ) );
358             if ( adminUser != null )
359             {
360                 appointmentDTO.setAdminUser( new StringBuilder( adminUser.getFirstName( ) + org.apache.commons.lang3.StringUtils.SPACE
361                         + adminUser.getLastName( ) ).toString( ) );
362             }
363         }
364         else
365         {
366             appointmentDTO.setAdminUser( StringUtils.EMPTY );
367         }
368         return appointmentDTO;
369     }
370     
371     /**
372      * Fill the appointment data transfer object with complementary appointment responses
373      * @param appointmentDto
374      *              The appointmentDTO object
375      */
376     public static void addAppointmentResponses( AppointmentDTO appointmentDto )
377     {
378         //Load the response list in the DTO
379         appointmentDto.setListResponse( AppointmentResponseService.findListResponse( appointmentDto.getIdAppointment( ) ) );
380     }
381     
382     
383 
384     /**
385      * Delete an appointment (and update the number of remaining places of the related slot)
386      * 
387      * @param nIdAppointment
388      *            the id of the appointment to delete
389      */
390     public static void deleteAppointment( int nIdAppointment )
391     {
392         Appointment appointmentToDelete = AppointmentHome.findByPrimaryKey( nIdAppointment );
393         Slot slotOfTheAppointmentToDelete = SlotService.findSlotById( appointmentToDelete.getIdSlot( ) );
394         if ( WorkflowService.getInstance( ).isAvailable( ) )
395         {
396             try
397             {
398                 WorkflowService.getInstance( ).doRemoveWorkFlowResource( nIdAppointment, Appointment.APPOINTMENT_RESOURCE_TYPE );
399             }
400             catch( Exception e )
401             {
402                 AppLogService.error( "Error Workflow", e );
403             }
404         }
405         if ( !appointmentToDelete.getIsCancelled( ) )
406         {
407             updateRemaningPlacesWithAppointmentMovedDeletedOrCanceled( appointmentToDelete.getNbPlaces( ), slotOfTheAppointmentToDelete );
408         }
409         // Need to delete also the responses linked to this appointment
410         AppointmentResponseService.removeResponsesByIdAppointment( nIdAppointment );
411         AppointmentService.deleteAppointment( appointmentToDelete );
412     }
413 
414     /**
415      * Delete an appointment
416      * 
417      * @param appointment
418      *            the appointment to delete
419      */
420     private static void deleteAppointment( Appointment appointment )
421     {
422         AppointmentListenerManager.notifyListenersAppointmentRemoval( appointment.getIdAppointment( ) );
423         AppointmentHome.delete( appointment.getIdAppointment( ) );
424     }
425 
426     /**
427      * Build an appointment DTO from the id of an appointment business object
428      * 
429      * @param nIdAppointment
430      *            the id of the appointment
431      * @return the appointment DTO
432      */
433     public static AppointmentDTO buildAppointmentDTOFromIdAppointment( int nIdAppointment )
434     {
435         Appointment appointment = AppointmentService.findAppointmentById( nIdAppointment );
436         User user = UserService.findUserById( appointment.getIdUser( ) );
437         Slot slot = SlotService.findSlotById( appointment.getIdSlot( ) );
438         appointment.setUser( user );
439         appointment.setSlot( slot );
440         return buildAppointmentDTO( appointment );
441     }
442 
443     /**
444      * Update an appointment in database
445      * 
446      * @param appointment
447      *            the appointment to update
448      */
449     public static void updateAppointment( Appointment appointment )
450     {
451         // Get the old appointment in db
452         Appointment oldAppointment = AppointmentService.findAppointmentById( appointment.getIdAppointment( ) );
453         // If the update concerns a cancellation of the appointment
454         if ( !oldAppointment.getIsCancelled( ) && appointment.getIsCancelled( ) )
455         {
456             // Need to update the nb remaining places of the related slot
457             Slot slot = SlotService.findSlotById( appointment.getIdSlot( ) );
458             updateRemaningPlacesWithAppointmentMovedDeletedOrCanceled( appointment.getNbPlaces( ), slot );
459         }
460         AppointmentHome.update( appointment );
461     }
462 
463     /**
464      * Set the new number of remaining places (and potential) when an appointment is deleted or cancelled This new value must take in account the capacity of
465      * the slot, in case of the slot was already over booked
466      * 
467      * @param nbPlaces
468      *            the nb places taken of the appointment that we want to delete (or cancel, or move)
469      * @param slot
470      *            the related slot
471      */
472     private static void updateRemaningPlacesWithAppointmentMovedDeletedOrCanceled( int nbPlaces, Slot slot )
473     {
474         // The capacity of the slot (that can be less than the number of places
475         // taken on the slot --> overbook)
476         int nMaxCapacity = slot.getMaxCapacity( );
477         // The old remaining places of the slot (before we delete or cancel or move the
478         // appointment
479         int nOldRemainingPlaces = slot.getNbRemainingPlaces( );
480         int nOldPotentialRemaningPlaces = slot.getNbPotentialRemainingPlaces( );
481         int nOldPlacesTaken = slot.getNbPlacesTaken( );
482         int nNewPlacesTaken = nOldPlacesTaken - nbPlaces;
483         // The new value of the remaining places of the slot is the minimal
484         // value between :
485         // - the minimal value between the potentially new max capacity and the old remaining places plus the number of places released by the appointment
486         // - and the capacity of the slot minus the new places taken on the slot (0 if negative)
487         int nNewRemainingPlaces = Math.min( Math.min( nMaxCapacity, nOldRemainingPlaces + nbPlaces ), Math.max( 0, nMaxCapacity - nNewPlacesTaken ) );
488 
489         int nNewPotentialRemainingPlaces = Math.min( Math.min( nMaxCapacity, nOldPotentialRemaningPlaces + nbPlaces ),
490                 Math.max( 0, nMaxCapacity - nNewPlacesTaken ) );
491 
492         slot.setNbRemainingPlaces( nNewRemainingPlaces );
493         slot.setNbPotentialRemainingPlaces( nNewPotentialRemainingPlaces );
494         slot.setNbPlacestaken( nNewPlacesTaken );
495         SlotService.updateSlot( slot );
496     }
497 
498     /**
499      * Returns user's form data by idFormUser and securityKey
500      * @param idKiosque
501      *              Kiosque id
502      * @param idFormUser
503      *              User's form id
504      * @param idEntryEmail
505      *              Email id entry
506      * @return HashMap<String,String>
507      */
508     public static HashMap<String,String> getAppointmentFillParameters(Integer idKiosque, String idFormUser, Integer idEntryEmail){
509         return AppointmentHome.getAppointmentFillParameters(idKiosque, idFormUser, idEntryEmail);
510     }
511 
512     /**
513      * Check if the user security key is ok
514      *
515      * @param idFormUser
516      *              User form id
517      * @param securityKey
518      *              Security key
519      * @param plugin
520      *              Plugin
521      * @return boolean
522      */
523     /**
524      * Check if the user security key is ok
525      *
526      * @param idFormUser
527      *              User form id
528      * @param securityKey
529      *              Security key
530      * @param idEntryKiosque
531      *               Kiosque entry id
532      * @param idEntryCleSecurite
533      *               Security key entry id
534      * @return
535      */
536     public static boolean checkSecurityKey( String idForm, String idFormUser, String securityKey, int idEntryKiosque, int idEntryCleSecurite){
537         return AppointmentHome.checkSecurityKey(idForm,idFormUser,securityKey, idEntryKiosque, idEntryCleSecurite);
538     }
539 
540     /**
541      * Check if the user can create a new appointment for his project
542      *
543      * @param idForm
544      *              Form id
545      * @param idFormUser
546      *              User form id
547      * @param idEntryDates
548      *               Dates entry id
549      * @param idEntryNumero
550      *               Numero key entry id
551      * @return boolean
552      */
553     public static boolean checkNbCreneauxRestants(String idForm, String idFormUser, Integer idEntryDates, Integer idEntryNumero){
554         return AppointmentHome.checkNbCreneauxRestants(idForm,idFormUser,idEntryDates,idEntryNumero);
555 
556     }
557 
558     /**
559      * Check if animations have been selected by the user
560      *
561      * @param idFormUser
562      *              User form id
563      * @param animations
564      *              The animations to check
565      * @return boolean
566      */
567     public static boolean checkSelectedAnimation( String idFormUser, String[] animations ){
568         return AppointmentHome.checkSelectedAnimation( idFormUser, animations );
569     }
570 
571 }