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.business.rule;
35  
36  import java.io.Serializable;
37  
38  /**
39   * Business Class of the rules of the form
40   * 
41   * @author Laurent Payen
42   *
43   */
44  public final class FormRule implements Serializable
45  {
46  
47      /**
48       * Serial version UID
49       */
50      private static final long serialVersionUID = -737984459576501946L;
51  
52      /**
53       * Id of the form rule.
54       */
55      private int _nIdFormRule;
56  
57      /**
58       * Indicate whether the captcha is enabled or not
59       */
60      private boolean _bIsCaptchaEnabled;
61  
62      /**
63       * Indicate whether the email is mandatory or not
64       */
65      private boolean _bIsMandatoryEmailEnabled;
66  
67      /**
68       * True if the authentication is required
69       */
70      private boolean _bIsActiveAuthentication;
71  
72      /**
73       * Nb Days before the user can take another appointment
74       */
75      private int _nNbDaysBeforeNewAppointment;
76  
77      /**
78       * Minimum time from now before the user can take an appointment
79       */
80      private int _nMinTimeBeforeAppointment;
81  
82      /**
83       * Maximum number of appointments for a same user on a given period
84       */
85      private int _nNbMaxAppointmentsPerUser;
86  
87      /**
88       * The period for the maximum number of appointments per user
89       */
90      private int _nNbDaysForMaxAppointmentsPerUser;
91      /**
92       * Authorize overbooking
93       */
94      private boolean _bBoOverbooking;
95  
96      /**
97       * Form id (foreign key)
98       */
99      private int _nIdForm;
100 
101     /**
102      * Get the id of the form rule
103      * 
104      * @return the id of the form rule
105      */
106     public int getIdFormRule( )
107     {
108         return _nIdFormRule;
109     }
110 
111     /**
112      * Set the id of the form rule
113      * 
114      * @param nIdFormRule
115      *            the id to set
116      */
117     public void setIdFormRule( int nIdFormRule )
118     {
119         this._nIdFormRule = nIdFormRule;
120     }
121 
122     /**
123      * Indicate if the captcha is enabled or not
124      * 
125      * @return true if the captcha is enabled
126      */
127     public boolean getIsCaptchaEnabled( )
128     {
129         return _bIsCaptchaEnabled;
130     }
131 
132     /**
133      * Set the boolean captcha value
134      * 
135      * @param bIsCaptchaEnabled
136      *            the boolean captcha value to set
137      */
138     public void setIsCaptchaEnabled( boolean bIsCaptchaEnabled )
139     {
140         this._bIsCaptchaEnabled = bIsCaptchaEnabled;
141     }
142 
143     /**
144      * Indicate whether the email is mandatory or not
145      * 
146      * @return true if the email is mandatory
147      */
148     public boolean getIsMandatoryEmailEnabled( )
149     {
150         return _bIsMandatoryEmailEnabled;
151     }
152 
153     /**
154      * Set the boolean value for the mandatory email
155      * 
156      * @param bIsMandatoryEmailEnabled
157      *            the boolean value for the mandatory email
158      */
159     public void setIsMandatoryEmailEnabled( boolean bIsMandatoryEmailEnabled )
160     {
161         this._bIsMandatoryEmailEnabled = bIsMandatoryEmailEnabled;
162     }
163 
164     /**
165      * Indicate whether the authentication is required or not
166      * 
167      * @return true if the authentication is required
168      */
169     public boolean getIsActiveAuthentication( )
170     {
171         return _bIsActiveAuthentication;
172     }
173 
174     /**
175      * Set the boolean value for the authentication
176      * 
177      * @param bIsActiveAuthentication
178      *            the boolean value for the authentication
179      */
180     public void setIsActiveAuthentication( boolean bIsActiveAuthentication )
181     {
182         this._bIsActiveAuthentication = bIsActiveAuthentication;
183     }
184 
185     /**
186      * Get the number of days the user has to wait before he can take another appointment
187      * 
188      * @return the number of days
189      */
190     public int getNbDaysBeforeNewAppointment( )
191     {
192         return _nNbDaysBeforeNewAppointment;
193     }
194 
195     /**
196      * Set the number of days the user have to wait before he can take another appointment
197      * 
198      * @param _nNbDaysBeforeNewAppointment
199      *            the number of days
200      */
201     public void setNbDaysBeforeNewAppointment( int nNbDaysBeforeNewAppointment )
202     {
203         this._nNbDaysBeforeNewAppointment = nNbDaysBeforeNewAppointment;
204     }
205 
206     /**
207      * Get the minimal time from now before the user can take an appointment
208      * 
209      * @return The minimal time in hours
210      */
211     public int getMinTimeBeforeAppointment( )
212     {
213         return _nMinTimeBeforeAppointment;
214     }
215 
216     /**
217      * Set the minimal time from now before the user can take an appointment
218      * 
219      * @param nMinTimeBeforeAppointment
220      *            the minimal time in hours
221      */
222     public void setMinTimeBeforeAppointment( int nMinTimeBeforeAppointment )
223     {
224         this._nMinTimeBeforeAppointment = nMinTimeBeforeAppointment;
225     }
226 
227     /**
228      * Get the maximum number of appointments per user
229      * 
230      * @return the maximum number of appointments per user on a given period
231      */
232     public int getNbMaxAppointmentsPerUser( )
233     {
234         return _nNbMaxAppointmentsPerUser;
235     }
236 
237     /**
238      * Set the maximum number of appointments authorized
239      * 
240      * @param _nNbMaxAppointmentsPerUser
241      *            the maximum number of appointments authorized
242      */
243     public void setNbMaxAppointmentsPerUser( int nNbMaxAppointmentsPerUser )
244     {
245         this._nNbMaxAppointmentsPerUser = nNbMaxAppointmentsPerUser;
246     }
247 
248     /**
249      * Get the number of days for the period of the maximum number of appointments authorized per user
250      * 
251      * @return the number of days of the period
252      */
253     public int getNbDaysForMaxAppointmentsPerUser( )
254     {
255         return _nNbDaysForMaxAppointmentsPerUser;
256     }
257 
258     /**
259      * Set the number of days of the period for the maximum number of appointments authorized
260      * 
261      * @param _nNbDaysForMaxAppointmentsPerUser
262      *            the number of days to set
263      */
264     public void setNbDaysForMaxAppointmentsPerUser( int nNbDaysForMaxAppointmentsPerUser )
265     {
266         this._nNbDaysForMaxAppointmentsPerUser = nNbDaysForMaxAppointmentsPerUser;
267     }
268 
269     /**
270      * Returns the BoOverbooking
271      * 
272      * @return The BoOverbooking
273      */
274     public boolean getBoOverbooking( )
275     {
276         return _bBoOverbooking;
277     }
278 
279     /**
280      * Sets the BoOverbooking
281      * 
282      * @param bBoOverbooking
283      *            The BoOverbooking
284      */
285     public void setBoOverbooking( boolean bBoOverbooking )
286     {
287         _bBoOverbooking = bBoOverbooking;
288     }
289 
290     /**
291      * Get the form id the formRule belongs to
292      * 
293      * @return the form id
294      */
295     public int getIdForm( )
296     {
297         return _nIdForm;
298     }
299 
300     /**
301      * Set the form id the formRule belongs to
302      * 
303      * @param nIdForm
304      *            the form id to set
305      */
306     public void setIdForm( int nIdForm )
307     {
308         this._nIdForm = nIdForm;
309     }
310 
311 }