Revision 46696
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/featureset/FastEditedFilteredIterator.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.fmap.dal.feature.impl.featureset; |
25 | 25 |
|
26 |
import org.apache.commons.lang3.BooleanUtils; |
|
26 | 27 |
import org.gvsig.fmap.dal.exception.DataEvaluatorException; |
27 | 28 |
import org.gvsig.fmap.dal.exception.DataException; |
28 | 29 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeature; |
... | ... | |
39 | 40 |
@Override |
40 | 41 |
public boolean match(DefaultFeature feature) throws DataException { |
41 | 42 |
try { |
42 |
return ((boolean) this.filter.evaluate(feature)); |
|
43 |
} catch (EvaluatorException e) { |
|
43 |
Object v = this.filter.evaluate(feature); |
|
44 |
return toBooleanMatch(v); |
|
45 |
} catch (Exception e) { |
|
44 | 46 |
throw new DataEvaluatorException(e); |
45 | 47 |
} |
46 | 48 |
} |
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/featureset/FilteredIterator.java | ||
---|---|---|
124 | 124 |
return this.current != null; |
125 | 125 |
} |
126 | 126 |
|
127 |
protected boolean toBooleanMatch(Object x) { |
|
128 |
if( x == null ) { |
|
129 |
return false; |
|
130 |
} else if( x instanceof Boolean ) { |
|
131 |
return ((Boolean) x); |
|
132 |
} else { |
|
133 |
return true; |
|
134 |
} |
|
135 |
} |
|
136 |
|
|
127 | 137 |
public boolean match(DefaultFeature feature) throws DataException { |
128 | 138 |
try { |
129 | 139 |
if (filter==null) { |
130 | 140 |
return true; |
131 | 141 |
} |
132 | 142 |
Object x = this.filter.evaluate(feature); |
133 |
if( x == null ) { |
|
134 |
return false; |
|
135 |
} else if( x instanceof Boolean ) { |
|
136 |
return ((Boolean) x); |
|
137 |
} else { |
|
138 |
return true; |
|
139 |
} |
|
143 |
return toBooleanMatch(x); |
|
140 | 144 |
} catch (Exception e) { |
141 | 145 |
throw new DataEvaluatorException(e); |
142 | 146 |
} |
Also available in: Unified diff