1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.services.wcm.search;
18
19 import java.util.Calendar;
20
21 import org.exoplatform.services.wcm.utils.AbstractQueryBuilder.COMPARISON_TYPE;
22
23
24
25
26
27
28
29
30
31
32
33 public class QueryCriteria {
34
35
36 public static final String ALL_PROPERTY_SCOPE = ".";
37
38
39 private String siteName;
40
41
42 private String[] categoryUUIDs = null;
43
44
45 private String[] tagUUIDs = null;
46
47
48 private DatetimeRange startPublicationDateRange = null;
49
50
51 private DatetimeRange endPublicationDateRange = null;
52
53
54 private String[] authors = null;
55
56
57 private String[] contentTypes = null;
58
59
60 private String[] mimeTypes = null;
61
62
63 private String[] nodeTypes = null;
64
65
66 private DatetimeRange createdDateRange = null;
67
68
69 private DatetimeRange lastModifiedDateRange = null;
70
71
72 private boolean searchWebpage = true;
73
74
75 private boolean searchDocument = true;
76
77
78 private String keyword = null;
79
80
81 private boolean searchWebContent = true;
82
83
84 private boolean fulltextSearch = true;
85
86
87 private boolean fuzzySearch = false;
88
89
90 private boolean isLiveMode = true;
91
92
93 private long offset = -1;
94
95
96 private long limit = -1;
97
98
99 private String sortBy_ = null;
100
101
102 private String orderBy_ = null;
103
104 private String searchPath_ = null;
105
106
107
108
109
110 private String pageMode = SiteSearchService.PAGE_MODE_NONE;
111
112 public String getPageMode() {
113 return pageMode;
114 }
115
116 public void setPageMode(String pageMode) {
117 this.pageMode = pageMode;
118 }
119
120 public long getOffset() { return offset; }
121
122 public void setOffset(long offset) { this.offset = offset; }
123
124 public long getLimit() { return limit; }
125
126 public void setLimit(long value) { this.limit = value; }
127
128 public String getSortBy() { return sortBy_; }
129
130 public void setSortBy(String value) { sortBy_ = value; }
131
132 public String getOrderBy() { return orderBy_; }
133
134 public void setOrderBy(String value) { orderBy_ = value; }
135
136 public String getSearchPath() { return searchPath_; }
137
138 public void setSearchPath(String value) { searchPath_ = value; }
139
140
141
142
143
144
145 public boolean isLiveMode() {
146 return isLiveMode;
147 }
148
149
150
151
152
153
154 public void setLiveMode(boolean isLiveMode) {
155 this.isLiveMode = isLiveMode;
156 }
157
158
159 private QueryProperty[] queryMetadatas = null;
160
161
162 private String[] fulltextSearchProperty = new String[] { ALL_PROPERTY_SCOPE };
163
164
165 private DATE_RANGE_SELECTED dateRangeSelected = null;
166
167
168
169
170
171
172 public String getSiteName() { return siteName; }
173
174
175
176
177
178
179 public void setSiteName(String siteName) { this.siteName = siteName; }
180
181
182
183
184
185
186
187 public String[] getAuthors() { return authors; }
188
189
190
191
192
193
194 public void setAuthors(String[] authors) { this.authors = authors; }
195
196
197
198
199
200
201 public String[] getContentTypes() { return contentTypes; }
202
203
204
205
206
207
208
209
210 public void setContentTypes(String[] contentTypes) { this.contentTypes = contentTypes; }
211
212
213
214
215
216
217 public String[] getMimeTypes() { return mimeTypes; }
218
219
220
221
222
223
224 public void setMimeTypes(String[] mimeTypes) { this.mimeTypes = mimeTypes; }
225
226
227 public String[] getNodeTypes() {
228 return nodeTypes;
229 }
230
231 public void setNodeTypes(String[] nodeTypes) {
232 this.nodeTypes = nodeTypes;
233 }
234
235
236
237
238
239
240 public DatetimeRange getStartPublicationDateRange() {
241 return startPublicationDateRange;
242 }
243
244
245
246
247
248
249 public void setStartPublicationDateRange(DatetimeRange startPublicationDateRange) {
250 this.startPublicationDateRange = startPublicationDateRange;
251 }
252
253
254
255
256
257
258 public DatetimeRange getEndPublicationDateRange() {
259 return endPublicationDateRange;
260 }
261
262
263
264
265
266
267 public void setEndPublicationDateRange(DatetimeRange endPublicationDateRange) {
268 this.endPublicationDateRange = endPublicationDateRange;
269 }
270
271
272
273
274
275
276 public DatetimeRange getCreatedDateRange() {
277 return createdDateRange;
278 }
279
280
281
282
283
284
285 public void setCreatedDateRange(DatetimeRange createdDateRange) {
286 this.createdDateRange = createdDateRange;
287 }
288
289
290
291
292
293
294 public DatetimeRange getLastModifiedDateRange() {
295 return lastModifiedDateRange;
296 }
297
298
299
300
301
302
303 public void setLastModifiedDateRange(DatetimeRange lastModifiedDateRange) {
304 this.lastModifiedDateRange = lastModifiedDateRange;
305 }
306
307
308
309
310
311
312 public boolean isFulltextSearch() {
313 return fulltextSearch;
314 }
315
316
317
318
319
320
321 public boolean isFuzzySearch() {
322 return fuzzySearch;
323 }
324
325
326
327
328
329
330
331 public void setFulltextSearch(boolean fulltextSearch) {
332 this.fulltextSearch = fulltextSearch;
333 }
334
335
336
337
338
339
340 public void setFuzzySearch(boolean fuzzySearch) {
341 this.fuzzySearch = fuzzySearch;
342 }
343
344
345
346
347
348
349 public String getKeyword() { return this.keyword; }
350
351
352
353
354
355
356 public void setKeyword(String s) { this.keyword = s; }
357
358
359
360
361
362
363 public boolean isSearchWebpage() { return searchWebpage;}
364
365
366
367
368
369
370 public void setSearchWebpage(boolean searchWebpage) {
371 this.searchWebpage = searchWebpage;
372 }
373
374
375
376
377
378
379 public boolean isSearchDocument() { return searchDocument;}
380
381
382
383
384
385
386 public void setSearchDocument(boolean searchDocument) {
387 this.searchDocument = searchDocument;
388 }
389
390
391
392
393
394
395 public boolean isSearchWebContent() {
396 return searchWebContent;
397 }
398
399
400
401
402
403
404 public void setSearchWebContent(boolean searchWebContent) {
405 this.searchWebContent = searchWebContent;
406 }
407
408
409
410
411 public static class DatetimeRange {
412
413
414 private Calendar fromDate;
415
416
417 private Calendar toDate;
418
419
420
421
422
423
424
425 public DatetimeRange(Calendar fromDate, Calendar toDate) {
426 this.fromDate = fromDate;
427 this.toDate = toDate;
428 }
429
430
431
432
433
434
435 public Calendar getFromDate() {
436 return fromDate;
437 }
438
439
440
441
442
443
444 public void setFromDate(Calendar fromDate) {
445 this.fromDate = fromDate;
446 }
447
448
449
450
451
452
453 public Calendar getToDate() {
454 return toDate;
455 }
456
457
458
459
460
461
462 public void setToDate(Calendar toDate) {
463 this.toDate = toDate;
464 }
465 }
466
467
468
469
470 public enum DATE_RANGE_SELECTED {
471
472 CREATED,
473 MODIFIDED,
474 START_PUBLICATION,
475 END_PUBLICATION
476 }
477
478
479
480
481
482
483 public DATE_RANGE_SELECTED getDateRangeSelected() {
484 return dateRangeSelected;
485 }
486
487
488
489
490
491
492 public void setDateRangeSelected(DATE_RANGE_SELECTED dateRangeSelected) {
493 this.dateRangeSelected = dateRangeSelected;
494 }
495
496
497
498
499
500
501 public String[] getCategoryUUIDs() {
502 return categoryUUIDs;
503 }
504
505
506
507
508
509
510 public void setCategoryUUIDs(String[] categoryUUIDs) {
511 this.categoryUUIDs = categoryUUIDs;
512 }
513
514
515
516
517
518
519 public String[] getTagUUIDs() {
520 return tagUUIDs;
521 }
522
523
524
525
526
527
528 public void setTagUUIDs(String[] tagUUIDs) {
529 this.tagUUIDs = tagUUIDs;
530 };
531
532
533
534
535
536 public class QueryProperty {
537
538
539 private String name;
540
541
542 private String value;
543
544
545 private COMPARISON_TYPE comparisonType;
546
547
548
549
550
551
552 public String getName() {
553 return name;
554 }
555
556
557
558
559
560
561 public void setName(String name) {
562 this.name = name;
563 }
564
565
566
567
568
569
570 public String getValue() {
571 return value;
572 }
573
574
575
576
577
578
579 public void setValue(String value) {
580 this.value = value;
581 }
582
583
584
585
586 public void setComparisonType(COMPARISON_TYPE comparisonType) {
587 this.comparisonType = comparisonType;
588 }
589
590
591
592
593 public COMPARISON_TYPE getComparisonType() {
594 if (comparisonType == null) {
595 return COMPARISON_TYPE.LIKE;
596 }
597 return comparisonType;
598 }
599 }
600
601
602
603
604
605
606
607 public QueryProperty[] getQueryMetadatas() {
608 return queryMetadatas;
609 }
610
611
612
613
614
615
616 public void setQueryMetadatas(QueryProperty[] queryMetadatas) {
617 this.queryMetadatas = queryMetadatas;
618 }
619
620
621
622
623
624
625 public String[] getFulltextSearchProperty() {
626 return fulltextSearchProperty;
627 }
628
629
630
631
632
633
634 public void setFulltextSearchProperty(String[] fulltextSearchProperty) {
635 this.fulltextSearchProperty = fulltextSearchProperty;
636 }
637 }