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  /**
37   *
38   * class EntryFilter
39   *
40   */
41  public class EntryFilter
42  {
43      public static final String ALL_STRING = "all";
44      public static final int ALL_INT = -1;
45      public static final int FILTER_FALSE = 0;
46      public static final int FILTER_TRUE = 1;
47      private int _nIdDirectory = ALL_INT;
48      private int _nIdEntryParent = ALL_INT;
49      private int _nIsEntryParentNull = ALL_INT;
50      private int _nIsGroup = ALL_INT;
51      private int _nIsComment = ALL_INT;
52      private int _nIsMyLuteceUser = ALL_INT;
53      private int _nIsIndexed = ALL_INT;
54      private int _nIsIndexedAsTitle = ALL_INT;
55      private int _nIsIndexedAsSummary = ALL_INT;
56      private int _nIsShownInResultList = ALL_INT;
57      private int _nIsWorkgroupAssociated = ALL_INT;
58      private int _nIsRoleAssociated = ALL_INT;
59      private int _nIsShownInHistory = ALL_INT;
60      private int _nIsAutocompleteEntry = ALL_INT;
61      private int _nIdType = ALL_INT;
62      private int _nIdEntryAssociate = ALL_INT;
63      private int _nPosition = ALL_INT;
64      private int _nIsShownInResultRecord = ALL_INT;
65      private int _nIsShownInExport = ALL_INT;
66      private int _nIsShownInCompleteness = ALL_INT;
67  
68      /**
69       *
70       * @return the position
71       */
72      public int getPosition( )
73      {
74          return _nPosition;
75      }
76  
77      /**
78       * set position
79       * 
80       * @param nPosition
81       *            the position
82       */
83      public void setPosition( int nPosition )
84      {
85          _nPosition = nPosition;
86      }
87  
88      /**
89       *
90       * @return true if the filter contain an position
91       */
92      public boolean containsPosition( )
93      {
94          return ( _nPosition != ALL_INT );
95      }
96  
97      /**
98       *
99       * @return the entry associate id
100      */
101     public int getIdEntryAssociate( )
102     {
103         return _nIdEntryAssociate;
104     }
105 
106     /**
107      * set the entry associate id
108      * 
109      * @param idType
110      *            the entry type associate
111      */
112     public void setIdEntryAssociate( int idType )
113     {
114         _nIdEntryAssociate = idType;
115     }
116 
117     /**
118      *
119      * @return true if the filter contain an entry associate id
120      */
121     public boolean containsIdEntryAssociate( )
122     {
123         return ( _nIdEntryAssociate != ALL_INT );
124     }
125 
126     /**
127      *
128      * @return the entry type id
129      */
130     public int getIdType( )
131     {
132         return _nIdType;
133     }
134 
135     /**
136      * set the entry type id
137      * 
138      * @param idType
139      *            the entry typr
140      */
141     public void setIdType( int idType )
142     {
143         _nIdType = idType;
144     }
145 
146     /**
147      *
148      * @return true if the filter contain an entry type id
149      */
150     public boolean containsIdType( )
151     {
152         return ( _nIdType != ALL_INT );
153     }
154 
155     /**
156      *
157      * @return the id of the directory insert in the filter
158      */
159     public int getIdDirectory( )
160     {
161         return _nIdDirectory;
162     }
163 
164     /**
165      * set the id of the directory in the filter
166      * 
167      * @param idDirectory
168      *            the id of the directory to insert in the filter
169      */
170     public void setIdDirectory( int idDirectory )
171     {
172         _nIdDirectory = idDirectory;
173     }
174 
175     /**
176      *
177      * @return true if the filter contain an id of form
178      */
179     public boolean containsIdDirectory( )
180     {
181         return ( _nIdDirectory != ALL_INT );
182     }
183 
184     /**
185      *
186      * @return the id of parent entry insert in the filter
187      */
188     public int getIdEntryParent( )
189     {
190         return _nIdEntryParent;
191     }
192 
193     /**
194      * set the id of parent entry
195      * 
196      * @param idEntryParent
197      *            the id of parent entry to insert in the filter
198      */
199     public void setIdEntryParent( int idEntryParent )
200     {
201         _nIdEntryParent = idEntryParent;
202     }
203 
204     /**
205      *
206      * @return true if the filter contain an parent id
207      */
208     public boolean containsIdEntryParent( )
209     {
210         return ( _nIdEntryParent != ALL_INT );
211     }
212 
213     /**
214      *
215      * @return 1 if the entry parent must be null,0 if the entry parent must not be null
216      */
217     public int getIsEntryParentNull( )
218     {
219         return _nIsEntryParentNull;
220     }
221 
222     /**
223      * set 1 if parent entry must be null 0 if parent entry must not be null
224      * 
225      * @param nEntryParentNull
226      *            1 if parent entry must be null 0 if parent entry must not be null
227      */
228     public void setIsEntryParentNull( int nEntryParentNull )
229     {
230         _nIsEntryParentNull = nEntryParentNull;
231     }
232 
233     /**
234      *
235      * @return true if the filter is initialized
236      */
237     public boolean containsIsEntryParentNull( )
238     {
239         return ( _nIsEntryParentNull != ALL_INT );
240     }
241 
242     /**
243      *
244      * @return 1 if the entry must be a group,0 if the entry must not be a group
245      */
246     public int getIsGroup( )
247     {
248         return _nIsGroup;
249     }
250 
251     /**
252      * set 1 if the entry must be a group,0 if the entry must not a group
253      * 
254      * @param isGroup
255      *            1 if the entry must be a group,0 if the entry must not be a group
256      */
257     public void setIsGroup( int isGroup )
258     {
259         _nIsGroup = isGroup;
260     }
261 
262     /**
263      *
264      * @return true if the filter is initialized
265      */
266     public boolean containsIsGroup( )
267     {
268         return ( _nIsGroup != ALL_INT );
269     }
270 
271     /**
272      *
273      * @return 1 if the entry must be a comment,0 if the entry must not be a comment
274      */
275     public int getIsComment( )
276     {
277         return _nIsComment;
278     }
279 
280     /**
281      * set 1 if the entry must be a comment,0 if the entry must not be a comment
282      * 
283      * @param isComment
284      *            1 if the entry must be a comment,0 if the entry must not be a comment
285      */
286     public void setIsComment( int isComment )
287     {
288         _nIsComment = isComment;
289     }
290 
291     /**
292      *
293      * @return true if the entry must be a comment or must not be a comment
294      */
295     public boolean containsIsComment( )
296     {
297         return ( _nIsComment != ALL_INT );
298     }
299 
300     /**
301      *
302      * @return 1 if the entry associate to the record field must be in the result list, O if the entry associate to the record field must not be in the result
303      *         list
304      */
305     public int getIsShownInResultList( )
306     {
307         return _nIsShownInResultList;
308     }
309 
310     /**
311      * set 1 if the entry associate to the record field must be in the result list, O if the entry associate to the record field must not be in the result list
312      * 
313      * @param nIsShown
314      *            1 if the entry associate to the record field must be in the result list
315      */
316     public void setIsShownInResultList( int nIsShown )
317     {
318         _nIsShownInResultList = nIsShown;
319     }
320 
321     /**
322      *
323      * @return true if the filter is initialized
324      */
325     public boolean containsIsShownInResultList( )
326     {
327         return ( _nIsShownInResultList != ALL_INT );
328     }
329 
330     /**
331      *
332      * @return 1 if the entry associate to the record field must be in the result record, 0 if the entry associate to the record field must not be in the result
333      *         record
334      */
335     public int getIsShownInResultRecord( )
336     {
337         return _nIsShownInResultRecord;
338     }
339 
340     /**
341      * set 1 if the entry associate to the record field must be in the result record, 0 if the entry associate to the record field must not be in the result
342      * record
343      * 
344      * @param nIsShownInResultRecord
345      *            1 if the entry associate to the record field must be in the result list
346      */
347     public void setIsShownInResultRecord( int nIsShownInResultRecord )
348     {
349         _nIsShownInResultRecord = nIsShownInResultRecord;
350     }
351 
352     /**
353      *
354      * @return true if the filter is initialized
355      */
356     public boolean containsIsShownInResultRecord( )
357     {
358         return ( _nIsShownInResultRecord != ALL_INT );
359     }
360 
361     /**
362      *
363      * @return 1 if the entry associate to the record field must be in the history, O if the entry associate to the record field must not be in the history
364      */
365     public int getIsShownInHistory( )
366     {
367         return _nIsShownInHistory;
368     }
369 
370     /**
371      * set 1 if the entry associate to the record field must be in the history, O if the entry associate to the record field must not be in the history
372      * 
373      * @param nIsShown
374      *            1 if the entry associate to the record field must be in the history
375      */
376     public void setIsShownInHistory( int nIsShown )
377     {
378         _nIsShownInHistory = nIsShown;
379     }
380 
381     /**
382      *
383      * @return true if the filter is initialized
384      */
385     public boolean containsIsShownInHistory( )
386     {
387         return ( _nIsShownInHistory != ALL_INT );
388     }
389 
390     /**
391      *
392      * @return 1 if the entry associate to the record field is autocompleted, O if the entry associate to the record field is autocompleted
393      */
394     public int getIsAutocompleteEntry( )
395     {
396         return _nIsAutocompleteEntry;
397     }
398 
399     /**
400      * set 1 if the entry associate to the record field is autocompleted, O if the entry associate to the record field is autocompleted
401      * 
402      * @param nIsAutocompleteEntry
403      *            1 if the entry associate to the record field is autocompleted
404      */
405     public void setIsAutocompleteEntry( int nIsAutocompleteEntry )
406     {
407         _nIsAutocompleteEntry = nIsAutocompleteEntry;
408     }
409 
410     /**
411      *
412      * @return true if the filter is initialized
413      */
414     public boolean containsIsAutocompleteEntry( )
415     {
416         return ( _nIsAutocompleteEntry != ALL_INT );
417     }
418 
419     /**
420      *
421      * @return 1 if the entry must be indexed,0 if the entry must not be indexed
422      */
423     public int getIsIndexed( )
424     {
425         return _nIsIndexed;
426     }
427 
428     /**
429      * set 1 if the entry must be indexed,0 if the entry must not be a indexed
430      * 
431      * @param isIndexed
432      *            1 if the entry must be indexed,0 if the entry must not be indexed
433      */
434     public void setIsIndexed( int isIndexed )
435     {
436         _nIsIndexed = isIndexed;
437     }
438 
439     /**
440      *
441      * @return true if the entry must be indexed or must not be indexed
442      */
443     public boolean containsIsIndexed( )
444     {
445         return ( _nIsIndexed != ALL_INT );
446     }
447 
448     /**
449      *
450      * @return 1 if the entry should be (part of) the title of the document in the global index, 0 otherwise
451      */
452     public int getIsIndexedAsTitle( )
453     {
454         return _nIsIndexedAsTitle;
455     }
456 
457     /**
458      * set 1 if the entry should be (part of) the title of the document in the global index, 0 otherwise
459      * 
460      * @param isIndexedAsTitle
461      *            1 if the entry should be (part of) the title of the document in the global index, 0 otherwise
462      */
463     public void setIsIndexedAsTitle( int isIndexedAsTitle )
464     {
465         _nIsIndexedAsTitle = isIndexedAsTitle;
466     }
467 
468     /**
469      *
470      * @return true if the entry should be (part of) the title of the document in the global index, false otherwise
471      */
472     public boolean containsIsIndexedAsTitle( )
473     {
474         return ( _nIsIndexedAsTitle != ALL_INT );
475     }
476 
477     /**
478      *
479      * @return 1 if the entry should be (part of) the summary of the document in the global index, 0 otherwise
480      */
481     public int getIsIndexedAsSummary( )
482     {
483         return _nIsIndexedAsSummary;
484     }
485 
486     /**
487      * set 1 if the entry should be (part of) the summary of the document in the global index, 0 otherwise
488      * 
489      * @param isIndexedAsSummary
490      *            1 if the entry should be (part of) the summary of the document in the global index, 0 otherwise
491      */
492     public void setIsIndexedAsSummary( int isIndexedAsSummary )
493     {
494         _nIsIndexedAsSummary = isIndexedAsSummary;
495     }
496 
497     /**
498      *
499      * @return true if the entry should be (part of) the summary of the document in the global index, false otherwise
500      */
501     public boolean containsIsIndexedAsSummary( )
502     {
503         return ( _nIsIndexedAsSummary != ALL_INT );
504     }
505 
506     /**
507      *
508      * @return 1 if the entry must be associated with workgroup ,0 if the entry must not be associated with workgroup
509      */
510     public int getIsWorkgroupAssociated( )
511     {
512         return _nIsWorkgroupAssociated;
513     }
514 
515     /**
516      * set 1 if the entry must be associated with workgroup ,0 if the entry must not be associated with workgroup
517      * 
518      * @param isWorkgroupAssociated
519      *            1 if the entry must be associated with workgroup ,0 if the entry must not be associated with workgroup
520      */
521     public void setIsWorkgroupAssociated( int isWorkgroupAssociated )
522     {
523         _nIsWorkgroupAssociated = isWorkgroupAssociated;
524     }
525 
526     /**
527      *
528      * @return true if the entry must be associated with workgroup or must not be associated with workgroup
529      */
530     public boolean containsIsWorkgroupAssociated( )
531     {
532         return ( _nIsWorkgroupAssociated != ALL_INT );
533     }
534 
535     /**
536      *
537      * @return 1 if the entry must be associated with role ,0 if the entry must not be associated with role
538      */
539     public int getIsRoleAssociated( )
540     {
541         return _nIsRoleAssociated;
542     }
543 
544     /**
545      * set 1 if the entry must be associated with role,0 if the entry must not be associated with role
546      * 
547      * @param isRoleAssociated
548      *            1 if the entry must be associated with role ,0 if the entry must not be associated with role
549      */
550     public void setIsRoleAssociated( int isRoleAssociated )
551     {
552         _nIsRoleAssociated = isRoleAssociated;
553     }
554 
555     /**
556      *
557      * @return true if the entry must be associated with role or must not be associated with role
558      */
559     public boolean containsIsRoleAssociated( )
560     {
561         return ( _nIsRoleAssociated != ALL_INT );
562     }
563 
564     /**
565      *
566      * @return 1 if the entry associate to the record field is shown in export, O if the entry associate to the record field is shown in export
567      */
568     public int getIsShownInExport( )
569     {
570         return _nIsShownInExport;
571     }
572 
573     /**
574      * set 1 if the entry associate to the record field is shown in export, O if the entry associate to the record field is shown in export
575      * 
576      * @param nIsShownInExport
577      *            1 if the entry associate to the record field is shown in export
578      */
579     public void setIsShownInExport( int nIsShownInExport )
580     {
581         _nIsShownInExport = nIsShownInExport;
582     }
583 
584     /**
585      *
586      * @return true if the filter is initialized
587      */
588     public boolean containsIsShownInExport( )
589     {
590         return ( _nIsShownInExport != ALL_INT );
591     }
592 
593     /**
594      *
595      * @return 1 if the entry associate to the record field is shown in record completeness, O if the entry associate to the record field is shown in record
596      *         completeness
597      */
598     public int getIsShownInCompleteness( )
599     {
600         return _nIsShownInCompleteness;
601     }
602 
603     /**
604      * set 1 if the entry associate to the record field is shown in record completeness, O if the entry associate to the record field is shown in record
605      * completeness
606      * 
607      * @param nIsShownInCompleteness
608      *            1 if the entry associate to the record field is shown in record completeness
609      */
610     public void setIsShownInCompleteness( int nIsShownInCompleteness )
611     {
612         _nIsShownInCompleteness = nIsShownInCompleteness;
613     }
614 
615     /**
616      *
617      * @return true if the filter is initialized
618      */
619     public boolean containsIsShownInCompleteness( )
620     {
621         return ( _nIsShownInCompleteness != ALL_INT );
622     }
623 
624     /**
625      *
626      * @return 1 if the entry must be a MyluteceUser,0 if the entry must not be a MyluteceUser
627      */
628     public int getIsMyLuteceUser( )
629     {
630         return _nIsMyLuteceUser;
631     }
632 
633     /**
634      * set 1 if the entry must be a MyluteceUser,0 if the entry must not be a MyluteceUser
635      * 
636      * @param isMyLuteceUser
637      *            1 if the entry must be a MyluteceUser,0 if the entry must not be a MyluteceUser
638      */
639     public void setIsMyLuteceUser( int isMyLuteceUser )
640     {
641         _nIsMyLuteceUser = isMyLuteceUser;
642     }
643 
644     /**
645      *
646      * @return true if the entry must be a MyluteceUser or must not be a MyluteceUser
647      */
648     public boolean containsIsMyLuteceUser( )
649     {
650         return ( _nIsMyLuteceUser != ALL_INT );
651     }
652 }