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 DirectoryFilter
39 *
40 */
41 public class DirectoryFilter
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 _nIsDisabled = ALL_INT;
48 private String _strWorkgroup = ALL_STRING;
49 private int _nIdWorkflow = ALL_INT;
50 private int _nIsIndexed = ALL_INT;
51 private String _strOrder;
52
53 /**
54 *
55 * @return 1 if the directories return must be enabled 0 if the forms return must be disabled
56 */
57 public int getIsDisabled( )
58 {
59 return _nIsDisabled;
60 }
61
62 /**
63 * Set 1 if the directories return must be enabled 0 if the forms return must be disabled
64 *
65 * @param idState
66 * 1 if the forms return must be enabled 0 if the directories return must be disabled
67 */
68 public void setIsDisabled( int idState )
69 {
70 _nIsDisabled = idState;
71 }
72
73 /**
74 * Check if the filter contains isDisabled state
75 *
76 * @return true if the filter contain isDisabled state
77 */
78 public boolean containsIsDisabled( )
79 {
80 return ( _nIsDisabled != ALL_INT );
81 }
82
83 /**
84 *
85 * @return the workgroup of the search forms
86 */
87 public String getWorkgroup( )
88 {
89 return _strWorkgroup;
90 }
91
92 /**
93 * set the workgroup of the search forms
94 *
95 * @param workgroup
96 * the workgroup of the workflow
97 */
98 public void setWorkGroup( String workgroup )
99 {
100 _strWorkgroup = workgroup;
101 }
102
103 /**
104 *
105 * @return true if the filter contain workgroup criteria
106 */
107 public boolean containsWorkgroupCriteria( )
108 {
109 return ( !_strWorkgroup.equals( ALL_STRING ) );
110 }
111
112 /**
113 *
114 * @return 1 if the forms have workflow 0 if the forms have not workflow
115 */
116 public int getIdWorkflow( )
117 {
118 return _nIdWorkflow;
119 }
120
121 /**
122 * Set 1 if the forms have workflow 0 if the forms have not workflow
123 *
124 * @param idWorkflow
125 * 1 if the forms return must be enabled, 0 if the forms return must be disabled
126 */
127 public void setIdWorkflow( int idWorkflow )
128 {
129 _nIdWorkflow = idWorkflow;
130 }
131
132 /**
133 *
134 * @return true if the filter contain form state
135 */
136 public boolean containsIdWorkflow( )
137 {
138 return ( _nIdWorkflow != ALL_INT );
139 }
140
141 /**
142 *
143 * @return 1 if the directories return must be Indexed 0 if the forms return must not be Indexed
144 */
145 public int getIsIndexed( )
146 {
147 return _nIsIndexed;
148 }
149
150 /**
151 * Set 1 if the directories return must be indexed 0 if the directories return must be indexed
152 *
153 * @param idState
154 * 1 if the directories return must be indexed 0 if the forms return must not be indexed
155 */
156 public void setIsIndexed( int idState )
157 {
158 _nIsIndexed = idState;
159 }
160
161 /**
162 * Check if the filter contains isIndexed state
163 *
164 * @return true if the filter contains isIndexed state
165 */
166 public boolean containsIsIndexed( )
167 {
168 return ( _nIsIndexed != ALL_INT );
169 }
170
171 /**
172 * @return the _strOrder
173 */
174 public String getOrder( )
175 {
176 return this._strOrder;
177 }
178
179 /**
180 * @param strOrder
181 * the _strOrder to set
182 */
183 public void setOrder( String strOrder )
184 {
185 this._strOrder = strOrder;
186 }
187 }