Statistics
| Revision:

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 @ 44259

History | View | Annotate | Download (8.37 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 44023 jjdelcerro
import org.gvsig.expressionevaluator.Expression;
31 40435 jjdelcerro
import org.gvsig.fmap.dal.DataQuery;
32
import org.gvsig.tools.evaluator.Evaluator;
33
import org.gvsig.tools.lang.Cloneable;
34
35
/**
36
 * Defines the properties of a collection of Features, as a result of a query
37
 * through a FeatureStore.
38
 * <p>
39
 * A FeatureQuery is always defined by a FeatureType, or by the list of
40
 * attribute names of the FeatureStore to return.
41
 * </p>
42
 * <p>
43
 * The filter allows to select Features whose properties have values with the
44
 * characteristics defined by the filter.
45
 * </p>
46
 * <p>
47
 * The order is used to set the order of the result FeatureCollection, based on
48
 * the values of the properties of the Features.
49
 * </p>
50
 * <p>
51
 * The scale parameter can be used by the FeatureStore as a hint about the
52
 * quality or resolution of the data needed to view or operate with the data
53
 * returned. As an example, the FeatureStore may use the scale to return only a
54
 * representative subset of the data, or maybe to return Features with less
55
 * detail, like a point or a line instead of a polygon.
56
 * </p>
57
 * <p>
58
 * If an implementation of FeatureStore is able to get other parameters to
59
 * customize the behavior of the getDataCollection methods, there is an option
60
 * to set more parameters through the setAttribute method.
61
 * </p>
62 42975 jjdelcerro
 *
63 40435 jjdelcerro
 * @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team
64
 */
65
public interface FeatureQuery extends DataQuery, Cloneable {
66
67
        /**
68
         * Returns the names of the attributes to load from each {@link Feature}.
69 42975 jjdelcerro
         *
70 40435 jjdelcerro
         * @return the attribute names to load
71
         */
72
        String[] getAttributeNames();
73
74
        /**
75
         * Sets the names of the attributes to load from each {@link Feature}.
76 42975 jjdelcerro
         *
77 40435 jjdelcerro
         * @param attributeNames
78
         *            the attribute names to load
79
         */
80
        void setAttributeNames(String[] attributeNames);
81 42975 jjdelcerro
82 43558 jjdelcerro
        void retrievesAllAttributes();
83
84
    /**
85 40435 jjdelcerro
         * Adds the name of an attribute that has to be used to load each
86
         * {@link Feature}.
87 42975 jjdelcerro
         *
88 40435 jjdelcerro
         * @param attributeName
89
         *             the attribute name to load
90
         */
91
        void addAttributeName(String attributeName);
92
93 43358 jjdelcerro
    public void addPrimaryKeyAttributeNames(FeatureStore store);
94 42975 jjdelcerro
95 43358 jjdelcerro
    public void addEssentialAttributeNames(FeatureStore store);
96 41212 jjdelcerro
97 43358 jjdelcerro
    /**
98
     * Return true if has set attribute names
99
     *
100
     * @return true if has attribute names, otherwise false
101
     */
102
    boolean hasAttributeNames();
103
104
    /**
105
     * Remove all the attribute names specifieds.
106
     */
107
    void clearAttributeNames();
108
109
    /**
110 41212 jjdelcerro
         * Returns the names of the attributes that are constants in each {@link Feature}.
111
         * These attributes will not be charged.
112 42975 jjdelcerro
         *
113 41212 jjdelcerro
         * @return the attribute names that are constant
114
         */
115
        String[] getConstantsAttributeNames();
116
117 40435 jjdelcerro
        /**
118 41212 jjdelcerro
         * Set of attribute names to be treated as constants for each {@link Feature}.
119 42975 jjdelcerro
         *
120 41212 jjdelcerro
         * @param attributeNames
121
         *            the attribute names to be constants
122
         */
123
        void setConstantsAttributeNames(String[] attributeNames);
124 42975 jjdelcerro
125 41212 jjdelcerro
        /**
126 42975 jjdelcerro
         * Add an attribute name that will be treated as constant for each
127 41212 jjdelcerro
         * {@link Feature}.
128 42975 jjdelcerro
         *
129 41212 jjdelcerro
         * @param attributeName
130
         *             the attribute name to be treated as constant
131
         */
132
        void addConstantAttributeName(String attributeName);
133
134
        /**
135
         * Return true if has set constants attribute names
136 42975 jjdelcerro
         *
137 41212 jjdelcerro
         * @return true if has constants attribute names, otherwise false
138
         */
139
        boolean hasConstantsAttributeNames();
140 42975 jjdelcerro
141 41212 jjdelcerro
        /**
142
         * Remove all the names specified as constants attributes.
143
         */
144
        void clearConstantsAttributeNames();
145 42975 jjdelcerro
146 41212 jjdelcerro
        /**
147 40435 jjdelcerro
         * Sets the {@link FeatureType} of the {@link Feature}s to load. It may be
148
         * used as an alternative way to set a subset of the list of attribute names
149
         * to load, by creating a sub-FeatureType.
150 42975 jjdelcerro
         *
151 40435 jjdelcerro
         * @param featureType
152
         *            the feature type of the data to load
153
         */
154
        void setFeatureType(FeatureType featureType);
155
156
        /**
157
         * Returns the {@link FeatureType} id of the {@link Feature}s to load.
158 42975 jjdelcerro
         *
159 40435 jjdelcerro
         * @return the {@link FeatureType} id of the {@link Feature}s to load
160
         */
161
        String getFeatureTypeId();
162
163
        /**
164
         * Sets the {@link FeatureType} id of the {@link Feature}s to load. This way
165
         * all {@link Feature} attributes will be loaded.
166 42975 jjdelcerro
         *
167 40435 jjdelcerro
         * @param featureTypeId
168
         *            the {@link FeatureType} id of the {@link Feature}s to load
169
         */
170
        void setFeatureTypeId(String featureTypeId);
171
172
        /**
173
         * Returns the filter to apply to the {@link Feature}s to load.
174 42975 jjdelcerro
         *
175 40435 jjdelcerro
         * @return the filter
176
         */
177
        Evaluator getFilter();
178
179
        /**
180
         * Sets the filter to apply to the {@link Feature}s to load.
181 42975 jjdelcerro
         *
182 40435 jjdelcerro
         * @param filter
183
         *            the filter to apply to the {@link Feature}s to load
184
         */
185
        void setFilter(Evaluator filter);
186 42975 jjdelcerro
187 44023 jjdelcerro
        void setFilter(Expression filter);
188
189 42971 jjdelcerro
        void setFilter(String filter);
190 42975 jjdelcerro
191 40435 jjdelcerro
        /**
192
         * Adds a filter to apply to the {@link Feature}s to load. A query
193
         * can have more that one filter and all of them are applied when
194
         * the query is applied.
195 42795 jjdelcerro
         * If filter is null do nothing.
196 42975 jjdelcerro
         *
197 40435 jjdelcerro
         * @param filter
198
         *             a filter to apply to the {@link Feature}s to load
199
         */
200
        void addFilter(Evaluator filter);
201
202 44023 jjdelcerro
        void addFilter(Expression filter);
203
204 42971 jjdelcerro
        void addFilter(String filter);
205 42975 jjdelcerro
206
        void clearFilter();
207 42971 jjdelcerro
208 40435 jjdelcerro
        /**
209
         * Returns if a filter has been defined for the query.
210 42975 jjdelcerro
         *
211 40435 jjdelcerro
         * @return if a filter has been defined for the query
212
         */
213
        boolean hasFilter();
214
215
        /**
216
         * Returns the order of the {@link Feature}s to load.
217 42975 jjdelcerro
         *
218 40435 jjdelcerro
         * @return the order of the {@link Feature}s to load
219
         */
220
        FeatureQueryOrder getOrder();
221
222
        /**
223
         * Sets the order of the {@link Feature}s to load.
224 42975 jjdelcerro
         *
225 40435 jjdelcerro
         * @param order
226
         *            the order of the {@link Feature}s to load
227
         */
228
        void setOrder(FeatureQueryOrder order);
229
230
        /**
231
         * Returns if an order has been set for the elements returned by the query.
232 42975 jjdelcerro
         *
233 40435 jjdelcerro
         * @return if an order has been set for the elements returned by the query
234
         */
235
        boolean hasOrder();
236
237
        /**
238 43358 jjdelcerro
     * @return
239 40435 jjdelcerro
         * @deprecated to be removed in gvSIG 2.0
240
         * @see #clone()
241
         */
242
        FeatureQuery getCopy();
243
244
        /**
245
         * Returns the maximum number of elements to return with this query.
246
         * <p>
247
         * <strong>NOTE:</strong> this value may be ignored by the underlying data
248
         * source, or only used as a hint, so don't rely on it being used, as you
249
         * may actually get more values than the limit.
250
         * </p>
251 42975 jjdelcerro
         *
252 40435 jjdelcerro
         * @return the maximum number of elements to return with this query
253
         */
254
        long getLimit();
255
256
        /**
257
         * Sets the maximum number of elements to return with this query.
258
         * <p>
259
         * <strong>NOTE:</strong> this value may be ignored by the underlying data
260
         * source, or only used as a hint, so don't rely on it being used, as you
261
         * may actually get more values than the limit.
262
         * </p>
263 42975 jjdelcerro
         *
264 40435 jjdelcerro
         * @param limit
265
         *            the maximum number of elements to return with this query
266
         */
267
        void setLimit(long limit);
268
269
        /**
270
         * Returns the load page size, as the number of elements to be retrieved in
271
         * block by the data source. This value is only used as a hint to the
272
         * underlying data source, as a way to tell how many Features may be read in
273
         * a block.
274 42975 jjdelcerro
         *
275 40435 jjdelcerro
         * @return the load page size
276
         */
277
        long getPageSize();
278
279
        /**
280
         * Sets the load page size, as the number of elements to be retrieved in
281
         * block by the data source. This value is only used as a hint to the
282
         * underlying data source, as a way to tell how many Features may be read in
283
         * a block.
284 42975 jjdelcerro
         *
285 40435 jjdelcerro
         * @param pageSize
286
         *            the load page size
287
         */
288
        void setPageSize(long pageSize);
289
}