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

History | View | Annotate | Download (6.58 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
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
 * as published by the Free Software Foundation; either version 2
9
 * 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
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2008 {DiSiD Technologies}  {Create Parameter object to define FeatureCollections queries}
26
 */
27
package org.gvsig.fmap.dal.feature;
28

    
29
import org.gvsig.fmap.dal.DataQuery;
30
import org.gvsig.tools.evaluator.Evaluator;
31
import org.gvsig.tools.lang.Cloneable;
32

    
33
/**
34
 * Defines the properties of a collection of Features, as a result of a query
35
 * through a FeatureStore.
36
 * <p>
37
 * A FeatureQuery is always defined by a FeatureType, or by the list of
38
 * attribute names of the FeatureStore to return.
39
 * </p>
40
 * <p>
41
 * The filter allows to select Features whose properties have values with the
42
 * characteristics defined by the filter.
43
 * </p>
44
 * <p>
45
 * The order is used to set the order of the result FeatureCollection, based on
46
 * the values of the properties of the Features.
47
 * </p>
48
 * <p>
49
 * The scale parameter can be used by the FeatureStore as a hint about the
50
 * quality or resolution of the data needed to view or operate with the data
51
 * returned. As an example, the FeatureStore may use the scale to return only a
52
 * representative subset of the data, or maybe to return Features with less
53
 * detail, like a point or a line instead of a polygon.
54
 * </p>
55
 * <p>
56
 * If an implementation of FeatureStore is able to get other parameters to
57
 * customize the behavior of the getDataCollection methods, there is an option
58
 * to set more parameters through the setAttribute method.
59
 * </p>
60
 * 
61
 * @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team
62
 */
63
public interface FeatureQuery extends DataQuery, Cloneable {
64

    
65
        /**
66
         * Returns the names of the attributes to load from each {@link Feature}.
67
         * 
68
         * @return the attribute names to load
69
         */
70
        String[] getAttributeNames();
71

    
72
        /**
73
         * Sets the names of the attributes to load from each {@link Feature}.
74
         * 
75
         * @param attributeNames
76
         *            the attribute names to load
77
         */
78
        void setAttributeNames(String[] attributeNames);
79
        
80
        /**
81
         * Adds the name of an attribute that has to be used to load each
82
         * {@link Feature}.
83
         * 
84
         * @param attributeName
85
         *             the attribute name to load
86
         */
87
        void addAttributeName(String attributeName);
88

    
89
        /**
90
         * Sets the {@link FeatureType} of the {@link Feature}s to load. It may be
91
         * used as an alternative way to set a subset of the list of attribute names
92
         * to load, by creating a sub-FeatureType.
93
         * 
94
         * @param featureType
95
         *            the feature type of the data to load
96
         */
97
        void setFeatureType(FeatureType featureType);
98

    
99
        /**
100
         * Returns the {@link FeatureType} id of the {@link Feature}s to load.
101
         * 
102
         * @return the {@link FeatureType} id of the {@link Feature}s to load
103
         */
104
        String getFeatureTypeId();
105

    
106
        /**
107
         * Sets the {@link FeatureType} id of the {@link Feature}s to load. This way
108
         * all {@link Feature} attributes will be loaded.
109
         * 
110
         * @param featureTypeId
111
         *            the {@link FeatureType} id of the {@link Feature}s to load
112
         */
113
        void setFeatureTypeId(String featureTypeId);
114

    
115
        /**
116
         * Returns the filter to apply to the {@link Feature}s to load.
117
         * 
118
         * @return the filter
119
         */
120
        Evaluator getFilter();
121

    
122
        /**
123
         * Sets the filter to apply to the {@link Feature}s to load.
124
         * 
125
         * @param filter
126
         *            the filter to apply to the {@link Feature}s to load
127
         */
128
        void setFilter(Evaluator filter);
129
        
130
        /**
131
         * Adds a filter to apply to the {@link Feature}s to load. A query
132
         * can have more that one filter and all of them are applied when
133
         * the query is applied.
134
         * 
135
         * @param filter
136
         *             a filter to apply to the {@link Feature}s to load
137
         */
138
        void addFilter(Evaluator filter);
139

    
140
        /**
141
         * Returns if a filter has been defined for the query.
142
         * 
143
         * @return if a filter has been defined for the query
144
         */
145
        boolean hasFilter();
146

    
147
        /**
148
         * Returns the order of the {@link Feature}s to load.
149
         * 
150
         * @return the order of the {@link Feature}s to load
151
         */
152
        FeatureQueryOrder getOrder();
153

    
154
        /**
155
         * Sets the order of the {@link Feature}s to load.
156
         * 
157
         * @param order
158
         *            the order of the {@link Feature}s to load
159
         */
160
        void setOrder(FeatureQueryOrder order);
161

    
162
        /**
163
         * Returns if an order has been set for the elements returned by the query.
164
         * 
165
         * @return if an order has been set for the elements returned by the query
166
         */
167
        boolean hasOrder();
168

    
169
        /**
170
         * @deprecated to be removed in gvSIG 2.0
171
         * @see #clone()
172
         */
173
        FeatureQuery getCopy();
174

    
175
        /**
176
         * Returns the maximum number of elements to return with this query.
177
         * <p>
178
         * <strong>NOTE:</strong> this value may be ignored by the underlying data
179
         * source, or only used as a hint, so don't rely on it being used, as you
180
         * may actually get more values than the limit.
181
         * </p>
182
         * 
183
         * @return the maximum number of elements to return with this query
184
         */
185
        long getLimit();
186

    
187
        /**
188
         * Sets the maximum number of elements to return with this query.
189
         * <p>
190
         * <strong>NOTE:</strong> this value may be ignored by the underlying data
191
         * source, or only used as a hint, so don't rely on it being used, as you
192
         * may actually get more values than the limit.
193
         * </p>
194
         * 
195
         * @param limit
196
         *            the maximum number of elements to return with this query
197
         */
198
        void setLimit(long limit);
199

    
200
        /**
201
         * Returns the load page size, as the number of elements to be retrieved in
202
         * block by the data source. This value is only used as a hint to the
203
         * underlying data source, as a way to tell how many Features may be read in
204
         * a block.
205
         * 
206
         * @return the load page size
207
         */
208
        long getPageSize();
209

    
210
        /**
211
         * Sets the load page size, as the number of elements to be retrieved in
212
         * block by the data source. This value is only used as a hint to the
213
         * underlying data source, as a way to tell how many Features may be read in
214
         * a block.
215
         * 
216
         * @param pageSize
217
         *            the load page size
218
         */
219
        void setPageSize(long pageSize);
220
}