01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.bpmscript;
18:
19: import java.io.Serializable;
20: import java.util.ArrayList;
21: import java.util.List;
22:
23: public class Query implements IQuery, Serializable {
24:
25: /**
26: * @serial serial version id
27: */
28: private static final long serialVersionUID = -6451150680840278791L;
29:
30: public static final Query ALL = new Query();
31:
32: private String filter;
33: private List<IOrderBy> orderBys;
34: private int firstResult = -1;
35: private int maxResults = -1;
36:
37: public Query(List<IOrderBy> orderBys) {
38: this .orderBys = orderBys;
39: }
40:
41: public Query(List<IOrderBy> orderBys, int firstResult,
42: int maxResults) {
43: this .orderBys = orderBys;
44: this .firstResult = firstResult;
45: this .maxResults = maxResults;
46: }
47:
48: public Query() {
49:
50: }
51:
52: public int getFirstResult() {
53: return firstResult;
54: }
55:
56: public void setFirstResult(int firstResult) {
57: this .firstResult = firstResult;
58: }
59:
60: public int getMaxResults() {
61: return maxResults;
62: }
63:
64: public void setMaxResults(int maxResults) {
65: this .maxResults = maxResults;
66: }
67:
68: public List<IOrderBy> getOrderBys() {
69: return orderBys;
70: }
71:
72: public void setOrderBys(List<IOrderBy> orderBys) {
73: this .orderBys = orderBys;
74: }
75:
76: public String getFilter() {
77: return filter;
78: }
79:
80: public void setFilter(String filter) {
81: this .filter = filter;
82: }
83:
84: public void addOrderBy(String field, boolean asc) {
85: if (orderBys == null) {
86: orderBys = new ArrayList<IOrderBy>();
87: }
88: orderBys.add(new OrderBy(field, asc));
89: }
90:
91: }
|