1 // license-header java merge-point
2 //
3 // Attention: Generated code! Do not modify by hand!
4 // Generated by: hibernate/search/SearchParameter.java.vsl in andromda-spring-cartridge.
5 //
6 package fr.ifremer.quadrige3.core.dao;
7
8 /*-
9 * #%L
10 * Quadrige3 Core :: Client API
11 * %%
12 * Copyright (C) 2017 - 2024 Ifremer
13 * %%
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Affero General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU Affero General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * #L%
27 */
28 import java.io.Serializable;
29
30 /**
31 * Represents a generic search parameter that can be used with property
32 * searches.
33 *
34 * @see PropertySearch
35 */
36 public class SearchParameter
37 implements Serializable
38 {
39 /** 0 */
40 public static final int LIKE_COMPARATOR = 0;
41 /** 1 */
42 public static final int INSENSITIVE_LIKE_COMPARATOR = 1;
43 /** 2 */
44 public static final int EQUAL_COMPARATOR = 2;
45 /** 3 */
46 public static final int GREATER_THAN_OR_EQUAL_COMPARATOR = 3;
47 /** 4 */
48 public static final int GREATER_THAN_COMPARATOR = 4;
49 /** 5 */
50 public static final int LESS_THAN_OR_EQUAL_COMPARATOR = 5;
51 /** 6 */
52 public static final int LESS_THAN_COMPARATOR = 6;
53 /** 7 */
54 public static final int IN_COMPARATOR = 7;
55 /** 8 */
56 public static final int NOT_EQUAL_COMPARATOR = 8;
57 /** 9 */
58 public static final int NOT_NULL_COMPARATOR = 9;
59 /** 10 */
60 public static final int NULL_COMPARATOR = 10;
61 /** 11 */
62 public static final int NOT_IN_COMPARATOR = 11;
63 /** 12 */
64 public static final int NOT_LIKE_COMPARATOR = 12;
65 /** 13 */
66 public static final int NOT_INSENSITIVE_LIKE_COMPARATOR = 13;
67 /** 14 */
68 public static final int EMPTY_COMPARATOR = 14;
69 /** 15 */
70 public static final int NOT_EMPTY_COMPARATOR = 15;
71
72 /** Order unset */
73 public static final int ORDER_UNSET = -1;
74
75 /** Ascending order */
76 public static final int ORDER_ASC = 0;
77
78 /** Descending order */
79 public static final int ORDER_DESC = 1;
80
81 /** 0 */
82 public static final int MATCH_ANYWHERE = 0;
83 /** 1 */
84 public static final int MATCH_START = 1;
85 /** 2 */
86 public static final int MATCH_END = 2;
87 /** 3 */
88 public static final int MATCH_EXACT = 3;
89
90 /**
91 * Constructor taking name and value properties.
92 * @param nameIn
93 * @param valueIn
94 */
95 public SearchParameter(
96 String nameIn,
97 Object valueIn)
98 {
99 this(nameIn, valueIn, EQUAL_COMPARATOR);
100 }
101
102 /**
103 * Constructor taking name and comparator properties.
104 * @param nameIn
105 * @param comparatorIn
106 */
107 public SearchParameter(
108 String nameIn,
109 int comparatorIn)
110 {
111 this(nameIn, null, comparatorIn);
112 }
113
114 /**
115 * Constructor taking name, value and comparator properties.
116 * @param nameIn
117 * @param valueIn
118 * @param comparatorIn
119 */
120 public SearchParameter(
121 String nameIn,
122 Object valueIn,
123 int comparatorIn)
124 {
125 this(nameIn, valueIn, comparatorIn, MATCH_EXACT);
126 }
127
128 /**
129 * Constructor taking name, value, comparator and order properties.
130 * @param nameIn
131 * @param valueIn
132 * @param comparatorIn
133 * @param matchIn
134 */
135 public SearchParameter(
136 String nameIn,
137 Object valueIn,
138 int comparatorIn,
139 int matchIn)
140 {
141 this(nameIn, valueIn, comparatorIn, matchIn, ORDER_UNSET);
142 }
143
144 /**
145 * Constructor taking name, value, comparator, order and match properties.
146 * @param nameIn
147 * @param valueIn
148 * @param comparatorIn
149 * @param matchIn
150 * @param orderIn
151 */
152 public SearchParameter(
153 String nameIn,
154 Object valueIn,
155 int comparatorIn,
156 int matchIn,
157 int orderIn)
158 {
159 this(nameIn, valueIn, comparatorIn, matchIn, orderIn, false);
160 }
161
162 /**
163 * Constructor taking all properties.
164 * @param nameIn
165 * @param valueIn
166 * @param comparatorIn
167 * @param matchIn
168 * @param orderIn
169 * @param searchIfNullIn
170 */
171 public SearchParameter(
172 String nameIn,
173 Object valueIn,
174 int comparatorIn,
175 int matchIn,
176 int orderIn,
177 boolean searchIfNullIn)
178 {
179 this.name = nameIn;
180 this.value = valueIn;
181 this.comparator = comparatorIn;
182 this.order = orderIn;
183 this.match = matchIn;
184 this.searchIfNull = searchIfNullIn;
185 }
186
187 /**
188 * Copies constructor from other SearchParameter
189 * @param otherBean
190 */
191 public SearchParameter(SearchParameter otherBean)
192 {
193 if (otherBean != null)
194 {
195 this.name = otherBean.getName();
196 this.value = otherBean.getValue();
197 this.comparator = otherBean.getComparator();
198 this.order = otherBean.getOrder();
199 this.match = otherBean.getMatch();
200 this.searchIfNull = otherBean.isSearchIfNull();
201 }
202 }
203
204
205 private String name;
206
207 /**
208 * The parameter name in dot notation (i.e. person.firstNAme).
209 * @return name
210 */
211 public String getName()
212 {
213 return this.name;
214 }
215
216 /**
217 * @param nameIn
218 */
219 public void setName(String nameIn)
220 {
221 this.name = nameIn;
222 }
223
224 private Object value;
225
226 /**
227 * The value of the parameter.
228 * @return value
229 */
230 public Object getValue()
231 {
232 return this.value;
233 }
234
235 /**
236 * @param valueIn
237 */
238 public void setValue(Object valueIn)
239 {
240 this.value = valueIn;
241 }
242
243 private int comparator = EQUAL_COMPARATOR;
244
245 /**
246 * @return comparator
247 */
248 public int getComparator()
249 {
250 return this.comparator;
251 }
252
253 /**
254 * @param comparatorIn
255 */
256 public void setComparator(int comparatorIn)
257 {
258 this.comparator = comparatorIn;
259 }
260
261 private int order;
262
263 /**
264 * Order attribute to control if parameter is used in order by clause.
265 * @return order
266 */
267 public int getOrder()
268 {
269 return this.order;
270 }
271
272 /**
273 * @param orderIn
274 */
275 public void setOrder(int orderIn)
276 {
277 this.order = orderIn;
278 }
279
280 private boolean searchIfNull;
281
282 /**
283 * Whether this parameter will be included in the search even if it is <code>null</code>.
284 * @return true/false searchIfNull
285 */
286 public boolean isSearchIfNull()
287 {
288 return this.searchIfNull;
289 }
290
291 /**
292 * Defines whether parameter will be included in the search even if it is <code>null</code>.
293 *
294 * @param searchIfNullIn <code>true</code> if the parameter should be included in the search
295 * even if it is null, <code>false</code> otherwise.
296 */
297 public void setSearchIfNull(boolean searchIfNullIn)
298 {
299 this.searchIfNull = searchIfNullIn;
300 }
301
302 private int match;
303
304 /**
305 * Gets the match attribute which controls how parameter values are matched (anywhere, start, end or exact).
306 *
307 * @return the match mode
308 */
309 public int getMatch()
310 {
311 return this.match;
312 }
313
314 /**
315 * Sets the match mode attribute which controls how parameter values are matched (anywhere, start, end or exact).
316 * @param matchIn the match mode
317 */
318 public void setMatch(int matchIn)
319 {
320 this.match = matchIn;
321 }
322
323 private static final long serialVersionUID = 1L;
324 }