1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.appointment.service;
35
36 import org.apache.commons.lang3.StringUtils;
37
38 import fr.paris.lutece.plugins.appointment.business.message.FormMessage;
39 import fr.paris.lutece.plugins.appointment.business.message.FormMessageHome;
40 import fr.paris.lutece.portal.service.util.AppPropertiesService;
41
42
43
44
45
46
47
48 public final class FormMessageService
49 {
50
51
52
53
54 private FormMessageService( )
55 {
56 }
57
58
59
60
61 public static final String BEAN_NAME = "appointment.formMessageService";
62
63 private static final String PROPERTY_DEFAULT_CALENDAR_TITLE = "appointment.formMessages.defaultCalendarTitle";
64 private static final String PROPERTY_DEFAULT_FIELD_FIRST_NAME_TITLE = "appointment.formMessages.defaultFieldFirstNameTitle";
65 private static final String PROPERTY_DEFAULT_FIELD_FIRST_NAME_HELP = "appointment.formMessages.defaultFieldFirstNameHelp";
66 private static final String PROPERTY_DEFAULT_FIELD_LAST_NAME_TITLE = "appointment.formMessages.defaultFieldLastNameTitle";
67 private static final String PROPERTY_DEFAULT_FIELD_LAST_NAME_HELP = "appointment.formMessages.defaultFieldLastNameHelp";
68 private static final String PROPERTY_DEFAULT_FIELD_EMAIL_TITLE = "appointment.formMessages.defaultFieldEmailTitle";
69 private static final String PROPERTY_DEFAULT_FIELD_EMAIL_HELP = "appointment.formMessages.defaultFieldEmailHelp";
70 private static final String PROPERTY_DEFAULT_FIELD_CONFIRMATION_EMAIL_TITLE = "appointment.formMessages.defaultFieldConfirmationEmailTitle";
71 private static final String PROPERTY_DEFAULT_FIELD_CONFIRMATION_EMAIL_HELP = "appointment.formMessages.defaultFieldConfirmationEmailHelp";
72 private static final String PROPERTY_DEFAULT_URL_REDIRECTION = "appointment.formMessages.defaultUrlRedirection";
73 private static final String PROPERTY_DEFAULT_LABEL_BUTTON_REDIRECT = "appointment.formMessages.defaultLabelButtonRedirect";
74 private static final String PROPERTY_DEFAULT_TEXT_APPOINTMENT_CREATED = "appointment.formMessages.defaultTextAppointmentCreated";
75 private static final String PROPERTY_DEFAULT_TEXT_APPOINTMENT_CANCELED = "appointment.formMessages.defaultTextAppointmentCanceled";
76 private static final String PROPERTY_DEFAULT_NO_AVAILABLE_SLOT = "appointment.formMessages.defaultNoAvailableSlot";
77 private static final String PROPERTY_DEFAULT_CALENDAR_DESCRIPTION = "appointment.formMessages.defaultCalendarDescription";
78 private static final String PROPERTY_DEFAULT_CALENDAR_RESERVE_LABEL = "appointment.formMessages.defaultCalendarReserveLabel";
79 private static final String PROPERTY_DEFAULT_CALENDAR_FULL_LABEL = "appointment.formMessages.defaultCalendarFullLabel";
80
81
82
83
84
85
86
87 public static void createFormMessageWithDefaultValues( int nIdForm )
88 {
89 FormMessage formMessage = getDefaultAppointmentFormMessage( );
90 formMessage.setIdForm( nIdForm );
91 FormMessageHome.create( formMessage );
92 }
93
94
95
96
97
98
99
100 public static void saveFormMessage( FormMessage formMessage )
101 {
102 FormMessageHome.create( formMessage );
103 }
104
105
106
107
108
109
110 public static FormMessage getDefaultAppointmentFormMessage( )
111 {
112 FormMessageent/business/message/FormMessage.html#FormMessage">FormMessage formMessage = new FormMessage( );
113 formMessage.setCalendarTitle( AppPropertiesService.getProperty( PROPERTY_DEFAULT_CALENDAR_TITLE, StringUtils.EMPTY ) );
114 formMessage.setFieldFirstNameTitle( AppPropertiesService.getProperty( PROPERTY_DEFAULT_FIELD_FIRST_NAME_TITLE, StringUtils.EMPTY ) );
115 formMessage.setFieldFirstNameHelp( AppPropertiesService.getProperty( PROPERTY_DEFAULT_FIELD_FIRST_NAME_HELP, StringUtils.EMPTY ) );
116 formMessage.setFieldLastNameTitle( AppPropertiesService.getProperty( PROPERTY_DEFAULT_FIELD_LAST_NAME_TITLE, StringUtils.EMPTY ) );
117 formMessage.setFieldLastNameHelp( AppPropertiesService.getProperty( PROPERTY_DEFAULT_FIELD_LAST_NAME_HELP, StringUtils.EMPTY ) );
118 formMessage.setFieldEmailTitle( AppPropertiesService.getProperty( PROPERTY_DEFAULT_FIELD_EMAIL_TITLE, StringUtils.EMPTY ) );
119 formMessage.setFieldEmailHelp( AppPropertiesService.getProperty( PROPERTY_DEFAULT_FIELD_EMAIL_HELP, StringUtils.EMPTY ) );
120 formMessage.setFieldConfirmationEmail( AppPropertiesService.getProperty( PROPERTY_DEFAULT_FIELD_CONFIRMATION_EMAIL_TITLE, StringUtils.EMPTY ) );
121 formMessage.setFieldConfirmationEmailHelp( AppPropertiesService.getProperty( PROPERTY_DEFAULT_FIELD_CONFIRMATION_EMAIL_HELP, StringUtils.EMPTY ) );
122 formMessage.setUrlRedirectAfterCreation( AppPropertiesService.getProperty( PROPERTY_DEFAULT_URL_REDIRECTION, StringUtils.EMPTY ) );
123 formMessage.setLabelButtonRedirection( AppPropertiesService.getProperty( PROPERTY_DEFAULT_LABEL_BUTTON_REDIRECT, StringUtils.EMPTY ) );
124 formMessage.setTextAppointmentCreated( AppPropertiesService.getProperty( PROPERTY_DEFAULT_TEXT_APPOINTMENT_CREATED, StringUtils.EMPTY ) );
125 formMessage.setTextAppointmentCanceled( AppPropertiesService.getProperty( PROPERTY_DEFAULT_TEXT_APPOINTMENT_CANCELED, StringUtils.EMPTY ) );
126 formMessage.setNoAvailableSlot( AppPropertiesService.getProperty( PROPERTY_DEFAULT_NO_AVAILABLE_SLOT, StringUtils.EMPTY ) );
127 formMessage.setCalendarDescription( AppPropertiesService.getProperty( PROPERTY_DEFAULT_CALENDAR_DESCRIPTION, StringUtils.EMPTY ) );
128 formMessage.setCalendarReserveLabel( AppPropertiesService.getProperty( PROPERTY_DEFAULT_CALENDAR_RESERVE_LABEL, StringUtils.EMPTY ) );
129 formMessage.setCalendarFullLabel( AppPropertiesService.getProperty( PROPERTY_DEFAULT_CALENDAR_FULL_LABEL, StringUtils.EMPTY ) );
130
131 return formMessage;
132 }
133
134
135
136
137
138
139
140
141 public static FormMessage findFormMessageByIdForm( int nIdForm )
142 {
143 return FormMessageHome.findByIdForm( nIdForm );
144 }
145
146
147
148
149
150
151
152 public static void updateFormMessage( FormMessage formMessage )
153 {
154 FormMessageHome.update( formMessage );
155 }
156
157 }