1 /*
2 * Copyright (C) 2007 ETH Zurich
3 *
4 * This file is part of Fosstrak (www.fosstrak.org).
5 *
6 * Fosstrak is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1, as published by the Free Software Foundation.
9 *
10 * Fosstrak is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with Fosstrak; if not, write to the Free
17 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
19 */
20
21 package org.fosstrak.epcis.queryclient;
22
23 import java.util.ArrayList;
24 import java.util.List;
25
26 import org.fosstrak.epcis.model.QueryParam;
27
28 /**
29 * Implements an example query object for the EPCIS Query Interface Client.
30 *
31 * @author David Gubler
32 */
33 public class Query {
34 /**
35 * Human-readable description.
36 */
37 private String desc;
38
39 /**
40 * Wheter this example should return ObjectEvents or not.
41 */
42 private boolean returnObjectEvents = false;
43
44 /**
45 * Wheter this example should return AggregationEvents or not.
46 */
47 private boolean returnAggregationEvents = false;
48
49 /**
50 * Wheter this example should return QuantityEvents or not.
51 */
52 private boolean returnQuantityEvents = false;
53
54 /**
55 * Wheter this example should return TransacitonEvents or not.
56 */
57 private boolean returnTransactionEvents = false;
58
59 /**
60 * Vector that holds all other query parameters.
61 */
62 private List<QueryParam> queryParameters = new ArrayList<QueryParam>();
63
64 /**
65 * Sets the description.
66 *
67 * @param description
68 * The describtion for the query.
69 */
70 public void setDescription(final String description) {
71 desc = description;
72 }
73
74 /**
75 * Gets the description.
76 *
77 * @return The description of the query.
78 */
79 public String getDescription() {
80 return desc;
81 }
82
83 /**
84 * Sets if object events should be returned or not.
85 *
86 * @param objectEvents
87 * <code>true</code> if object events should be returned,
88 * <code>false</code> otherwise.
89 */
90 public void setReturnObjectEvents(final boolean objectEvents) {
91 returnObjectEvents = objectEvents;
92 }
93
94 /**
95 * Gets if object events should be returned or not.
96 *
97 * @return <code>true</code> if the query service will return object
98 * events, <code>false</code> otherwise.
99 */
100 public boolean getReturnObjectEvents() {
101 return returnObjectEvents;
102 }
103
104 /**
105 * Sets if aggregation events should be returned or not.
106 *
107 * @param aggregationEvents
108 * <code>true</code> if aggregation events should be returned,
109 * <code>false</code> otherwise.
110 */
111 public void setReturnAggregationEvents(final boolean aggregationEvents) {
112 returnAggregationEvents = aggregationEvents;
113 }
114
115 /**
116 * Gets if aggregation events should be returned or not.
117 *
118 * @return <code>true</code> if the query service will return aggregation
119 * events, <code>false</code> otherwise.
120 */
121 public boolean getReturnAggregationEvents() {
122 return returnAggregationEvents;
123 }
124
125 /**
126 * Sets if quantity events should be returned or not.
127 *
128 * @param quantityEvents
129 * <code>true</code> if quantity events should be returned,
130 * <code>false</code> otherwise.
131 */
132 public void setReturnQuantityEvents(final boolean quantityEvents) {
133 returnQuantityEvents = quantityEvents;
134 }
135
136 /**
137 * Gets if quantity events should be returned or not.
138 *
139 * @return <code>true</code> if the query service will return quantity
140 * events, <code>false</code> otherwise.
141 */
142 public boolean getReturnQuantityEvents() {
143 return returnQuantityEvents;
144 }
145
146 /**
147 * Sets if transaction events should be returned or not.
148 *
149 * @param transactionEvents
150 * <code>true</code> if transaction events should be returned,
151 * <code>false</code> otherwise.
152 */
153 public void setReturnTransactionEvents(final boolean transactionEvents) {
154 returnTransactionEvents = transactionEvents;
155 }
156
157 /**
158 * Gets if transaction events should be returned or not.
159 *
160 * @return <code>true</code> if the query service will return transaction
161 * events, <code>false</code> otherwise.
162 */
163 public boolean getReturnTransactionEvents() {
164 return returnTransactionEvents;
165 }
166
167 /**
168 * Gets the vector that holds all other query parameters.
169 *
170 * @return The List containing the query parameters.
171 */
172 public List<QueryParam> getQueryParameters() {
173 return queryParameters;
174 }
175 }