01: package org.sakaiproject.citation.util.impl;
02:
03: import java.util.Set;
04:
05: public class SearchQuery implements
06: org.sakaiproject.citation.util.api.SearchQuery {
07: private InputStringParser isp = new InputStringParser();
08: private Set<String> keywords;
09: private Set<String> title;
10: private Set<String> authors;
11: private Set<String> subjects;
12: private Set<String> year;
13:
14: public Set<String> getKeywords() {
15: return keywords;
16: }
17:
18: public void addKeywords(String keywords) {
19: if (this .keywords == null) {
20: this .keywords = new java.util.HashSet<String>();
21: }
22:
23: if (keywords != null && !keywords.trim().equals("")) {
24: Set<String> keywordSet = isp.parseInputString(keywords);
25: for (String keyword : keywordSet) {
26: this .keywords.add(keyword);
27: }
28: }
29: }
30:
31: public Set<String> getTitles() {
32: return title;
33: }
34:
35: public void addTitle(String title) {
36: if (this .title == null) {
37: this .title = new java.util.HashSet<String>();
38: }
39:
40: if (title != null && !title.trim().equals("")) {
41: this .title.add(title);
42: }
43: }
44:
45: public Set<String> getYears() {
46: return year;
47: }
48:
49: public void addYear(String year) {
50: if (this .year == null) {
51: this .year = new java.util.HashSet<String>();
52: }
53:
54: if (year != null && !year.trim().equals("")) {
55: this .year.add(year);
56: }
57: }
58:
59: public void addAuthor(String author) {
60: if (authors == null) {
61: authors = new java.util.HashSet<String>();
62: }
63:
64: if (author != null && !author.trim().equals("")) {
65: authors.add(author);
66: }
67: }
68:
69: public Set<String> getAuthors() {
70: return authors;
71: }
72:
73: public void addSubject(String subject) {
74: if (subjects == null) {
75: subjects = new java.util.HashSet<String>();
76: }
77:
78: if (subject != null && !subject.trim().equals("")) {
79: Set<String> subjectSet = isp.parseInputString(subject);
80: for (String subj : subjectSet) {
81: subjects.add(subj);
82: }
83: }
84: }
85:
86: public Set<String> getSubjects() {
87: return subjects;
88: }
89: }
|