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.forms.business;
35
36 import java.util.Set;
37
38 import javax.validation.constraints.NotEmpty;
39
40 import fr.paris.lutece.portal.service.util.AppLogService;
41
42 /**
43 * This is the business class for the object Control
44 */
45 public class Control implements Cloneable
46 {
47 private int _nId;
48
49 private String _strValue;
50
51 private String _strErrorMessage;
52
53 // @Min( value = 1, message = "#i18n{forms.validation.control.Question.notEmpty}" )
54 private Set<Integer> _listIdQuestion;
55
56 @NotEmpty( message = "#i18n{forms.validation.control.ValidatorName.notEmpty}" )
57 private String _strValidatorName;
58
59 @NotEmpty( message = "#i18n{forms.validation.control.ControlType.notEmpty}" )
60 private String _strControlType;
61
62 private int _nIdControlTarget;
63
64 private int _nIdControlGroup;
65
66 /**
67 * @return the _nId
68 */
69 public int getId( )
70 {
71 return _nId;
72 }
73
74 /**
75 * @param nId
76 * the nId to set
77 */
78 public void setId( int nId )
79 {
80 this._nId = nId;
81 }
82
83 /**
84 * @return the _strValue
85 */
86 public String getValue( )
87 {
88 return _strValue;
89 }
90
91 /**
92 * @param strValue
93 * the strValue to set
94 */
95 public void setValue( String strValue )
96 {
97 this._strValue = strValue;
98 }
99
100 /**
101 * @return the _strErrorMessage
102 */
103 public String getErrorMessage( )
104 {
105 return _strErrorMessage;
106 }
107
108 /**
109 * @param strErrorMessage
110 * the strErrorMessage to set
111 */
112 public void setErrorMessage( String strErrorMessage )
113 {
114 this._strErrorMessage = strErrorMessage;
115 }
116
117 /**
118 * @return the _ListIdQuestion
119 */
120 public Set<Integer> getListIdQuestion( )
121 {
122 return _listIdQuestion;
123 }
124
125 /**
126 * @param listIdQuestion
127 * the listIdQuestion to set
128 */
129 public void setListIdQuestion( Set<Integer> listIdQuestion )
130 {
131 this._listIdQuestion = listIdQuestion;
132 }
133
134 /**
135 * @return the _strValidatorName
136 */
137 public String getValidatorName( )
138 {
139 return _strValidatorName;
140 }
141
142 /**
143 * @param strValidatorName
144 * the strValidatorName to set
145 */
146 public void setValidatorName( String strValidatorName )
147 {
148 this._strValidatorName = strValidatorName;
149 }
150
151 /**
152 * @return the _strControlType
153 */
154 public String getControlType( )
155 {
156 return _strControlType;
157 }
158
159 /**
160 * @param strControlType
161 * the strControlType to set
162 */
163 public void setControlType( String strControlType )
164 {
165 this._strControlType = strControlType;
166 }
167
168 /**
169 *
170 * @return the _nIdTargetFormDisplay
171 */
172 public int getIdControlTarget( )
173 {
174 return _nIdControlTarget;
175 }
176
177 /**
178 *
179 * @param nIdControlTarget
180 * the nIdControlTarget to set
181 */
182 public void setIdControlTarget( int nIdControlTarget )
183 {
184 this._nIdControlTarget = nIdControlTarget;
185 }
186
187 public int getIdControlGroup() {
188 return _nIdControlGroup;
189 }
190
191 public void setIdControlGroup(int nIdControlGroup) {
192 this._nIdControlGroup = nIdControlGroup;
193 }
194
195 /**
196 * {@inheritDoc}
197 *
198 * @throws CloneNotSupportedException
199 */
200 @Override
201 public Control clone( )
202 {
203 Controlms/business/Control.html#Control">Control controlNew = new Control( );
204
205 try
206 {
207 controlNew = (Control) super.clone( );
208 }
209 catch( CloneNotSupportedException e )
210 {
211 AppLogService.error( e );
212 }
213
214 controlNew.setId( _nId );
215 controlNew.setListIdQuestion( _listIdQuestion );
216 controlNew.setControlType( _strControlType );
217 controlNew.setErrorMessage( _strErrorMessage );
218 controlNew.setIdControlTarget( _nIdControlTarget );
219 controlNew.setValidatorName( _strValidatorName );
220 controlNew.setValue( _strValue );
221 controlNew.setIdControlGroup(_nIdControlGroup);
222
223 return controlNew;
224 }
225 }