Project

General

Profile

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: 2005-11-16 09:57:33 -0800 (Wed, 16 Nov 2005) $'
8
 * '$Revision: 2741 $'
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
  // Possible values for the various ___QueryType fields. These are translated
38
  // to the various "searchmode" values in the Metacat pathquery.
39
  public static final int CONTAINS = 0;     // LIKE "%word%"
40
  public static final int EXACT_MATCH = 1; 	// LIKE = "word"
41
  public static final int STARTS_WITH = 2;	// LIKE "word%"
42
  public static final int ENDS_WITH = 3;    // LIKE "%word"
43
	
44
  // Possible values for subjectAllAny field
45
  public static final int MATCH_ALL = 0;
46
  public static final int MATCH_ANY = 1;
47
	
48
  private boolean boundaryContained;
49
  private boolean caseSensitive;
50
  private String  creatorOrganization;
51
  private int     creatorOrganizationQueryType;
52
  private String  creatorSurname;
53
  private int     creatorSurnameQueryType;
54
  private String  dateField;      // "PUBLICATION", "COLLECTION", or "ALL"
55
  private String  eastBound;
56
  private String  endDate;
57
  private int     formAllAny;     // MATCH_ALL or MATCH_ANY
58
  private String  locationName;
59
  private String  namedTimescale;
60
  private int     namedTimescaleQueryType;
61
  private String  northBound;
62
  private String  southBound;
63
  private String  siteValue;
64
  private String  startDate;
65
  private int     subjectAllAny;  // MATCH_ALL or MATCH_ANY
66
  private String  subjectField;   // "ALL", "TITLE", "ABSTRACT", or "KEYWORD"
67
  private int     subjectQueryType;
68
  private String  subjectValue;
69
  private String  taxon;
70
  private int     taxonQueryType;
71
  private String  westBound;
72

    
73

    
74
  /**
75
   * @return Returns the creatorOrganization.
76
   */
77
  public String getCreatorOrganization() {
78
    return creatorOrganization;
79
  }
80
  
81
  
82
  /**
83
   * @return Returns the creatorOrganizationQueryType.
84
   */
85
  public int getCreatorOrganizationQueryType() {
86
    return creatorOrganizationQueryType;
87
  }
88
  
89
  
90
  /**
91
   * @return Returns the creatorSurname.
92
   */
93
  public String getCreatorSurname() {
94
    return creatorSurname;
95
  }
96
  
97
  
98
  /**
99
   * @return Returns the creatorSurnameQueryType.
100
   */
101
  public int getCreatorSurnameQueryType() {
102
    return creatorSurnameQueryType;
103
  }
104
  
105
  
106
  /**
107
   * @return Returns the dateField. Possible values: "PUBLICATION", "COLLECTION" 
108
   */
109
  public String getDateField() {
110
    return dateField;
111
  }
112
  
113
  
114
  /**
115
   * @return Returns the eastBound.
116
   */
117
  public String getEastBound() {
118
    return eastBound;
119
  }
120
  
121
  
122
  /**
123
   * @return Returns the endDate.
124
   */
125
  public String getEndDate() {
126
    return endDate;
127
  }
128
  
129
  
130
  /**
131
   * @return Returns the formAllAny value.  Possible values are 0 or 1.      
132
   */
133
  public int getFormAllAny() {
134
    return formAllAny;
135
  }
136
  
137
  
138
  /**
139
   * @return Returns the locationName.
140
   */
141
  public String getLocationName() {
142
    return locationName;
143
  }
144
  
145
  
146
  /**
147
   * @return Returns the namedTimescale.
148
   */
149
  public String getNamedTimescale() {
150
    return namedTimescale;
151
  }
152
  
153
  
154
  /**
155
   * @return Returns the namedTimescaleQueryType.
156
   */
157
  public int getNamedTimescaleQueryType() {
158
    return namedTimescaleQueryType;
159
  }
160
  
161
  
162
  /**
163
   * @return Returns the northBound.
164
   */
165
  public String getNorthBound() {
166
    return northBound;
167
  }
168
  
169
  
170
  /**
171
   * @return Returns the siteValue string.
172
   */
173
  public String getSiteValue() {
174
    return siteValue;
175
  }
176
  
177
  
178
  /**
179
   * @return Returns the southBound.
180
   */
181
  public String getSouthBound() {
182
    return southBound;
183
  }
184
  
185
  
186
  /**
187
   * @return Returns the startDate.
188
   */
189
  public String getStartDate() {
190
    return startDate;
191
  }
192
  
193
  
194
  /**
195
   * @return Returns the subjectAllAny value.  Possible values are 0 or 1.      
196
   */
197
  public int getSubjectAllAny() {
198
    return subjectAllAny;
199
  }
200
  
201
  
202
  /**
203
   * @return Returns the subjectField.  Possible values are:
204
   *         "ALL", "TITLE", "ABSTRACT", "KEYWORD"
205
   */
206
  public String getSubjectField() {
207
    return subjectField;
208
  }
209
  
210
  
211
  /**
212
   * @return Returns the subjectQueryType. Possible values are:
213
   * 0 (contains), 1 (exact match), 2 (starts with), 3 (ends with).
214
   */
215
  public int getSubjectQueryType() {
216
    return subjectQueryType;
217
  }
218
  
219
  
220
  /**
221
   * @return Returns the subjectValue.
222
   */
223
  public String getSubjectValue() {
224
    return subjectValue;
225
  }
226
  
227
  
228
  /**
229
   * @return Returns the taxon.
230
   */
231
  public String getTaxon() {
232
    return taxon;
233
  }
234
  
235
  
236
  /**
237
   * @return Returns the taxonConditonType.
238
   */
239
  public int getTaxonQueryType() {
240
    return taxonQueryType;
241
  }
242
  
243
  
244
  /**
245
   * @return Returns the westBound.
246
   */
247
  public String getWestBound() {
248
    return westBound;
249
  }
250
  
251
  
252
  /**
253
   * @return Returns the boundaryContained value.
254
   */
255
  public boolean isBoundaryContained() {
256
    return boundaryContained;
257
  }
258
  
259

    
260
  /**
261
   * @return Returns the caseSensitive value;
262
   */
263
  public boolean isCaseSensitive() {
264
    return caseSensitive;
265
  }
266
  
267

    
268
  /**
269
   * Boolean to determine whether a string is empty. A string is considered to
270
   * be empty if its value is either null or "".
271
   * 
272
   * @param  s      the string to check
273
   * @return        true if the string is empty, else false.
274
   */
275
  public boolean isEmpty(String s) {
276
    if (s != null && !s.equals(""))
277
      return false;
278
    else
279
      return true;
280
  }
281
  
282
  
283
  /**
284
   * @return Returns the limitedByBoundaries.
285
   */
286
  public boolean isLimitedByBoundaries() {
287
    if (!isEmpty(this.eastBound) && !isEmpty(this.westBound)) {
288
      return true;
289
    }
290
    else if (!isEmpty(this.southBound) && !isEmpty(this.northBound)) {
291
      return true;
292
    }
293
    else {
294
      return false;
295
    }
296
  }
297

    
298
  
299
  /**
300
   * @return Returns the limitedByDate.
301
   */
302
  public boolean isLimitedByDate() {
303
    if (!isEmpty(this.endDate) || !isEmpty(this.startDate)) {
304
      return true;
305
    }
306
    else {
307
      return false;
308
    }
309
  }
310

    
311

    
312
  /**
313
   * @param boundaryContained The boundaryContained value to set.
314
   */
315
  public void setBoundaryContained(final boolean boundaryContained) {
316
    this.boundaryContained = boundaryContained;
317
  }
318
  
319
  
320
  /**
321
   * @param caseSensitive The caseSensitive value to set.
322
   */
323
  public void setCaseSensitive(final boolean caseSensitive) {
324
    this.caseSensitive = caseSensitive;
325
  }
326
  
327
  
328
  /**
329
   * @param creatorOrganization The creatorOrganization to set.
330
   */
331
  public void setCreatorOrganization(final String creatorField) {
332
    this.creatorOrganization = creatorField;
333
  }
334
  
335
  
336
  /**
337
   * @param creatorOrganizationQueryType The creatorOrganizationQueryType to set
338
   */
339
  public void setCreatorOrganizationQueryType(final int creatorConditionType) {
340
    this.creatorOrganizationQueryType = creatorConditionType;
341
  }
342
  
343
  
344
  /**
345
   * @param creatorSurname   The creatorSurname to set.
346
   */
347
  public void setCreatorSurname(final String creatorValue) {
348
    this.creatorSurname = creatorValue;
349
  }
350
  
351
  
352
  /**
353
   * @param creatorSurnameQueryType   The creatorSurnameQueryType to set.
354
   */
355
  public void setCreatorSurnameQueryType(final int creatorSurnameQueryType) {
356
    this.creatorSurnameQueryType = creatorSurnameQueryType;
357
  }
358

    
359

    
360
  /**
361
   * @param dateField The dateField to set.
362
   */
363
  public void setDateField(final String dateField) {
364
    this.dateField = dateField;
365
  }
366
  
367
  
368
  /**
369
   * @param eastBound The eastBound to set.
370
   */
371
  public void setEastBound(final String eastBound) {
372
    this.eastBound = eastBound;
373
  }
374
  
375
  
376
  /**
377
   * @param endDate The endDate to set.
378
   */
379
  public void setEndDate(final String endDate) {
380
    this.endDate = endDate;
381
  }
382
  
383
  
384
  /**
385
   * @return Sets the formAllAny value.  Possible values are
386
   *         MATCH_ALL (0) or MATCH_ANY (1).  
387
   */
388
  public void setFormAllAny(final int allAny) {
389
    this.formAllAny = allAny;
390
  }
391
  
392
  
393
  /**
394
   * @param locationName The locationName to set.
395
   */
396
  public void setLocationName(final String locationName) {
397
    this.locationName = locationName;
398
  }
399
  
400
  
401
  /**
402
   * @param namedTimescale The namedTimescale to set.
403
   */
404
  public void setNamedTimescale(final String namedTimescale) {
405
    this.namedTimescale = namedTimescale;
406
  }
407
  
408
  
409
  /**
410
   * @param namedTimescaleQueryType The namedTimescaleQueryType to set.
411
   */
412
  public void setNamedTimescaleQueryType(final int namedTimescaleQueryType) {
413
    this.namedTimescaleQueryType = namedTimescaleQueryType;
414
  }
415
  
416
  
417
  /**
418
   * @param northBound The northBound to set.
419
   */
420
  public void setNorthBound(final String northBound) {
421
    this.northBound = northBound;
422
  }
423

    
424
  
425
  /**
426
   * @param siteValue    the siteValue to set.
427
   */
428
  public void setSiteValue(final String siteValue) {
429
    this.siteValue = siteValue;
430
  }
431
  
432

    
433
  /**
434
   * @param southBound The southBound to set.
435
   */
436
  public void setSouthBound(final String southBound) {
437
    this.southBound = southBound;
438
  }
439
  
440
  
441
  /**
442
   * @param startDate The startDate to set.
443
   */
444
  public void setStartDate(final String startDate) {
445
    this.startDate = startDate;
446
  }
447
  
448
  
449
  /**
450
   * Sets the subjectAllAny value.  
451
   * 
452
   * @param allAny Possible values are MATCH_ALL (0) or MATCH_ANY (1).  
453
   */
454
  public void setSubjectAllAny(final int allAny) {
455
    this.subjectAllAny = allAny;
456
  }
457
  
458
  
459
  /**
460
   * @param subjectField The subjectField to set.
461
   */
462
  public void setSubjectField(final String subjectField) {
463
    this.subjectField = subjectField;
464
  }
465
  
466
  
467
  /**
468
   * @param subjectQueryType The subjectQueryType to set. Possible values are:
469
   *                         0 (contains), 1 (exact match), 2 (starts with), 
470
   *                         3 (ends with).   
471
   */
472
  public void setSubjectQueryType(final int subjectQueryType) {
473
    this.subjectQueryType = subjectQueryType;
474
  }
475
  
476
  
477
  /**
478
   * @param subjectValue The subjectValue to set.
479
   */
480
  public void setSubjectValue(final String subjectValue) {
481
    this.subjectValue = subjectValue;
482
  }
483
  
484
  
485
  /**
486
   * @param taxon The taxon to set.
487
   */
488
  public void setTaxon(final String taxon) {
489
    this.taxon = taxon;
490
  }
491
  
492
  
493
  /**
494
   * @param taxonQueryType The taxonQueryType to set.
495
   */
496
  public void setTaxonQueryType(final int taxonQueryType) {
497
    this.taxonQueryType = taxonQueryType;
498
  }
499
  
500
  
501
  /**
502
   * @param westBound The westBound to set.
503
   */
504
  public void setWestBound(final String westBound) {
505
    this.westBound = westBound;
506
  }
507

    
508
}
(2-2/14)