KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > common > util > QueryInfo


1 /*
2  * Copyright 2004 Blandware (http://www.blandware.com)
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 com.blandware.atleap.common.util;
17
18 import java.io.Serializable JavaDoc;
19 import java.util.Collections JavaDoc;
20 import java.util.HashMap JavaDoc;
21 import java.util.Map JavaDoc;
22
23 /**
24  * <p>This class contains information to add to some query
25  * </p>
26  *
27  * @author Sergey Zubtcovskii <a HREF="mailto:sergey.zubtcovskii@blandware.com">&lt;sergey.zubtcovskii@blandware.com&gt;</a>
28  * @version $Revision: 1.6 $ $Date: 2005/08/02 14:53:33 $
29  */

30 public class QueryInfo implements Serializable JavaDoc {
31
32     /**
33      * WHERE clause without 'WHERE' keyword
34      */

35     private String JavaDoc whereClause = new String JavaDoc();
36
37     /**
38      * ORDER BY clause without 'ORDER BY' keyword
39      */

40     private String JavaDoc orderByClause = new String JavaDoc();
41
42     /**
43      * Number of records to include in result set
44      */

45     private Integer JavaDoc limit;
46
47     /**
48      * Value to start counting records from
49      */

50     private Integer JavaDoc offset;
51
52     /**
53      * Map of queryParameters to put in query
54      */

55     private Map JavaDoc queryParameters = Collections.synchronizedMap(new HashMap JavaDoc());
56
57     /**
58      * Creates new instance of QueryInfo
59      */

60     public QueryInfo() {
61     }
62
63     /**
64      * Creates new instance of QueryInfo
65      *
66      * @param whereClause WHERE clause without 'WHERE' keyword
67      * @param orderByClause ORDER BY clause without 'ORDER BY' keyword
68      * @param limit Number of records to include in result set
69      * @param offset Value to start counting records from
70      */

71     public QueryInfo(String JavaDoc whereClause, String JavaDoc orderByClause, Integer JavaDoc limit, Integer JavaDoc offset) {
72         this.whereClause = whereClause;
73         this.orderByClause = orderByClause;
74         this.limit = limit;
75         this.offset = offset;
76         queryParameters = Collections.synchronizedMap(new HashMap JavaDoc());
77     }
78
79     /**
80      * Gets the WHERE clause
81      *
82      * @return the WHERE clause
83      */

84     public String JavaDoc getWhereClause() {
85         return whereClause;
86     }
87
88     /**
89      * Sets the WHERE clause
90      *
91      * @param whereClause the WHERE clause to set
92      */

93     public void setWhereClause(String JavaDoc whereClause) {
94         this.whereClause = whereClause;
95     }
96
97     /**
98      * Gets the ORDER BY clause
99      *
100      * @return the ORDER BY clause
101      */

102     public String JavaDoc getOrderByClause() {
103         return orderByClause;
104     }
105
106     /**
107      * Sets the ORDER BY clause
108      *
109      * @param orderByClause the ORDER BY clause to set
110      */

111     public void setOrderByClause(String JavaDoc orderByClause) {
112         this.orderByClause = orderByClause;
113     }
114
115     /**
116      * Gets the limit (the maximum number of returned objects)
117      *
118      * @return the limit
119      */

120     public Integer JavaDoc getLimit() {
121         return limit;
122     }
123
124     /**
125      * Sets the limit (the maximum number of returned objects)
126      *
127      * @param limit the limit to set
128      */

129     public void setLimit(Integer JavaDoc limit) {
130         this.limit = limit;
131     }
132
133     /**
134      * Gets offset (the number of first object to return)
135      *
136      * @return the offset
137      */

138     public Integer JavaDoc getOffset() {
139         return offset;
140     }
141
142     /**
143      * Sets offset (the number of first object to return)
144      *
145      * @param offset the offset to set
146      */

147     public void setOffset(Integer JavaDoc offset) {
148         this.offset = offset;
149     }
150
151     /**
152      * Sets parameters that will be added to query
153      *
154      * @return the query parameters
155      */

156     public Map JavaDoc getQueryParameters() {
157         return queryParameters;
158     }
159
160     /**
161      * Gets parameters that will be added to query
162      *
163      * @param queryParameters the query parameters to set
164      */

165     public void setQueryParameters(Map JavaDoc queryParameters) {
166         this.queryParameters = queryParameters;
167     }
168
169 }
170
Popular Tags