View Javadoc
1   /*
2    * Copyright (c) 2002-2018, Mairie de 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      /**
93       * Form id (foreign key)
94       */
95      private int _nIdForm;
96  
97      /**
98       * Get the id of the form rule
99       * 
100      * @return the id of the form rule
101      */
102     public int getIdFormRule( )
103     {
104         return _nIdFormRule;
105     }
106 
107     /**
108      * Set the id of the form rule
109      * 
110      * @param nIdFormRule
111      *            the id to set
112      */
113     public void setIdFormRule( int nIdFormRule )
114     {
115         this._nIdFormRule = nIdFormRule;
116     }
117 
118     /**
119      * Indicate if the captcha is enabled or not
120      * 
121      * @return true if the captcha is enabled
122      */
123     public boolean getIsCaptchaEnabled( )
124     {
125         return _bIsCaptchaEnabled;
126     }
127 
128     /**
129      * Set the boolean captcha value
130      * 
131      * @param bIsCaptchaEnabled
132      *            the boolean captcha value to set
133      */
134     public void setIsCaptchaEnabled( boolean bIsCaptchaEnabled )
135     {
136         this._bIsCaptchaEnabled = bIsCaptchaEnabled;
137     }
138 
139     /**
140      * Indicate whether the email is mandatory or not
141      * 
142      * @return true if the email is mandatory
143      */
144     public boolean getIsMandatoryEmailEnabled( )
145     {
146         return _bIsMandatoryEmailEnabled;
147     }
148 
149     /**
150      * Set the boolean value for the mandatory email
151      * 
152      * @param bIsMandatoryEmailEnabled
153      *            the boolean value for the mandatory email
154      */
155     public void setIsMandatoryEmailEnabled( boolean bIsMandatoryEmailEnabled )
156     {
157         this._bIsMandatoryEmailEnabled = bIsMandatoryEmailEnabled;
158     }
159 
160     /**
161      * Indicate whether the authentication is required or not
162      * 
163      * @return true if the authentication is required
164      */
165     public boolean getIsActiveAuthentication( )
166     {
167         return _bIsActiveAuthentication;
168     }
169 
170     /**
171      * Set the boolean value for the authentication
172      * 
173      * @param bIsActiveAuthentication
174      *            the boolean value for the authentication
175      */
176     public void setIsActiveAuthentication( boolean bIsActiveAuthentication )
177     {
178         this._bIsActiveAuthentication = bIsActiveAuthentication;
179     }
180 
181     /**
182      * Get the number of days the user has to wait before he can take another appointment
183      * 
184      * @return the number of days
185      */
186     public int getNbDaysBeforeNewAppointment( )
187     {
188         return _nNbDaysBeforeNewAppointment;
189     }
190 
191     /**
192      * Set the number of days the user have to wait before he can take another appointment
193      * 
194      * @param _nNbDaysBeforeNewAppointment
195      *            the number of days
196      */
197     public void setNbDaysBeforeNewAppointment( int nNbDaysBeforeNewAppointment )
198     {
199         this._nNbDaysBeforeNewAppointment = nNbDaysBeforeNewAppointment;
200     }
201 
202     /**
203      * Get the minimal time from now before the user can take an appointment
204      * 
205      * @return The minimal time in hours
206      */
207     public int getMinTimeBeforeAppointment( )
208     {
209         return _nMinTimeBeforeAppointment;
210     }
211 
212     /**
213      * Set the minimal time from now before the user can take an appointment
214      * 
215      * @param nMinTimeBeforeAppointment
216      *            the minimal time in hours
217      */
218     public void setMinTimeBeforeAppointment( int nMinTimeBeforeAppointment )
219     {
220         this._nMinTimeBeforeAppointment = nMinTimeBeforeAppointment;
221     }
222 
223     /**
224      * Get the maximum number of appointments per user
225      * 
226      * @return the maximum number of appointments per user on a given period
227      */
228     public int getNbMaxAppointmentsPerUser( )
229     {
230         return _nNbMaxAppointmentsPerUser;
231     }
232 
233     /**
234      * Set the maximum number of appointments authorized
235      * 
236      * @param _nNbMaxAppointmentsPerUser
237      *            the maximum number of appointments authorized
238      */
239     public void setNbMaxAppointmentsPerUser( int nNbMaxAppointmentsPerUser )
240     {
241         this._nNbMaxAppointmentsPerUser = nNbMaxAppointmentsPerUser;
242     }
243 
244     /**
245      * Get the number of days for the period of the maximum number of appointments authorized per user
246      * 
247      * @return the number of days of the period
248      */
249     public int getNbDaysForMaxAppointmentsPerUser( )
250     {
251         return _nNbDaysForMaxAppointmentsPerUser;
252     }
253 
254     /**
255      * Set the number of days of the period for the maximum number of appointments authorized
256      * 
257      * @param _nNbDaysForMaxAppointmentsPerUser
258      *            the number of days to set
259      */
260     public void setNbDaysForMaxAppointmentsPerUser( int nNbDaysForMaxAppointmentsPerUser )
261     {
262         this._nNbDaysForMaxAppointmentsPerUser = nNbDaysForMaxAppointmentsPerUser;
263     }
264 
265     /**
266      * Get the form id the formRule belongs to
267      * 
268      * @return the form id
269      */
270     public int getIdForm( )
271     {
272         return _nIdForm;
273     }
274 
275     /**
276      * Set the form id the formRule belongs to
277      * 
278      * @param nIdForm
279      *            the form id to set
280      */
281     public void setIdForm( int nIdForm )
282     {
283         this._nIdForm = nIdForm;
284     }
285 
286 }