001// license-header java merge-point 002// 003// Attention: Generated code! Do not modify by hand! 004// Generated by: hibernate/search/SearchParameter.java.vsl in andromda-spring-cartridge. 005// 006package fr.ifremer.adagio.core.dao; 007 008/* 009 * #%L 010 * SIH-Adagio :: Core 011 * $Id:$ 012 * $HeadURL:$ 013 * %% 014 * Copyright (C) 2012 - 2014 Ifremer 015 * %% 016 * This program is free software: you can redistribute it and/or modify 017 * it under the terms of the GNU Affero General Public License as published by 018 * the Free Software Foundation, either version 3 of the License, or 019 * (at your option) any later version. 020 * 021 * This program is distributed in the hope that it will be useful, 022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 024 * GNU General Public License for more details. 025 * 026 * You should have received a copy of the GNU Affero General Public License 027 * along with this program. If not, see <http://www.gnu.org/licenses/>. 028 * #L% 029 */ 030 031import java.io.Serializable; 032 033/** 034 * Represents a generic search parameter that can be used with property 035 * searches. 036 * 037 * @see PropertySearch 038 */ 039public class SearchParameter 040 implements Serializable 041{ 042 /** 0 */ 043 public static final int LIKE_COMPARATOR = 0; 044 /** 1 */ 045 public static final int INSENSITIVE_LIKE_COMPARATOR = 1; 046 /** 2 */ 047 public static final int EQUAL_COMPARATOR = 2; 048 /** 3 */ 049 public static final int GREATER_THAN_OR_EQUAL_COMPARATOR = 3; 050 /** 4 */ 051 public static final int GREATER_THAN_COMPARATOR = 4; 052 /** 5 */ 053 public static final int LESS_THAN_OR_EQUAL_COMPARATOR = 5; 054 /** 6 */ 055 public static final int LESS_THAN_COMPARATOR = 6; 056 /** 7 */ 057 public static final int IN_COMPARATOR = 7; 058 /** 8 */ 059 public static final int NOT_EQUAL_COMPARATOR = 8; 060 /** 9 */ 061 public static final int NOT_NULL_COMPARATOR = 9; 062 /** 10 */ 063 public static final int NULL_COMPARATOR = 10; 064 /** 11 */ 065 public static final int NOT_IN_COMPARATOR = 11; 066 /** 12 */ 067 public static final int NOT_LIKE_COMPARATOR = 12; 068 /** 13 */ 069 public static final int NOT_INSENSITIVE_LIKE_COMPARATOR = 13; 070 /** 14 */ 071 public static final int EMPTY_COMPARATOR = 14; 072 /** 15 */ 073 public static final int NOT_EMPTY_COMPARATOR = 15; 074 075 /** Order unset */ 076 public static final int ORDER_UNSET = -1; 077 078 /** Ascending order */ 079 public static final int ORDER_ASC = 0; 080 081 /** Descending order */ 082 public static final int ORDER_DESC = 1; 083 084 /** 0 */ 085 public static final int MATCH_ANYWHERE = 0; 086 /** 1 */ 087 public static final int MATCH_START = 1; 088 /** 2 */ 089 public static final int MATCH_END = 2; 090 /** 3 */ 091 public static final int MATCH_EXACT = 3; 092 093 /** 094 * Constructor taking name and value properties. 095 * @param nameIn 096 * @param valueIn 097 */ 098 public SearchParameter( 099 String nameIn, 100 Object valueIn) 101 { 102 this(nameIn, valueIn, EQUAL_COMPARATOR); 103 } 104 105 /** 106 * Constructor taking name and comparator properties. 107 * @param nameIn 108 * @param comparatorIn 109 */ 110 public SearchParameter( 111 String nameIn, 112 int comparatorIn) 113 { 114 this(nameIn, null, comparatorIn); 115 } 116 117 /** 118 * Constructor taking name, value and comparator properties. 119 * @param nameIn 120 * @param valueIn 121 * @param comparatorIn 122 */ 123 public SearchParameter( 124 String nameIn, 125 Object valueIn, 126 int comparatorIn) 127 { 128 this(nameIn, valueIn, comparatorIn, MATCH_EXACT); 129 } 130 131 /** 132 * Constructor taking name, value, comparator and order properties. 133 * @param nameIn 134 * @param valueIn 135 * @param comparatorIn 136 * @param matchIn 137 */ 138 public SearchParameter( 139 String nameIn, 140 Object valueIn, 141 int comparatorIn, 142 int matchIn) 143 { 144 this(nameIn, valueIn, comparatorIn, matchIn, ORDER_UNSET); 145 } 146 147 /** 148 * Constructor taking name, value, comparator, order and match properties. 149 * @param nameIn 150 * @param valueIn 151 * @param comparatorIn 152 * @param matchIn 153 * @param orderIn 154 */ 155 public SearchParameter( 156 String nameIn, 157 Object valueIn, 158 int comparatorIn, 159 int matchIn, 160 int orderIn) 161 { 162 this(nameIn, valueIn, comparatorIn, matchIn, orderIn, false); 163 } 164 165 /** 166 * Constructor taking all properties. 167 * @param nameIn 168 * @param valueIn 169 * @param comparatorIn 170 * @param matchIn 171 * @param orderIn 172 * @param searchIfNullIn 173 */ 174 public SearchParameter( 175 String nameIn, 176 Object valueIn, 177 int comparatorIn, 178 int matchIn, 179 int orderIn, 180 boolean searchIfNullIn) 181 { 182 this.name = nameIn; 183 this.value = valueIn; 184 this.comparator = comparatorIn; 185 this.order = orderIn; 186 this.match = matchIn; 187 this.searchIfNull = searchIfNullIn; 188 } 189 190 /** 191 * Copies constructor from other SearchParameter 192 * @param otherBean 193 */ 194 public SearchParameter(SearchParameter otherBean) 195 { 196 if (otherBean != null) 197 { 198 this.name = otherBean.getName(); 199 this.value = otherBean.getValue(); 200 this.comparator = otherBean.getComparator(); 201 this.order = otherBean.getOrder(); 202 this.match = otherBean.getMatch(); 203 this.searchIfNull = otherBean.isSearchIfNull(); 204 } 205 } 206 207 208 private String name; 209 210 /** 211 * The parameter name in dot notation (i.e. person.firstNAme). 212 * @return name 213 */ 214 public String getName() 215 { 216 return this.name; 217 } 218 219 /** 220 * @param nameIn 221 */ 222 public void setName(String nameIn) 223 { 224 this.name = nameIn; 225 } 226 227 private Object value; 228 229 /** 230 * The value of the parameter. 231 * @return value 232 */ 233 public Object getValue() 234 { 235 return this.value; 236 } 237 238 /** 239 * @param valueIn 240 */ 241 public void setValue(Object valueIn) 242 { 243 this.value = valueIn; 244 } 245 246 private int comparator = EQUAL_COMPARATOR; 247 248 /** 249 * @return comparator 250 */ 251 public int getComparator() 252 { 253 return this.comparator; 254 } 255 256 /** 257 * @param comparatorIn 258 */ 259 public void setComparator(int comparatorIn) 260 { 261 this.comparator = comparatorIn; 262 } 263 264 private int order; 265 266 /** 267 * Order attribute to control if parameter is used in order by clause. 268 * @return order 269 */ 270 public int getOrder() 271 { 272 return this.order; 273 } 274 275 /** 276 * @param orderIn 277 */ 278 public void setOrder(int orderIn) 279 { 280 this.order = orderIn; 281 } 282 283 private boolean searchIfNull; 284 285 /** 286 * Whether this parameter will be included in the search even if it is <code>null</code>. 287 * @return true/false searchIfNull 288 */ 289 public boolean isSearchIfNull() 290 { 291 return this.searchIfNull; 292 } 293 294 /** 295 * Defines whether parameter will be included in the search even if it is <code>null</code>. 296 * 297 * @param searchIfNullIn <code>true</code> if the parameter should be included in the search 298 * even if it is null, <code>false</code> otherwise. 299 */ 300 public void setSearchIfNull(boolean searchIfNullIn) 301 { 302 this.searchIfNull = searchIfNullIn; 303 } 304 305 private int match; 306 307 /** 308 * Gets the match attribute which controls how parameter values are matched (anywhere, start, end or exact). 309 * 310 * @return the match mode 311 */ 312 public int getMatch() 313 { 314 return this.match; 315 } 316 317 /** 318 * Sets the match mode attribute which controls how parameter values are matched (anywhere, start, end or exact). 319 * @param matchIn the match mode 320 */ 321 public void setMatch(int matchIn) 322 { 323 this.match = matchIn; 324 } 325 326 private static final long serialVersionUID = 1L; 327}