Revision 44978
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.daltransform.app/org.gvsig.daltransform.app.join/src/main/java/org/gvsig/app/join/dal/feature/JoinTransform.java | ||
---|---|---|
49 | 49 |
import org.gvsig.fmap.dal.feature.exception.SetReadOnlyAttributeException; |
50 | 50 |
import org.gvsig.tools.ToolsLocator; |
51 | 51 |
import org.gvsig.tools.dataTypes.Coercion; |
52 |
import org.gvsig.tools.dataTypes.CoercionContext; |
|
52 | 53 |
import org.gvsig.tools.dataTypes.CoercionException; |
53 | 54 |
import org.gvsig.tools.dataTypes.DataType; |
54 | 55 |
import org.gvsig.tools.dispose.DisposableIterator; |
... | ... | |
116 | 117 |
private String prefix1; |
117 | 118 |
|
118 | 119 |
private String prefix2; |
120 |
|
|
121 |
private CoercionContext attr1Context; |
|
119 | 122 |
|
120 | 123 |
/** |
121 | 124 |
* A default constructor |
... | ... | |
160 | 163 |
this.prefix1 = prefix1; // TODO |
161 | 164 |
this.prefix2 = prefix2; // TODO |
162 | 165 |
this.attrs = attrs; |
166 |
this.attr1Context = store1.getDefaultFeatureTypeQuietly().getAttributeDescriptor(this.keyAttr1).getCoercionContext(); |
|
163 | 167 |
|
164 | 168 |
} |
165 | 169 |
|
... | ... | |
312 | 316 |
// attribute value |
313 | 317 |
// from the source feature |
314 | 318 |
JoinTransformEvaluator eval = this.getEvaluator(); |
315 |
eval.updateValue(source.get(this.keyAttr1)); |
|
319 |
eval.updateValue(source.get(this.keyAttr1), this.attr1Context);
|
|
316 | 320 |
|
317 | 321 |
FeatureQuery query = store2.createFeatureQuery(); |
318 | 322 |
query.setAttributeNames(attrsForQuery); |
... | ... | |
420 | 424 |
private String sql; |
421 | 425 |
private EvaluatorFieldsInfo info = null; |
422 | 426 |
private Coercion coercion; |
427 |
private CoercionContext context; |
|
423 | 428 |
|
424 | 429 |
// private int attributeIndex; |
425 | 430 |
public JoinTransformEvaluator(String attribute, boolean is_numeric) { |
... | ... | |
431 | 436 |
// this.attributeIndex = attrIndex; |
432 | 437 |
} |
433 | 438 |
|
434 |
public void updateValue(Object value) { |
|
439 |
public void updateValue(Object value, CoercionContext context) {
|
|
435 | 440 |
this.value = value; |
436 | 441 |
this.coercion = null; |
442 |
this.context = context; |
|
443 |
|
|
437 | 444 |
if (this.value!=null) { |
438 | 445 |
DataType dataType = ToolsLocator.getDataTypesManager().getDataType(value.getClass()); |
439 | 446 |
if (dataType!=null) { |
... | ... | |
462 | 469 |
return StringUtils.equals(Objects.toString(curValue), Objects.toString(value)); |
463 | 470 |
} |
464 | 471 |
try { |
465 |
coerceValue = this.coercion.coerce(curValue); |
|
472 |
coerceValue = this.coercion.coerce(curValue, this.context);
|
|
466 | 473 |
return coerceValue.equals(value); |
467 | 474 |
} catch (CoercionException ex) { |
468 | 475 |
return StringUtils.equals(Objects.toString(curValue), Objects.toString(value)); |
Also available in: Unified diff