View Javadoc
1   /*
2    * Copyright (c) 2002-2022, City of 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.web.dto;
35  
36  import java.io.Serializable;
37  import java.util.List;
38  
39  import javax.validation.constraints.Min;
40  import javax.validation.constraints.NotBlank;
41  import javax.validation.constraints.NotNull;
42  import javax.validation.constraints.Size;
43  
44  import fr.paris.lutece.plugins.appointment.business.planning.WorkingDay;
45  
46  /**
47   * Business class of the rules of the reservation
48   * 
49   * @author Laurent Payen
50   *
51   */
52  public class ReservationRuleDTO implements Serializable
53  {
54  
55      /**
56       * Serial version UID
57       */
58      private static final long serialVersionUID = -5154752950203822668L;
59  
60      /**
61       * Id of the reservation rule.
62       */
63      private int _nIdReservationRule;
64  
65      @NotBlank( message = "#i18n{appointment.validation.week.name.notEmpty}" )
66      @Size( max = 255, message = "#i18n{appointment.validation.week.Title.size}" )
67      private String _strName;
68  
69      @NotBlank( message = "#i18n{appointment.validation.week.description.notEmpty}" )
70      @Size( max = 255, message = "#i18n{appointment.validation.week.description.size}" )
71      private String _strDescriptionRule;
72  
73      @NotBlank( message = "#i18n{appointment.validation.week.color.notEmpty}" )
74      @Size( max = 255, message = "#i18n{appointment.validation.week.color.size}" )
75      private String _strColor;
76  
77      private boolean _bEnable = true;
78  
79      /**
80       * The starting time of a working day
81       */
82      @NotBlank( message = "#i18n{portal.validation.message.notEmpty}" )
83      private String _strTimeStart;
84  
85      /**
86       * The ending time of a working day
87       */
88      @NotBlank( message = "#i18n{portal.validation.message.notEmpty}" )
89      private String _strTimeEnd;
90  
91      /**
92       * The duration of an appointment
93       */
94      @NotNull( message = "#i18n{portal.validation.message.notEmpty}" )
95      @Min( value = 1, message = "#i18n{portal.validation.message.notEmpty}" )
96      private int _nDurationAppointments;
97  
98      /**
99       * Maximum capacity for a slot
100      */
101     @Min( value = 1, message = "#i18n{portal.validation.message.notEmpty}" )
102     private int _nMaxCapacityPerSlot = 1;
103 
104     /**
105      * Maximum number of people authorized for an appointment
106      */
107     @Min( value = 1, message = "#i18n{portal.validation.message.notEmpty}" )
108     private int _nMaxPeoplePerAppointment = 1;
109 
110     /**
111      * The Form Id the Reservation Rule belongs to (foreign key)
112      */
113     private int _nIdForm;
114 
115     /**
116      * List of the working days that define the week definition
117      */
118     private List<WorkingDay> _listWorkingDays;
119 
120     /**
121      * Get the id of the rule of the reservation
122      * 
123      * @return the id of the rule of the reservation
124      */
125     public int getIdReservationRule( )
126     {
127         return _nIdReservationRule;
128     }
129 
130     /**
131      * Set the id of the rule of the reservation
132      * 
133      * @param nIdReservationRule
134      *            the id to set
135      */
136     public void setIdReservationRule( int nIdReservationRule )
137     {
138         this._nIdReservationRule = nIdReservationRule;
139     }
140 
141     /**
142      * Returns the Name
143      * 
144      * @return The Name
145      */
146     public String getName( )
147     {
148         return _strName;
149     }
150 
151     /**
152      * Sets the Name
153      * 
154      * @param strName
155      *            The Name
156      */
157     public void setName( String strName )
158     {
159         _strName = strName;
160     }
161 
162     /**
163      * Returns the Description
164      * 
165      * @return The Description
166      */
167     public String getDescriptionRule( )
168     {
169         return _strDescriptionRule;
170     }
171 
172     /**
173      * Sets the Description
174      * 
175      * @param strDescription
176      *            The Description
177      */
178     public void setDescriptionRule( String strDescription )
179     {
180         _strDescriptionRule = strDescription;
181     }
182 
183     /**
184      * Returns the Color
185      * 
186      * @return The Color
187      */
188     public String getColor( )
189     {
190         return _strColor;
191     }
192 
193     /**
194      * Sets the Color
195      * 
196      * @param strColor
197      *            The Color
198      */
199     public void setColor( String strColor )
200     {
201         _strColor = strColor;
202     }
203 
204     /**
205      * Returns the Enable
206      * 
207      * @return The Enable
208      */
209     public boolean getEnable( )
210     {
211         return _bEnable;
212     }
213 
214     /**
215      * Sets the Enable
216      * 
217      * @param bEnable
218      *            The Enable
219      */
220     public void setEnable( boolean bEnable )
221     {
222         _bEnable = bEnable;
223     }
224 
225     /**
226      * Returns the starting time of the working day of the form
227      * 
228      * @return The starting time
229      */
230     public String getTimeStart( )
231     {
232         return _strTimeStart;
233     }
234 
235     /**
236      * Sets the starting time of the working day of the form
237      * 
238      * @param the
239      *            starting time to set The TimeStart
240      */
241     public void setTimeStart( String timeStart )
242     {
243         _strTimeStart = timeStart;
244     }
245 
246     /**
247      * Returns the ending time of the working day of the form
248      * 
249      * @return The ending time
250      */
251     public String getTimeEnd( )
252     {
253         return _strTimeEnd;
254     }
255 
256     /**
257      * Sets the ending time of the working day of the form
258      * 
259      * @param the
260      *            ending time to set
261      */
262     public void setTimeEnd( String timeEnd )
263     {
264         _strTimeEnd = timeEnd;
265     }
266 
267     /**
268      * Returns the duration of an appointment
269      * 
270      * @return The duration of an appointment
271      */
272     public int getDurationAppointments( )
273     {
274         return _nDurationAppointments;
275     }
276 
277     /**
278      * Sets the duration of an appointment
279      * 
280      * @param nDurationAppointments
281      *            The Duration of an Appointments
282      */
283     public void setDurationAppointments( int nDurationAppointments )
284     {
285         _nDurationAppointments = nDurationAppointments;
286     }
287 
288     /**
289      * Get the maximum capacity for a slot
290      * 
291      * @return the maximum capacity for a slot
292      */
293     public int getMaxCapacityPerSlot( )
294     {
295         return _nMaxCapacityPerSlot;
296     }
297 
298     /**
299      * Set the maximum capacity for a slot
300      * 
301      * @param nMaxCapacityPerSlot
302      *            the maximum capacity for a slot
303      */
304     public void setMaxCapacityPerSlot( int nMaxCapacityPerSlot )
305     {
306         this._nMaxCapacityPerSlot = nMaxCapacityPerSlot;
307     }
308 
309     /**
310      * Get the maximum number of people authorized for an appointment
311      * 
312      * @return the maximum number of people authorized for an appointment
313      */
314     public int getMaxPeoplePerAppointment( )
315     {
316         return _nMaxPeoplePerAppointment;
317     }
318 
319     /**
320      * Set the maximum number of people authorized for an appointment
321      * 
322      * @param nMaxPeoplePerAppointment
323      *            the maximum of people to set
324      */
325     public void setMaxPeoplePerAppointment( int nMaxPeoplePerAppointment )
326     {
327         this._nMaxPeoplePerAppointment = nMaxPeoplePerAppointment;
328     }
329 
330     /**
331      * Get the Form Id the Reservation Rule belongs to
332      * 
333      * @return the Form Id
334      */
335     public int getIdForm( )
336     {
337         return _nIdForm;
338     }
339 
340     /**
341      * Set the Form Id the Reservation Rule belongs to
342      * 
343      * @param nIdForm
344      *            the Form Id tp set
345      */
346     public void setIdForm( int nIdForm )
347     {
348         this._nIdForm = nIdForm;
349     }
350 
351     /**
352      * Get the list of the working days of the week
353      * 
354      * @return the list of the working days for the week
355      */
356     public List<WorkingDay> getListWorkingDay( )
357     {
358         return _listWorkingDays;
359     }
360 
361     /**
362      * Set the working days for the week
363      * 
364      * @param _listWorkingDays
365      *            the list o f working days to set
366      */
367     public void setListWorkingDay( List<WorkingDay> listWorkingDays )
368     {
369         this._listWorkingDays = listWorkingDays;
370     }
371 
372 }