Revision 42975 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureQuery.java
DefaultFeatureQuery.java | ||
---|---|---|
69 | 69 |
* customize the behavior of the getDataCollection methods, there is an option |
70 | 70 |
* to set more parameters through the setAttribute method. |
71 | 71 |
* </p> |
72 |
*
|
|
72 |
* |
|
73 | 73 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
74 | 74 |
*/ |
75 | 75 |
public class DefaultFeatureQuery implements FeatureQuery { |
... | ... | |
101 | 101 |
|
102 | 102 |
/** |
103 | 103 |
* Creates a FeatureQuery which will load all available Features of a type. |
104 |
*
|
|
104 |
* |
|
105 | 105 |
* @param featureType |
106 | 106 |
* the type of Features of the query |
107 | 107 |
*/ |
... | ... | |
111 | 111 |
|
112 | 112 |
/** |
113 | 113 |
* Creates a FeatureQuery which will load all available Features of a type. |
114 |
*
|
|
114 |
* |
|
115 | 115 |
* @param featureType |
116 | 116 |
* the type of Features of the query |
117 | 117 |
*/ |
... | ... | |
123 | 123 |
/** |
124 | 124 |
* Creates a FeatureQuery with the type of features, a filter and the order |
125 | 125 |
* for the FeatureCollection. |
126 |
*
|
|
126 |
* |
|
127 | 127 |
* @param featureType |
128 | 128 |
* the type of Features of the query |
129 | 129 |
* @param filter |
... | ... | |
140 | 140 |
/** |
141 | 141 |
* Creates a FeatureQuery with the type of features, a filter, the order for |
142 | 142 |
* the FeatureCollection and the view scale. |
143 |
*
|
|
143 |
* |
|
144 | 144 |
* @param featureType |
145 | 145 |
* the type of Features of the query |
146 | 146 |
* @param filter |
... | ... | |
160 | 160 |
/** |
161 | 161 |
* Creates a FeatureQuery which will load a list of attribute names of all |
162 | 162 |
* available Features. |
163 |
*
|
|
163 |
* |
|
164 | 164 |
* @param attributeNames |
165 | 165 |
* the list of attribute names to load |
166 | 166 |
*/ |
... | ... | |
172 | 172 |
/** |
173 | 173 |
* Creates a FeatureQuery with the list of attribute names of feature, a |
174 | 174 |
* filter and the order for the FeatureCollection. |
175 |
*
|
|
175 |
* |
|
176 | 176 |
* @param attributeNames |
177 | 177 |
* the list of attribute names to load |
178 | 178 |
* @param filter |
... | ... | |
189 | 189 |
/** |
190 | 190 |
* Creates a FeatureQuery with the list of attribute names of feature, a |
191 | 191 |
* filter, the order for the FeatureCollection and the view scale. |
192 |
*
|
|
192 |
* |
|
193 | 193 |
* @param attributeNames |
194 | 194 |
* the list of attribute names to load |
195 | 195 |
* @param filter |
... | ... | |
239 | 239 |
if (attributeNames != null){ |
240 | 240 |
for (int i=0 ; i<attributeNames.length ; i++){ |
241 | 241 |
this.attributeNames.add(attributeNames[i]); |
242 |
}
|
|
242 |
} |
|
243 | 243 |
} |
244 | 244 |
} |
245 |
|
|
245 |
|
|
246 | 246 |
public void addAttributeName(String attributeName){ |
247 | 247 |
//If the attribute exists finish the method |
248 | 248 |
for (int i=0 ; i<attributeNames.size() ; i++){ |
249 | 249 |
if (attributeNames.get(i).equals(attributeName)){ |
250 | 250 |
return; |
251 |
}
|
|
252 |
}
|
|
251 |
} |
|
252 |
} |
|
253 | 253 |
this.attributeNames.add(attributeName); |
254 | 254 |
} |
255 | 255 |
|
... | ... | |
264 | 264 |
public Evaluator getFilter() { |
265 | 265 |
return filter; |
266 | 266 |
} |
267 |
|
|
267 |
|
|
268 | 268 |
@Override |
269 | 269 |
public void setFilter(String filter) { |
270 | 270 |
try { |
... | ... | |
288 | 288 |
throw new RuntimeException("Can't create filter from '"+filter+"'",ex); |
289 | 289 |
} |
290 | 290 |
} |
291 |
|
|
291 |
|
|
292 | 292 |
@Override |
293 | 293 |
public void addFilter(Evaluator evaluator) { |
294 | 294 |
if( evaluator == null ) { |
... | ... | |
313 | 313 |
addFilterAttributes(evaluator); |
314 | 314 |
// isAddFilter = true; |
315 | 315 |
} |
316 |
|
|
316 |
|
|
317 |
public void clearFilter() { |
|
318 |
this.filter = null; |
|
319 |
} |
|
320 |
|
|
317 | 321 |
private void addFilterAttributes(Evaluator evaluator){ |
318 | 322 |
if (evaluator != null){ |
319 | 323 |
EvaluatorFieldsInfo fieldsInfo = evaluator.getFieldsInfo(); |
... | ... | |
326 | 330 |
// fieldNames is not available in this evaluator |
327 | 331 |
return; |
328 | 332 |
} |
329 |
|
|
333 |
|
|
330 | 334 |
for (int i=0 ; i<fieldNames.length ; i++){ |
331 | 335 |
addAttributeName(fieldNames[i]); |
332 | 336 |
} |
... | ... | |
357 | 361 |
clone.attributeNames = new ArrayList(); |
358 | 362 |
for (int i=0 ; i<attributeNames.size() ; i++){ |
359 | 363 |
clone.attributeNames.add(attributeNames.get(i)); |
360 |
}
|
|
364 |
} |
|
361 | 365 |
} |
362 | 366 |
|
363 | 367 |
// Clone order |
... | ... | |
426 | 430 |
|
427 | 431 |
/** |
428 | 432 |
* Register the class on PersistenceManager |
429 |
*
|
|
433 |
* |
|
430 | 434 |
*/ |
431 | 435 |
public static void registerPersistent() { |
432 | 436 |
DynStruct definition = |
... | ... | |
486 | 490 |
if (constantsAttributeNames != null){ |
487 | 491 |
for (int i=0 ; i<constantsAttributeNames.length ; i++){ |
488 | 492 |
this.constantsAttributeNames.add(constantsAttributeNames[i]); |
489 |
}
|
|
493 |
} |
|
490 | 494 |
} |
491 | 495 |
} |
492 |
|
|
496 |
|
|
493 | 497 |
public void addConstantAttributeName(String attributeName) { |
494 | 498 |
//If the attribute exists finish the method |
495 | 499 |
for (int i=0 ; i<constantsAttributeNames.size() ; i++){ |
496 | 500 |
if (constantsAttributeNames.get(i).equals(attributeName)){ |
497 | 501 |
return; |
498 |
}
|
|
499 |
}
|
|
502 |
} |
|
503 |
} |
|
500 | 504 |
this.constantsAttributeNames.add(attributeName); |
501 | 505 |
} |
502 | 506 |
|
Also available in: Unified diff