KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > query > model > FullTextQuery


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.outerj.daisy.query.model;
17
18 import org.outerj.daisy.query.QueryContext;
19 import org.outerj.daisy.repository.query.QueryException;
20
21 public class FullTextQuery {
22     private String JavaDoc query;
23     private boolean searchName;
24     private boolean searchContent;
25     private boolean searchFields;
26     private long branchId = -1;
27     private long languageId = -1;
28     private String JavaDoc branch;
29     private String JavaDoc language;
30
31     public FullTextQuery(String JavaDoc query) {
32         this.query = query;
33     }
34
35     public void prepare(QueryContext context) throws QueryException {
36         if (branch != null) {
37             branchId = SqlUtils.parseBranch(branch, context);
38         }
39
40         if (language != null) {
41             languageId = SqlUtils.parseLanguage(language, context);
42         }
43     }
44
45     public void setSearchName(boolean searchName) {
46         this.searchName = searchName;
47     }
48
49     public void setSearchContent(boolean searchContent) {
50         this.searchContent = searchContent;
51     }
52
53     public void setSearchFields(boolean searchFields) {
54         this.searchFields = searchFields;
55     }
56
57     public void setBranchId(long branchId) {
58         this.branchId = branchId;
59     }
60
61     public void setLanguageId(long languageId) {
62         this.languageId = languageId;
63     }
64
65     public void setLanguage(String JavaDoc language) {
66         this.language = language;
67     }
68
69     public void setBranch(String JavaDoc branch) {
70         this.branch = branch;
71     }
72
73     public String JavaDoc getQuery() {
74         return query;
75     }
76
77     public boolean getSearchName() {
78         return searchName;
79     }
80
81     public boolean getSearchContent() {
82         return searchContent;
83     }
84
85     public boolean getSearchFields() {
86         return searchFields;
87     }
88
89     public long getBranchId() {
90         return branchId;
91     }
92
93     public long getLanguageId() {
94         return languageId;
95     }
96 }
97
Popular Tags