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