1
|
/**
|
2
|
* '$RCSfile$'
|
3
|
* Copyright: 2005 University of New Mexico and the
|
4
|
* Regents of the University of California and the
|
5
|
* National Center for Ecological Analysis and Synthesis
|
6
|
* '$Author: costa $'
|
7
|
* '$Date: 2006-06-14 08:31:06 -0700 (Wed, 14 Jun 2006) $'
|
8
|
* '$Revision: 3006 $'
|
9
|
*
|
10
|
* This program is free software; you can redistribute it and/or modify
|
11
|
* it under the terms of the GNU General Public License as published by
|
12
|
* the Free Software Foundation; either version 2 of the License, or
|
13
|
* (at your option) any later version.
|
14
|
*
|
15
|
* This program is distributed in the hope that it will be useful,
|
16
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
* GNU General Public License for more details.
|
19
|
*
|
20
|
* You should have received a copy of the GNU General Public License
|
21
|
* along with this program; if not, write to the Free Software
|
22
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
*/
|
24
|
|
25
|
package edu.ucsb.nceas.metacat.advancedsearch;
|
26
|
|
27
|
import java.io.Serializable;
|
28
|
|
29
|
/**
|
30
|
* @author dcosta
|
31
|
*
|
32
|
* The AdvancedSearchBean class stores query properties and values for
|
33
|
* conducting an advanced Metacat search.
|
34
|
*/
|
35
|
public class AdvancedSearchBean implements Serializable {
|
36
|
|
37
|
static final long serialVersionUID = 0; // Needed for Eclipse warning.
|
38
|
|
39
|
// Possible values for the various ___QueryType fields. These are translated
|
40
|
// to the various "searchmode" values in the Metacat pathquery.
|
41
|
public static final int CONTAINS = 0; // LIKE "%word%"
|
42
|
public static final int EXACT_MATCH = 1; // LIKE = "word"
|
43
|
public static final int STARTS_WITH = 2; // LIKE "word%"
|
44
|
public static final int ENDS_WITH = 3; // LIKE "%word"
|
45
|
|
46
|
// Possible values for subjectAllAny field
|
47
|
public static final int MATCH_ALL = 0;
|
48
|
public static final int MATCH_ANY = 1;
|
49
|
|
50
|
private boolean boundaryContained;
|
51
|
private boolean caseSensitive;
|
52
|
private String creatorOrganization;
|
53
|
private int creatorOrganizationQueryType;
|
54
|
private String creatorSurname;
|
55
|
private int creatorSurnameQueryType;
|
56
|
private String dateField; // "PUBLICATION", "COLLECTION", or "ALL"
|
57
|
private String eastBound;
|
58
|
private String endDate;
|
59
|
private int formAllAny; // MATCH_ALL or MATCH_ANY
|
60
|
private String locationName;
|
61
|
private String namedTimescale;
|
62
|
private int namedTimescaleQueryType;
|
63
|
private String northBound;
|
64
|
private String southBound;
|
65
|
private String siteValue;
|
66
|
private String startDate;
|
67
|
private int subjectAllAny; // MATCH_ALL or MATCH_ANY
|
68
|
private String subjectField; // "ALL", "TITLE", "ABSTRACT", or "KEYWORD"
|
69
|
private int subjectQueryType;
|
70
|
private String subjectValue;
|
71
|
private String taxon;
|
72
|
private int taxonQueryType;
|
73
|
private String westBound;
|
74
|
|
75
|
|
76
|
/**
|
77
|
* @return Returns the creatorOrganization.
|
78
|
*/
|
79
|
public String getCreatorOrganization() {
|
80
|
return creatorOrganization == null ? null : creatorOrganization.trim();
|
81
|
}
|
82
|
|
83
|
|
84
|
/**
|
85
|
* @return Returns the creatorOrganizationQueryType.
|
86
|
*/
|
87
|
public int getCreatorOrganizationQueryType() {
|
88
|
return creatorOrganizationQueryType;
|
89
|
}
|
90
|
|
91
|
|
92
|
/**
|
93
|
* @return Returns the creatorSurname.
|
94
|
*/
|
95
|
public String getCreatorSurname() {
|
96
|
return creatorSurname == null ? null : creatorSurname.trim();
|
97
|
}
|
98
|
|
99
|
|
100
|
/**
|
101
|
* @return Returns the creatorSurnameQueryType.
|
102
|
*/
|
103
|
public int getCreatorSurnameQueryType() {
|
104
|
return creatorSurnameQueryType;
|
105
|
}
|
106
|
|
107
|
|
108
|
/**
|
109
|
* @return Returns the dateField. Possible values: "PUBLICATION", "COLLECTION"
|
110
|
*/
|
111
|
public String getDateField() {
|
112
|
return dateField == null ? null : dateField.trim();
|
113
|
}
|
114
|
|
115
|
|
116
|
/**
|
117
|
* @return Returns the eastBound.
|
118
|
*/
|
119
|
public String getEastBound() {
|
120
|
return eastBound;
|
121
|
}
|
122
|
|
123
|
|
124
|
/**
|
125
|
* @return Returns the endDate.
|
126
|
*/
|
127
|
public String getEndDate() {
|
128
|
return endDate == null ? null : endDate.trim();
|
129
|
}
|
130
|
|
131
|
|
132
|
/**
|
133
|
* @return Returns the formAllAny value. Possible values are 0 or 1.
|
134
|
*/
|
135
|
public int getFormAllAny() {
|
136
|
return formAllAny;
|
137
|
}
|
138
|
|
139
|
|
140
|
/**
|
141
|
* @return Returns the locationName.
|
142
|
*/
|
143
|
public String getLocationName() {
|
144
|
return locationName == null ? null : locationName.trim();
|
145
|
}
|
146
|
|
147
|
|
148
|
/**
|
149
|
* @return Returns the namedTimescale.
|
150
|
*/
|
151
|
public String getNamedTimescale() {
|
152
|
return namedTimescale == null ? null : namedTimescale.trim();
|
153
|
}
|
154
|
|
155
|
|
156
|
/**
|
157
|
* @return Returns the namedTimescaleQueryType.
|
158
|
*/
|
159
|
public int getNamedTimescaleQueryType() {
|
160
|
return namedTimescaleQueryType;
|
161
|
}
|
162
|
|
163
|
|
164
|
/**
|
165
|
* @return Returns the northBound.
|
166
|
*/
|
167
|
public String getNorthBound() {
|
168
|
return northBound;
|
169
|
}
|
170
|
|
171
|
|
172
|
/**
|
173
|
* @return Returns the siteValue string.
|
174
|
*/
|
175
|
public String getSiteValue() {
|
176
|
return siteValue;
|
177
|
}
|
178
|
|
179
|
|
180
|
/**
|
181
|
* @return Returns the southBound.
|
182
|
*/
|
183
|
public String getSouthBound() {
|
184
|
return southBound;
|
185
|
}
|
186
|
|
187
|
|
188
|
/**
|
189
|
* @return Returns the startDate.
|
190
|
*/
|
191
|
public String getStartDate() {
|
192
|
return startDate == null ? null : startDate.trim();
|
193
|
}
|
194
|
|
195
|
|
196
|
/**
|
197
|
* @return Returns the subjectAllAny value. Possible values are 0 or 1.
|
198
|
*/
|
199
|
public int getSubjectAllAny() {
|
200
|
return subjectAllAny;
|
201
|
}
|
202
|
|
203
|
|
204
|
/**
|
205
|
* @return Returns the subjectField. Possible values are:
|
206
|
* "ALL", "TITLE", "ABSTRACT", "KEYWORD"
|
207
|
*/
|
208
|
public String getSubjectField() {
|
209
|
return subjectField;
|
210
|
}
|
211
|
|
212
|
|
213
|
/**
|
214
|
* @return Returns the subjectQueryType. Possible values are:
|
215
|
* 0 (contains), 1 (exact match), 2 (starts with), 3 (ends with).
|
216
|
*/
|
217
|
public int getSubjectQueryType() {
|
218
|
return subjectQueryType;
|
219
|
}
|
220
|
|
221
|
|
222
|
/**
|
223
|
* @return Returns the subjectValue.
|
224
|
*/
|
225
|
public String getSubjectValue() {
|
226
|
return subjectValue == null ? null : subjectValue.trim();
|
227
|
}
|
228
|
|
229
|
|
230
|
/**
|
231
|
* @return Returns the taxon.
|
232
|
*/
|
233
|
public String getTaxon() {
|
234
|
return taxon == null ? null : taxon.trim();
|
235
|
}
|
236
|
|
237
|
|
238
|
/**
|
239
|
* @return Returns the taxonConditonType.
|
240
|
*/
|
241
|
public int getTaxonQueryType() {
|
242
|
return taxonQueryType;
|
243
|
}
|
244
|
|
245
|
|
246
|
/**
|
247
|
* @return Returns the westBound.
|
248
|
*/
|
249
|
public String getWestBound() {
|
250
|
return westBound;
|
251
|
}
|
252
|
|
253
|
|
254
|
/**
|
255
|
* @return Returns the boundaryContained value.
|
256
|
*/
|
257
|
public boolean isBoundaryContained() {
|
258
|
return boundaryContained;
|
259
|
}
|
260
|
|
261
|
|
262
|
/**
|
263
|
* @return Returns the caseSensitive value;
|
264
|
*/
|
265
|
public boolean isCaseSensitive() {
|
266
|
return caseSensitive;
|
267
|
}
|
268
|
|
269
|
|
270
|
/**
|
271
|
* Boolean to determine whether a string is empty. A string is considered to
|
272
|
* be empty if its value is either null or "".
|
273
|
*
|
274
|
* @param s the string to check
|
275
|
* @return true if the string is empty, else false.
|
276
|
*/
|
277
|
public boolean isEmpty(String s) {
|
278
|
if (s != null && !s.equals(""))
|
279
|
return false;
|
280
|
else
|
281
|
return true;
|
282
|
}
|
283
|
|
284
|
|
285
|
/**
|
286
|
* @return Returns the limitedByBoundaries.
|
287
|
*/
|
288
|
public boolean isLimitedByBoundaries() {
|
289
|
if (!isEmpty(this.eastBound) && !isEmpty(this.westBound)) {
|
290
|
return true;
|
291
|
}
|
292
|
else if (!isEmpty(this.southBound) && !isEmpty(this.northBound)) {
|
293
|
return true;
|
294
|
}
|
295
|
else {
|
296
|
return false;
|
297
|
}
|
298
|
}
|
299
|
|
300
|
|
301
|
/**
|
302
|
* @return Returns the limitedByDate.
|
303
|
*/
|
304
|
public boolean isLimitedByDate() {
|
305
|
if (!isEmpty(this.endDate) || !isEmpty(this.startDate)) {
|
306
|
return true;
|
307
|
}
|
308
|
else {
|
309
|
return false;
|
310
|
}
|
311
|
}
|
312
|
|
313
|
|
314
|
/**
|
315
|
* @param boundaryContained The boundaryContained value to set.
|
316
|
*/
|
317
|
public void setBoundaryContained(final boolean boundaryContained) {
|
318
|
this.boundaryContained = boundaryContained;
|
319
|
}
|
320
|
|
321
|
|
322
|
/**
|
323
|
* @param caseSensitive The caseSensitive value to set.
|
324
|
*/
|
325
|
public void setCaseSensitive(final boolean caseSensitive) {
|
326
|
this.caseSensitive = caseSensitive;
|
327
|
}
|
328
|
|
329
|
|
330
|
/**
|
331
|
* @param creatorOrganization The creatorOrganization to set.
|
332
|
*/
|
333
|
public void setCreatorOrganization(final String creatorField) {
|
334
|
this.creatorOrganization = creatorField;
|
335
|
}
|
336
|
|
337
|
|
338
|
/**
|
339
|
* @param creatorOrganizationQueryType The creatorOrganizationQueryType to set
|
340
|
*/
|
341
|
public void setCreatorOrganizationQueryType(final int creatorConditionType) {
|
342
|
this.creatorOrganizationQueryType = creatorConditionType;
|
343
|
}
|
344
|
|
345
|
|
346
|
/**
|
347
|
* @param creatorSurname The creatorSurname to set.
|
348
|
*/
|
349
|
public void setCreatorSurname(final String creatorValue) {
|
350
|
this.creatorSurname = creatorValue;
|
351
|
}
|
352
|
|
353
|
|
354
|
/**
|
355
|
* @param creatorSurnameQueryType The creatorSurnameQueryType to set.
|
356
|
*/
|
357
|
public void setCreatorSurnameQueryType(final int creatorSurnameQueryType) {
|
358
|
this.creatorSurnameQueryType = creatorSurnameQueryType;
|
359
|
}
|
360
|
|
361
|
|
362
|
/**
|
363
|
* @param dateField The dateField to set.
|
364
|
*/
|
365
|
public void setDateField(final String dateField) {
|
366
|
this.dateField = dateField;
|
367
|
}
|
368
|
|
369
|
|
370
|
/**
|
371
|
* @param eastBound The eastBound to set.
|
372
|
*/
|
373
|
public void setEastBound(final String eastBound) {
|
374
|
this.eastBound = eastBound;
|
375
|
}
|
376
|
|
377
|
|
378
|
/**
|
379
|
* @param endDate The endDate to set.
|
380
|
*/
|
381
|
public void setEndDate(final String endDate) {
|
382
|
this.endDate = endDate;
|
383
|
}
|
384
|
|
385
|
|
386
|
/**
|
387
|
* @return Sets the formAllAny value. Possible values are
|
388
|
* MATCH_ALL (0) or MATCH_ANY (1).
|
389
|
*/
|
390
|
public void setFormAllAny(final int allAny) {
|
391
|
this.formAllAny = allAny;
|
392
|
}
|
393
|
|
394
|
|
395
|
/**
|
396
|
* @param locationName The locationName to set.
|
397
|
*/
|
398
|
public void setLocationName(final String locationName) {
|
399
|
this.locationName = locationName;
|
400
|
}
|
401
|
|
402
|
|
403
|
/**
|
404
|
* @param namedTimescale The namedTimescale to set.
|
405
|
*/
|
406
|
public void setNamedTimescale(final String namedTimescale) {
|
407
|
this.namedTimescale = namedTimescale;
|
408
|
}
|
409
|
|
410
|
|
411
|
/**
|
412
|
* @param namedTimescaleQueryType The namedTimescaleQueryType to set.
|
413
|
*/
|
414
|
public void setNamedTimescaleQueryType(final int namedTimescaleQueryType) {
|
415
|
this.namedTimescaleQueryType = namedTimescaleQueryType;
|
416
|
}
|
417
|
|
418
|
|
419
|
/**
|
420
|
* @param northBound The northBound to set.
|
421
|
*/
|
422
|
public void setNorthBound(final String northBound) {
|
423
|
this.northBound = northBound;
|
424
|
}
|
425
|
|
426
|
|
427
|
/**
|
428
|
* @param siteValue the siteValue to set.
|
429
|
*/
|
430
|
public void setSiteValue(final String siteValue) {
|
431
|
this.siteValue = siteValue;
|
432
|
}
|
433
|
|
434
|
|
435
|
/**
|
436
|
* @param southBound The southBound to set.
|
437
|
*/
|
438
|
public void setSouthBound(final String southBound) {
|
439
|
this.southBound = southBound;
|
440
|
}
|
441
|
|
442
|
|
443
|
/**
|
444
|
* @param startDate The startDate to set.
|
445
|
*/
|
446
|
public void setStartDate(final String startDate) {
|
447
|
this.startDate = startDate;
|
448
|
}
|
449
|
|
450
|
|
451
|
/**
|
452
|
* Sets the subjectAllAny value.
|
453
|
*
|
454
|
* @param allAny Possible values are MATCH_ALL (0) or MATCH_ANY (1).
|
455
|
*/
|
456
|
public void setSubjectAllAny(final int allAny) {
|
457
|
this.subjectAllAny = allAny;
|
458
|
}
|
459
|
|
460
|
|
461
|
/**
|
462
|
* @param subjectField The subjectField to set.
|
463
|
*/
|
464
|
public void setSubjectField(final String subjectField) {
|
465
|
this.subjectField = subjectField;
|
466
|
}
|
467
|
|
468
|
|
469
|
/**
|
470
|
* @param subjectQueryType The subjectQueryType to set. Possible values are:
|
471
|
* 0 (contains), 1 (exact match), 2 (starts with),
|
472
|
* 3 (ends with).
|
473
|
*/
|
474
|
public void setSubjectQueryType(final int subjectQueryType) {
|
475
|
this.subjectQueryType = subjectQueryType;
|
476
|
}
|
477
|
|
478
|
|
479
|
/**
|
480
|
* @param subjectValue The subjectValue to set.
|
481
|
*/
|
482
|
public void setSubjectValue(final String subjectValue) {
|
483
|
this.subjectValue = subjectValue;
|
484
|
}
|
485
|
|
486
|
|
487
|
/**
|
488
|
* @param taxon The taxon to set.
|
489
|
*/
|
490
|
public void setTaxon(final String taxon) {
|
491
|
this.taxon = taxon;
|
492
|
}
|
493
|
|
494
|
|
495
|
/**
|
496
|
* @param taxonQueryType The taxonQueryType to set.
|
497
|
*/
|
498
|
public void setTaxonQueryType(final int taxonQueryType) {
|
499
|
this.taxonQueryType = taxonQueryType;
|
500
|
}
|
501
|
|
502
|
|
503
|
/**
|
504
|
* @param westBound The westBound to set.
|
505
|
*/
|
506
|
public void setWestBound(final String westBound) {
|
507
|
this.westBound = westBound;
|
508
|
}
|
509
|
|
510
|
}
|