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