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.business.form;
35
36 import java.io.Serializable;
37 import java.sql.Date;
38 import java.time.LocalDate;
39
40 import javax.validation.constraints.NotBlank;
41 import javax.validation.constraints.Size;
42
43 import org.apache.commons.lang3.StringUtils;
44
45 import com.fasterxml.jackson.annotation.JsonIgnore;
46 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
47
48 import fr.paris.lutece.portal.service.rbac.RBACResource;
49 import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource;
50
51
52
53
54
55
56
57 @JsonIgnoreProperties( ignoreUnknown = true )
58 public final class Form implements RBACResource, AdminWorkgroupResource, Serializable
59 {
60
61
62
63
64 private static final long serialVersionUID = 4742702767509625292L;
65
66
67
68
69 @JsonIgnore
70 public static final String RESOURCE_TYPE = "APPOINTMENT_FORM";
71
72 @JsonIgnore
73 public static final String ROLE_NONE = "none";
74
75
76
77
78 private int _nIdForm;
79
80
81
82
83 @NotBlank( message = "#i18n{appointment.validation.appointmentform.Title.notEmpty}" )
84 @Size( max = 255, message = "#i18n{appointment.validation.appointmentform.Title.size}" )
85 private String _strTitle;
86
87
88
89
90 @NotBlank( message = "#i18n{appointment.validation.appointmentform.Description.notEmpty}" )
91 private String _strDescription;
92
93
94
95
96 private String _strReference;
97
98
99
100
101 private Integer _nIdCategory;
102
103
104
105
106 private LocalDate _startingValidityDate;
107
108
109
110
111 private LocalDate _endingValidityDate;
112
113
114
115
116 private boolean _bIsActive;
117
118
119
120
121 private int _nIdWorkflow;
122
123
124
125
126 private String _strWorkgroup;
127
128
129
130
131 private boolean _bIsMultislotAppointment;
132
133
134
135
136 private int _nNbConsecutiveSlots;
137
138
139
140
141 private String _strRole;
142
143
144
145 private int _nCapacityPerSlot = 1;
146
147
148
149
150 private boolean _bIsAnonymizable;
151
152
153
154
155 private String _strAnonymizationPattern;
156
157
158
159
160
161
162 public int getIdForm( )
163 {
164 return _nIdForm;
165 }
166
167
168
169
170
171
172
173 public void setIdForm( int nIdForm )
174 {
175 this._nIdForm = nIdForm;
176 }
177
178
179
180
181
182
183 public String getTitle( )
184 {
185 return _strTitle;
186 }
187
188
189
190
191
192
193
194 public void setTitle( String strTitle )
195 {
196 this._strTitle = strTitle;
197 }
198
199
200
201
202
203
204 public String getDescription( )
205 {
206 return _strDescription;
207 }
208
209
210
211
212
213
214
215 public void setDescription( String strDescription )
216 {
217 this._strDescription = strDescription;
218 }
219
220
221
222
223
224
225 public String getReference( )
226 {
227 return _strReference;
228 }
229
230
231
232
233
234
235
236 public void setReference( String strReference )
237 {
238 this._strReference = strReference;
239 }
240
241
242
243
244
245
246 public Integer getIdCategory( )
247 {
248 return _nIdCategory;
249 }
250
251
252
253
254
255
256
257 public void setIdCategory( Integer nIdCategory )
258 {
259 this._nIdCategory = nIdCategory;
260 }
261
262
263
264
265
266
267 public LocalDate getStartingValidityDate( )
268 {
269 return _startingValidityDate;
270 }
271
272
273
274
275
276
277 public Date getStartingValiditySqlDate( )
278 {
279 Date date = null;
280 if ( _startingValidityDate != null )
281 {
282 date = Date.valueOf( _startingValidityDate );
283 }
284 return date;
285 }
286
287
288
289
290
291
292
293 public void setStartingValidityDate( LocalDate startingValidityDate )
294 {
295 this._startingValidityDate = startingValidityDate;
296 }
297
298
299
300
301
302
303
304 public void setStartingValiditySqlDate( Date startingValidityDate )
305 {
306 if ( startingValidityDate != null )
307 {
308 this._startingValidityDate = startingValidityDate.toLocalDate( );
309 }
310 else
311 {
312 this._startingValidityDate = null;
313 }
314 }
315
316
317
318
319
320
321 public LocalDate getEndingValidityDate( )
322 {
323 return _endingValidityDate;
324 }
325
326
327
328
329
330
331 public Date getEndingValiditySqlDate( )
332 {
333 Date date = null;
334 if ( _endingValidityDate != null )
335 {
336 date = Date.valueOf( _endingValidityDate );
337 }
338 return date;
339 }
340
341
342
343
344
345
346
347 public void setEndingValidityDate( LocalDate endingValidityDate )
348 {
349 this._endingValidityDate = endingValidityDate;
350 }
351
352
353
354
355
356
357
358 public void setEndingValiditySqlDate( Date endingValidityDate )
359 {
360 if ( endingValidityDate != null )
361 {
362 this._endingValidityDate = endingValidityDate.toLocalDate( );
363 }
364 else
365 {
366 this._endingValidityDate = null;
367 }
368 }
369
370
371
372
373
374
375 public boolean getIsActive( )
376 {
377 return _bIsActive;
378 }
379
380
381
382
383
384
385
386 public void setIsActive( boolean bIsActive )
387 {
388 this._bIsActive = bIsActive;
389 }
390
391
392
393
394
395
396 public int getIdWorkflow( )
397 {
398 return _nIdWorkflow;
399 }
400
401
402
403
404
405
406
407 public void setIdWorkflow( int nIdWorkflow )
408 {
409 this._nIdWorkflow = nIdWorkflow;
410 }
411
412 @Override
413 public String getWorkgroup( )
414 {
415 return _strWorkgroup;
416 }
417
418
419
420
421
422
423
424 public void setWorkgroup( String strWorkgroup )
425 {
426 this._strWorkgroup = strWorkgroup;
427 }
428
429 @Override
430 public String getResourceTypeCode( )
431 {
432 return RESOURCE_TYPE;
433 }
434
435 @Override
436 public String getResourceId( )
437 {
438 return Integer.toString( getIdForm( ) );
439 }
440
441
442
443
444
445
446 public boolean getIsMultislotAppointment( )
447 {
448 return _bIsMultislotAppointment;
449 }
450
451
452
453
454
455
456
457 public void setIsMultislotAppointment( boolean bIsMultislotAppointment )
458 {
459 _bIsMultislotAppointment = bIsMultislotAppointment;
460 }
461
462
463
464
465
466
467 public int getNbConsecutiveSlots( )
468 {
469 return _nNbConsecutiveSlots;
470 }
471
472
473
474
475
476
477
478 public void setNbConsecutiveSlots( int nbConsecutiveSlots )
479 {
480 this._nNbConsecutiveSlots = nbConsecutiveSlots;
481 }
482
483
484
485
486 public String getRole( )
487 {
488 return _strRole;
489 }
490
491
492
493
494
495 public void setRole( String strRole )
496 {
497 _strRole = StringUtils.isEmpty( strRole ) ? ROLE_NONE : strRole;
498 }
499
500
501
502
503
504
505 public int getCapacityPerSlot( )
506 {
507 return _nCapacityPerSlot;
508 }
509
510
511
512
513
514
515
516 public void setCapacityPerSlot( int nCapacityPerSlot )
517 {
518 _nCapacityPerSlot = nCapacityPerSlot;
519 }
520
521 public String getAnonymizationPattern()
522 {
523 return _strAnonymizationPattern;
524 }
525
526 public void setAnonymizationPattern(String strAnonymizationPattern)
527 {
528 this._strAnonymizationPattern = strAnonymizationPattern;
529 }
530
531 public boolean isAnonymizable()
532 {
533 return _bIsAnonymizable;
534 }
535
536 public void setAnonymizable(boolean bIsAnonymizable)
537 {
538 this._bIsAnonymizable = bIsAnonymizable;
539 }
540
541 }