View Javadoc
1   /*
2    * Copyright (c) 2002-2017, 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.directory.business;
35  
36  import fr.paris.lutece.portal.business.regularexpression.RegularExpression;
37  import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource;
38  
39  import java.util.Date;
40  import java.util.List;
41  
42  /**
43   *
44   * class Field
45   *
46   */
47  public class Field implements AdminWorkgroupResource
48  {
49      public static final String ATTRIBUTE_FIELD_TITLE = "title";
50      public static final String ATTRIBUTE_FIELD_ID = "id";
51      private int _nIdField;
52      private IEntry _entry;
53      private String _strTitle;
54      private String _strValue;
55      private int _nHeight;
56      private int _nWidth;
57      private int _nMaxSizeEnter;
58      private int _nPosition;
59      private boolean _bShownInResultList;
60      private boolean _bShownInResultRecord;
61      private boolean _bDefaultValue;
62      private Date _tValueTypeDate;
63      private List<RegularExpression> _listRegularExpressionList;
64      private String _strRoleKey;
65      private String _strWorkgroupKey;
66      private String _strImageType;
67  
68      /**
69       *
70       * @return the id of the field
71       */
72      public int getIdField( )
73      {
74          return _nIdField;
75      }
76  
77      /**
78       * set the id of the field
79       * 
80       * @param idField
81       *            the id of the field
82       */
83      public void setIdField( int idField )
84      {
85          _nIdField = idField;
86      }
87  
88      /**
89       *
90       * @return the position of the field in the list of the entry's fields
91       */
92      public int getPosition( )
93      {
94          return _nPosition;
95      }
96  
97      /**
98       * set the position of the field in the list of the entry's fields
99       * 
100      * @param position
101      *            the position of the field in the list of fields
102      */
103     public void setPosition( int position )
104     {
105         _nPosition = position;
106     }
107 
108     /**
109      *
110      * @return the entry of the field
111      */
112     public IEntry getEntry( )
113     {
114         return _entry;
115     }
116 
117     /**
118      * set the entry of the field
119      * 
120      * @param entry
121      *            the entry of the field
122      */
123     public void setEntry( IEntry entry )
124     {
125         _entry = entry;
126     }
127 
128     /**
129      *
130      * @return a list of regular expression which is associate to the field
131      */
132     public List<RegularExpression> getRegularExpressionList( )
133     {
134         return _listRegularExpressionList;
135     }
136 
137     /**
138      * set a list of regular expression which is associate to the field
139      * 
140      * @param regularExpressionList
141      *            a list of regular expression which is associate to the field
142      */
143     public void setRegularExpressionList( List<RegularExpression> regularExpressionList )
144     {
145         _listRegularExpressionList = regularExpressionList;
146     }
147 
148     /**
149      *
150      * @return the title of the field
151      */
152     public String getTitle( )
153     {
154         return _strTitle;
155     }
156 
157     /**
158      * set the title of the field
159      * 
160      * @param title
161      *            the title of the field
162      */
163     public void setTitle( String title )
164     {
165         _strTitle = title;
166     }
167 
168     /**
169      *
170      * @return the value of the field
171      */
172     public String getValue( )
173     {
174         return _strValue;
175     }
176 
177     /**
178      * set the value of the field
179      * 
180      * @param value
181      *            the value of the field
182      */
183     public void setValue( String value )
184     {
185         _strValue = value;
186     }
187 
188     /**
189      *
190      * @return the width of the field
191      */
192     public int getWidth( )
193     {
194         return _nWidth;
195     }
196 
197     /**
198      * set the width of the field
199      * 
200      * @param width
201      *            the width of the field
202      */
203     public void setWidth( int width )
204     {
205         this._nWidth = width;
206     }
207 
208     /**
209      *
210      * @return the height of the field
211      */
212     public int getHeight( )
213     {
214         return _nHeight;
215     }
216 
217     /**
218      * set the height of the field
219      * 
220      * @param height
221      *            the height of the field
222      */
223     public void setHeight( int height )
224     {
225         _nHeight = height;
226     }
227 
228     /**
229      *
230      * @return true if the field is a default field of the entry
231      */
232     public boolean isDefaultValue( )
233     {
234         return _bDefaultValue;
235     }
236 
237     /**
238      * set true if the field is a default field of the entry
239      * 
240      * @param defaultValue
241      *            true if the field is a default field of the entry
242      */
243     public void setDefaultValue( boolean defaultValue )
244     {
245         _bDefaultValue = defaultValue;
246     }
247 
248     /**
249      *
250      * @return true if the field is shown in result list
251      */
252     public boolean isShownInResultList( )
253     {
254         return _bShownInResultList;
255     }
256 
257     /**
258      * set true if the field is shown in result list
259      * 
260      * @param bShown
261      *            True if the field is shown in the result list, false otherwise
262      */
263     public void setShownInResultList( boolean bShown )
264     {
265         _bShownInResultList = bShown;
266     }
267 
268     /**
269      *
270      * @return true if the field is shown in result record
271      */
272     public boolean isShownInResultRecord( )
273     {
274         return _bShownInResultRecord;
275     }
276 
277     /**
278      * set true if the field is shown in result record
279      * 
280      * @param bShown
281      *            True if the field is shown in the result list, false otherwise
282      */
283     public void setShownInResultRecord( boolean bShown )
284     {
285         _bShownInResultRecord = bShown;
286     }
287 
288     /**
289      *
290      * @return the max size of enter user
291      */
292     public int getMaxSizeEnter( )
293     {
294         return _nMaxSizeEnter;
295     }
296 
297     /**
298      * set the max size of enter user
299      * 
300      * @param maxSizeEnter
301      *            the max size of enter user
302      */
303     public void setMaxSizeEnter( int maxSizeEnter )
304     {
305         _nMaxSizeEnter = maxSizeEnter;
306     }
307 
308     /**
309      *
310      * @return the value of type Date
311      */
312     public Date getValueTypeDate( )
313     {
314         return _tValueTypeDate;
315     }
316 
317     /**
318      * set the value of type Date
319      * 
320      * @param defaultValueTypeDate
321      *            the value of type Date
322      */
323     public void setValueTypeDate( Date defaultValueTypeDate )
324     {
325         _tValueTypeDate = defaultValueTypeDate;
326     }
327 
328     /**
329      * Gets the field role
330      * 
331      * @return field role as a String
332      *
333      */
334     public String getRoleKey( )
335     {
336         return _strRoleKey;
337     }
338 
339     /**
340      * Sets the field's role
341      * 
342      * @param strRole
343      *            The role
344      *
345      */
346     public void setRoleKey( String strRole )
347     {
348         _strRoleKey = strRole;
349     }
350 
351     /**
352      * {@inheritDoc}
353      */
354     @Override
355     public String getWorkgroup( )
356     {
357         return _strWorkgroupKey;
358     }
359 
360     /**
361      * set the work group associate to the field
362      * 
363      * @param workGroup
364      *            the work group associate to the field
365      */
366     public void setWorkgroup( String workGroup )
367     {
368         _strWorkgroupKey = workGroup;
369     }
370 
371     /**
372      * Gets the field ImageType
373      * 
374      * @return field ImageType as a String
375      *
376      */
377     public String getImageType( )
378     {
379         return _strImageType;
380     }
381 
382     /**
383      * Sets the field's ImageType
384      * 
385      * @param strImageType
386      *            The Image Type
387      *
388      */
389     public void setImageType( String strImageType )
390     {
391         _strImageType = strImageType;
392     }
393 }