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.genericattributes.business;
35  
36  import fr.paris.lutece.plugins.referencelist.business.ReferenceItem;
37  import fr.paris.lutece.portal.business.file.File;
38  import fr.paris.lutece.portal.business.regularexpression.RegularExpression;
39  import java.io.Serializable;
40  
41  import java.util.Date;
42  import java.util.List;
43  
44  /**
45   * class Field
46   */
47  public class Field implements Serializable
48  {
49      private static final long serialVersionUID = -3613999153894144425L;
50      private int _nIdField;
51      private Entry _parentEntry;
52      private String _strCode;
53      private String _strTitle;
54      private String _strValue;
55      private String _strComment;
56      private int _nPosition;
57      private boolean _bDefaultValue;
58      private Date _tValueTypeDate;
59      private List<Entry> _listConditionalQuestions;
60      private List<RegularExpression> _listRegularExpressionList;
61      private boolean _bNoDisplayTitle;
62      private File _fileImage;
63  
64      private ReferenceItem _linkedItem;
65  
66      /**
67       *
68       * @return the id of the field
69       */
70      public int getIdField( )
71      {
72          return _nIdField;
73      }
74  
75      /**
76       * set the id of the field
77       * 
78       * @param idField
79       *            the id of the field
80       */
81      public void setIdField( int idField )
82      {
83          _nIdField = idField;
84      }
85  
86      /**
87       *
88       * @return the position of the field in the list of the entry's fields
89       */
90      public int getPosition( )
91      {
92          return _nPosition;
93      }
94  
95      /**
96       * set the position of the field in the list of the entry's fields
97       * 
98       * @param position
99       *            the position of the field in the list of fields
100      */
101     public void setPosition( int position )
102     {
103         _nPosition = position;
104     }
105 
106     /**
107      *
108      * @return the entry of the field
109      */
110     public Entry getParentEntry( )
111     {
112         return _parentEntry;
113     }
114 
115     /**
116      * set the entry of the field
117      * 
118      * @param entry
119      *            the entry of the field
120      */
121     public void setParentEntry( Entry entry )
122     {
123         _parentEntry = entry;
124     }
125 
126     /**
127      *
128      * @return a list of regular expression which is associate to the field
129      */
130     public List<RegularExpression> getRegularExpressionList( )
131     {
132         return _listRegularExpressionList;
133     }
134 
135     /**
136      * set a list of regular expression which is associate to the field
137      * 
138      * @param regularExpressionList
139      *            a list of regular expression which is associate to the field
140      */
141     public void setRegularExpressionList( List<RegularExpression> regularExpressionList )
142     {
143         _listRegularExpressionList = regularExpressionList;
144     }
145 
146     /**
147      *
148      * @return the title of the field
149      */
150     public String getTitle( )
151     {
152         return _strTitle;
153     }
154 
155     /**
156      * set the title of the field
157      * 
158      * @param title
159      *            the title of the field
160      */
161     public void setTitle( String title )
162     {
163         _strTitle = title;
164     }
165 
166     /**
167      *
168      * @return the value of the field
169      */
170     public String getValue( )
171     {
172         return _strValue;
173     }
174 
175     /**
176      * set the value of the field
177      * 
178      * @param value
179      *            the value of the field
180      */
181     public void setValue( String value )
182     {
183         _strValue = value;
184     }
185 
186     /**
187      * Get the comment of the field
188      * 
189      * @return The comment of the field
190      */
191     public String getComment( )
192     {
193         return _strComment;
194     }
195 
196     /**
197      * Set the comment of the field
198      * 
199      * @param strComment
200      *            The comment of the field
201      */
202     public void setComment( String strComment )
203     {
204         this._strComment = strComment;
205     }
206 
207     /**
208      *
209      * @return a list of Entry which is associate to the field
210      */
211     public List<Entry> getConditionalQuestions( )
212     {
213         return _listConditionalQuestions;
214     }
215 
216     /**
217      * set a list of Entry which is associate to the field
218      * 
219      * @param conditionalQuestions
220      *            a list of Entry which is associate to the field
221      */
222     public void setConditionalQuestions( List<Entry> conditionalQuestions )
223     {
224         _listConditionalQuestions = conditionalQuestions;
225     }
226 
227     /**
228      *
229      * @return true if the field is a default field of the entry
230      */
231     public boolean isDefaultValue( )
232     {
233         return _bDefaultValue;
234     }
235 
236     /**
237      * set true if the field is a default field of the entry
238      * 
239      * @param defaultValue
240      *            true if the field is a default field of the entry
241      */
242     public void setDefaultValue( boolean defaultValue )
243     {
244         _bDefaultValue = defaultValue;
245     }
246 
247     /**
248      *
249      * @return the value of type Date
250      */
251     public Date getValueTypeDate( )
252     {
253         return _tValueTypeDate;
254     }
255 
256     /**
257      * set the value of type Date
258      * 
259      * @param defaultValueTypeDate
260      *            the value of type Date
261      */
262     public void setValueTypeDate( Date defaultValueTypeDate )
263     {
264         _tValueTypeDate = defaultValueTypeDate;
265     }
266 
267     /**
268      *
269      * @return true if the title of field is not display
270      */
271     public boolean isNoDisplayTitle( )
272     {
273         return _bNoDisplayTitle;
274     }
275 
276     /**
277      * set true if the title of field is not display
278      * 
279      * @param bNoDisplayTitle
280      *            true if the title of field is not display
281      */
282     public void setNoDisplayTitle( boolean bNoDisplayTitle )
283     {
284         _bNoDisplayTitle = bNoDisplayTitle;
285     }
286 
287     /**
288      * @return the _strCode
289      */
290     public String getCode( )
291     {
292         return _strCode;
293     }
294 
295     /**
296      * @param strCode
297      *            the code to set
298      */
299     public void setCode( String strCode )
300     {
301         this._strCode = strCode;
302     }
303 
304     /**
305      * @return the linkedItem
306      */
307     public ReferenceItem getLinkedItem( )
308     {
309         return _linkedItem;
310     }
311 
312     /**
313      * @param linkedItem
314      *            the linkedItem to set
315      */
316     public void setLinkedItem( ReferenceItem linkedItem )
317     {
318         _linkedItem = linkedItem;
319     }
320 
321 	/**
322 	 * Gets the file store key.
323 	 *
324 	 * @return the file store key
325 	 */
326 	public File getFileImage( ) {
327 		return _fileImage;
328 	}
329 
330 	/**
331 	 * Sets the file store key.
332 	 *
333 	 * @param strFileStoreKey the new file store key
334 	 */
335 	public void setFileImage( File strFileStoreKey ) {
336 		this._fileImage = strFileStoreKey;
337 	}
338 
339 }