svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / feature / FeatureQuery.java @ 43558
History | View | Annotate | Download (8.24 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | 40559 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * of the License, or (at your option) any later version.
|
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | 40559 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | /*
|
||
25 | * AUTHORS (In addition to CIT):
|
||
26 | * 2008 {DiSiD Technologies} {Create Parameter object to define FeatureCollections queries}
|
||
27 | */
|
||
28 | package org.gvsig.fmap.dal.feature; |
||
29 | |||
30 | import org.gvsig.fmap.dal.DataQuery; |
||
31 | import org.gvsig.tools.evaluator.Evaluator; |
||
32 | import org.gvsig.tools.lang.Cloneable; |
||
33 | |||
34 | /**
|
||
35 | * Defines the properties of a collection of Features, as a result of a query
|
||
36 | * through a FeatureStore.
|
||
37 | * <p>
|
||
38 | * A FeatureQuery is always defined by a FeatureType, or by the list of
|
||
39 | * attribute names of the FeatureStore to return.
|
||
40 | * </p>
|
||
41 | * <p>
|
||
42 | * The filter allows to select Features whose properties have values with the
|
||
43 | * characteristics defined by the filter.
|
||
44 | * </p>
|
||
45 | * <p>
|
||
46 | * The order is used to set the order of the result FeatureCollection, based on
|
||
47 | * the values of the properties of the Features.
|
||
48 | * </p>
|
||
49 | * <p>
|
||
50 | * The scale parameter can be used by the FeatureStore as a hint about the
|
||
51 | * quality or resolution of the data needed to view or operate with the data
|
||
52 | * returned. As an example, the FeatureStore may use the scale to return only a
|
||
53 | * representative subset of the data, or maybe to return Features with less
|
||
54 | * detail, like a point or a line instead of a polygon.
|
||
55 | * </p>
|
||
56 | * <p>
|
||
57 | * If an implementation of FeatureStore is able to get other parameters to
|
||
58 | * customize the behavior of the getDataCollection methods, there is an option
|
||
59 | * to set more parameters through the setAttribute method.
|
||
60 | * </p>
|
||
61 | 42975 | jjdelcerro | *
|
62 | 40435 | jjdelcerro | * @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team
|
63 | */
|
||
64 | public interface FeatureQuery extends DataQuery, Cloneable { |
||
65 | |||
66 | /**
|
||
67 | * Returns the names of the attributes to load from each {@link Feature}.
|
||
68 | 42975 | jjdelcerro | *
|
69 | 40435 | jjdelcerro | * @return the attribute names to load
|
70 | */
|
||
71 | String[] getAttributeNames(); |
||
72 | |||
73 | /**
|
||
74 | * Sets the names of the attributes to load from each {@link Feature}.
|
||
75 | 42975 | jjdelcerro | *
|
76 | 40435 | jjdelcerro | * @param attributeNames
|
77 | * the attribute names to load
|
||
78 | */
|
||
79 | void setAttributeNames(String[] attributeNames); |
||
80 | 42975 | jjdelcerro | |
81 | 43558 | jjdelcerro | void retrievesAllAttributes();
|
82 | |||
83 | /**
|
||
84 | 40435 | jjdelcerro | * Adds the name of an attribute that has to be used to load each
|
85 | * {@link Feature}.
|
||
86 | 42975 | jjdelcerro | *
|
87 | 40435 | jjdelcerro | * @param attributeName
|
88 | * the attribute name to load
|
||
89 | */
|
||
90 | void addAttributeName(String attributeName); |
||
91 | |||
92 | 43358 | jjdelcerro | public void addPrimaryKeyAttributeNames(FeatureStore store); |
93 | 42975 | jjdelcerro | |
94 | 43358 | jjdelcerro | public void addEssentialAttributeNames(FeatureStore store); |
95 | 41212 | jjdelcerro | |
96 | 43358 | jjdelcerro | /**
|
97 | * Return true if has set attribute names
|
||
98 | *
|
||
99 | * @return true if has attribute names, otherwise false
|
||
100 | */
|
||
101 | boolean hasAttributeNames();
|
||
102 | |||
103 | /**
|
||
104 | * Remove all the attribute names specifieds.
|
||
105 | */
|
||
106 | void clearAttributeNames();
|
||
107 | |||
108 | /**
|
||
109 | 41212 | jjdelcerro | * Returns the names of the attributes that are constants in each {@link Feature}.
|
110 | * These attributes will not be charged.
|
||
111 | 42975 | jjdelcerro | *
|
112 | 41212 | jjdelcerro | * @return the attribute names that are constant
|
113 | */
|
||
114 | String[] getConstantsAttributeNames(); |
||
115 | |||
116 | 40435 | jjdelcerro | /**
|
117 | 41212 | jjdelcerro | * Set of attribute names to be treated as constants for each {@link Feature}.
|
118 | 42975 | jjdelcerro | *
|
119 | 41212 | jjdelcerro | * @param attributeNames
|
120 | * the attribute names to be constants
|
||
121 | */
|
||
122 | void setConstantsAttributeNames(String[] attributeNames); |
||
123 | 42975 | jjdelcerro | |
124 | 41212 | jjdelcerro | /**
|
125 | 42975 | jjdelcerro | * Add an attribute name that will be treated as constant for each
|
126 | 41212 | jjdelcerro | * {@link Feature}.
|
127 | 42975 | jjdelcerro | *
|
128 | 41212 | jjdelcerro | * @param attributeName
|
129 | * the attribute name to be treated as constant
|
||
130 | */
|
||
131 | void addConstantAttributeName(String attributeName); |
||
132 | |||
133 | /**
|
||
134 | * Return true if has set constants attribute names
|
||
135 | 42975 | jjdelcerro | *
|
136 | 41212 | jjdelcerro | * @return true if has constants attribute names, otherwise false
|
137 | */
|
||
138 | boolean hasConstantsAttributeNames();
|
||
139 | 42975 | jjdelcerro | |
140 | 41212 | jjdelcerro | /**
|
141 | * Remove all the names specified as constants attributes.
|
||
142 | */
|
||
143 | void clearConstantsAttributeNames();
|
||
144 | 42975 | jjdelcerro | |
145 | 41212 | jjdelcerro | /**
|
146 | 40435 | jjdelcerro | * Sets the {@link FeatureType} of the {@link Feature}s to load. It may be
|
147 | * used as an alternative way to set a subset of the list of attribute names
|
||
148 | * to load, by creating a sub-FeatureType.
|
||
149 | 42975 | jjdelcerro | *
|
150 | 40435 | jjdelcerro | * @param featureType
|
151 | * the feature type of the data to load
|
||
152 | */
|
||
153 | void setFeatureType(FeatureType featureType);
|
||
154 | |||
155 | /**
|
||
156 | * Returns the {@link FeatureType} id of the {@link Feature}s to load.
|
||
157 | 42975 | jjdelcerro | *
|
158 | 40435 | jjdelcerro | * @return the {@link FeatureType} id of the {@link Feature}s to load
|
159 | */
|
||
160 | String getFeatureTypeId();
|
||
161 | |||
162 | /**
|
||
163 | * Sets the {@link FeatureType} id of the {@link Feature}s to load. This way
|
||
164 | * all {@link Feature} attributes will be loaded.
|
||
165 | 42975 | jjdelcerro | *
|
166 | 40435 | jjdelcerro | * @param featureTypeId
|
167 | * the {@link FeatureType} id of the {@link Feature}s to load
|
||
168 | */
|
||
169 | void setFeatureTypeId(String featureTypeId); |
||
170 | |||
171 | /**
|
||
172 | * Returns the filter to apply to the {@link Feature}s to load.
|
||
173 | 42975 | jjdelcerro | *
|
174 | 40435 | jjdelcerro | * @return the filter
|
175 | */
|
||
176 | Evaluator getFilter(); |
||
177 | |||
178 | /**
|
||
179 | * Sets the filter to apply to the {@link Feature}s to load.
|
||
180 | 42975 | jjdelcerro | *
|
181 | 40435 | jjdelcerro | * @param filter
|
182 | * the filter to apply to the {@link Feature}s to load
|
||
183 | */
|
||
184 | void setFilter(Evaluator filter);
|
||
185 | 42975 | jjdelcerro | |
186 | 42971 | jjdelcerro | void setFilter(String filter); |
187 | 42975 | jjdelcerro | |
188 | 40435 | jjdelcerro | /**
|
189 | * Adds a filter to apply to the {@link Feature}s to load. A query
|
||
190 | * can have more that one filter and all of them are applied when
|
||
191 | * the query is applied.
|
||
192 | 42795 | jjdelcerro | * If filter is null do nothing.
|
193 | 42975 | jjdelcerro | *
|
194 | 40435 | jjdelcerro | * @param filter
|
195 | * a filter to apply to the {@link Feature}s to load
|
||
196 | */
|
||
197 | void addFilter(Evaluator filter);
|
||
198 | |||
199 | 42971 | jjdelcerro | void addFilter(String filter); |
200 | 42975 | jjdelcerro | |
201 | void clearFilter();
|
||
202 | 42971 | jjdelcerro | |
203 | 40435 | jjdelcerro | /**
|
204 | * Returns if a filter has been defined for the query.
|
||
205 | 42975 | jjdelcerro | *
|
206 | 40435 | jjdelcerro | * @return if a filter has been defined for the query
|
207 | */
|
||
208 | boolean hasFilter();
|
||
209 | |||
210 | /**
|
||
211 | * Returns the order of the {@link Feature}s to load.
|
||
212 | 42975 | jjdelcerro | *
|
213 | 40435 | jjdelcerro | * @return the order of the {@link Feature}s to load
|
214 | */
|
||
215 | FeatureQueryOrder getOrder(); |
||
216 | |||
217 | /**
|
||
218 | * Sets the order of the {@link Feature}s to load.
|
||
219 | 42975 | jjdelcerro | *
|
220 | 40435 | jjdelcerro | * @param order
|
221 | * the order of the {@link Feature}s to load
|
||
222 | */
|
||
223 | void setOrder(FeatureQueryOrder order);
|
||
224 | |||
225 | /**
|
||
226 | * Returns if an order has been set for the elements returned by the query.
|
||
227 | 42975 | jjdelcerro | *
|
228 | 40435 | jjdelcerro | * @return if an order has been set for the elements returned by the query
|
229 | */
|
||
230 | boolean hasOrder();
|
||
231 | |||
232 | /**
|
||
233 | 43358 | jjdelcerro | * @return
|
234 | 40435 | jjdelcerro | * @deprecated to be removed in gvSIG 2.0
|
235 | * @see #clone()
|
||
236 | */
|
||
237 | FeatureQuery getCopy(); |
||
238 | |||
239 | /**
|
||
240 | * Returns the maximum number of elements to return with this query.
|
||
241 | * <p>
|
||
242 | * <strong>NOTE:</strong> this value may be ignored by the underlying data
|
||
243 | * source, or only used as a hint, so don't rely on it being used, as you
|
||
244 | * may actually get more values than the limit.
|
||
245 | * </p>
|
||
246 | 42975 | jjdelcerro | *
|
247 | 40435 | jjdelcerro | * @return the maximum number of elements to return with this query
|
248 | */
|
||
249 | long getLimit();
|
||
250 | |||
251 | /**
|
||
252 | * Sets the maximum number of elements to return with this query.
|
||
253 | * <p>
|
||
254 | * <strong>NOTE:</strong> this value may be ignored by the underlying data
|
||
255 | * source, or only used as a hint, so don't rely on it being used, as you
|
||
256 | * may actually get more values than the limit.
|
||
257 | * </p>
|
||
258 | 42975 | jjdelcerro | *
|
259 | 40435 | jjdelcerro | * @param limit
|
260 | * the maximum number of elements to return with this query
|
||
261 | */
|
||
262 | void setLimit(long limit); |
||
263 | |||
264 | /**
|
||
265 | * Returns the load page size, as the number of elements to be retrieved in
|
||
266 | * block by the data source. This value is only used as a hint to the
|
||
267 | * underlying data source, as a way to tell how many Features may be read in
|
||
268 | * a block.
|
||
269 | 42975 | jjdelcerro | *
|
270 | 40435 | jjdelcerro | * @return the load page size
|
271 | */
|
||
272 | long getPageSize();
|
||
273 | |||
274 | /**
|
||
275 | * Sets the load page size, as the number of elements to be retrieved in
|
||
276 | * block by the data source. This value is only used as a hint to the
|
||
277 | * underlying data source, as a way to tell how many Features may be read in
|
||
278 | * a block.
|
||
279 | 42975 | jjdelcerro | *
|
280 | 40435 | jjdelcerro | * @param pageSize
|
281 | * the load page size
|
||
282 | */
|
||
283 | void setPageSize(long pageSize); |
||
284 | } |