Revision 35133
branches/dal_time_support/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestFeatureStore.java | ||
---|---|---|
617 | 617 |
// Sorted |
618 | 618 |
FeatureAttributeDescriptor attr = getFirstAttributeOfType(store |
619 | 619 |
.getDefaultFeatureType(), new int[] { DataTypes.INT, |
620 |
DataTypes.LONG, DataTypes.STRING }); |
|
620 |
DataTypes.LONG, DataTypes.STRING, DataTypes.DOUBLE });
|
|
621 | 621 |
{ |
622 | 622 |
// asure that attr is in query attributes |
623 | 623 |
boolean attrFound = false; |
branches/dal_time_support/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java | ||
---|---|---|
110 | 110 |
} |
111 | 111 |
|
112 | 112 |
public String getDataTypeName() { |
113 |
if( this.dataType == null ) {
|
|
113 |
if( this.getDataType() == null ) {
|
|
114 | 114 |
return "(unknow)"; |
115 | 115 |
} |
116 |
return this.dataType.getName();
|
|
116 |
return this.getDataType().getName();
|
|
117 | 117 |
} |
118 | 118 |
|
119 | 119 |
public FeatureAttributeDescriptor getCopy() { |
branches/dal_time_support/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToRelativeInstantFeatureAttributeGetter.java | ||
---|---|---|
40 | 40 |
} |
41 | 41 |
|
42 | 42 |
public Object getter(Object sourceAttributeValue) { |
43 |
if (sourceAttributeValue == null){ |
|
44 |
return TIME_SUPPORT_MANAGER.createRelativeInstant(0); |
|
45 |
} |
|
43 | 46 |
return TIME_SUPPORT_MANAGER.createRelativeInstant((long)new Double(sourceAttributeValue.toString()).doubleValue() * 1000); |
44 | 47 |
} |
45 | 48 |
|
branches/dal_time_support/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractAbsoluteInstantFeatureAttributeGetter.java | ||
---|---|---|
53 | 53 |
|
54 | 54 |
public Object getter(Object sourceAttributeValue) { |
55 | 55 |
try { |
56 |
if (sourceAttributeValue == null){ |
|
57 |
return TIME_SUPPORT_MANAGER.createAbsoluteInstant(dateTimeFieldtype, 0); |
|
58 |
} |
|
56 | 59 |
return TIME_SUPPORT_MANAGER.createAbsoluteInstant(dateTimeFieldtype, ((Integer)sourceAttributeValue).intValue()); |
57 | 60 |
} catch (DateTimeFieldTypeNotRegisteredException e) { |
58 | 61 |
LOG.error("Impossible to apply the tranformation for this field", e); |
branches/dal_time_support/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToRelativeInstantFeatureAttributeGetter.java | ||
---|---|---|
39 | 39 |
} |
40 | 40 |
|
41 | 41 |
public Object getter(Object sourceAttributeValue) { |
42 |
if (sourceAttributeValue == null){ |
|
43 |
return TIME_SUPPORT_MANAGER.createRelativeInstant(0); |
|
44 |
} |
|
42 | 45 |
return TIME_SUPPORT_MANAGER.createRelativeInstant((long)new Double(sourceAttributeValue.toString()).doubleValue()); |
43 | 46 |
} |
44 | 47 |
|
branches/dal_time_support/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java | ||
---|---|---|
284 | 284 |
if( index <0 || index >= type.size() ) { |
285 | 285 |
throw new IllegalArgumentException("Attribute index '"+index+"' out of range (0 to "+this.data.getType().size()+"."); |
286 | 286 |
} |
287 |
FeatureAttributeDescriptor attribute = type.getAttributeDescriptor(index); |
|
287 | 288 |
if (!this.data.getType().hasEvaluators()) { |
288 |
return this.data.get(index); |
|
289 |
} |
|
290 |
FeatureAttributeDescriptor attribute = type.getAttributeDescriptor(index); |
|
289 |
return get(attribute, this.data.get(index)); |
|
290 |
} |
|
291 | 291 |
Evaluator eval = attribute.getEvaluator(); |
292 | 292 |
if (eval == null) { |
293 | 293 |
return this.data.get(index); |
... | ... | |
296 | 296 |
if (value != null) { // FIXME: para comprobar si esta calculado usar |
297 | 297 |
// un array |
298 | 298 |
// especifico. |
299 |
return this.data.get(index);
|
|
299 |
return get(attribute, this.data.get(index));
|
|
300 | 300 |
} |
301 | 301 |
try { |
302 | 302 |
value = eval.evaluate(this); |
... | ... | |
304 | 304 |
throw new DataEvaluatorRuntimeException(e); |
305 | 305 |
} |
306 | 306 |
this.data.set(index, value); |
307 |
return value;
|
|
308 |
} |
|
307 |
return get(attribute, value);
|
|
308 |
}
|
|
309 | 309 |
} |
310 |
|
|
311 |
private Object get(FeatureAttributeDescriptor featureAttributeDescriptor, Object value){ |
|
312 |
if (featureAttributeDescriptor.getFeatureAttributeGetter() == null){ |
|
313 |
return value; |
|
314 |
}else{ |
|
315 |
return featureAttributeDescriptor.getFeatureAttributeGetter().getter(value); |
|
316 |
} |
|
317 |
} |
|
310 | 318 |
|
311 | 319 |
public Object[] getArray(String name) { |
312 | 320 |
return this.getArray(this.data.getType().getIndex(name)); |
Also available in: Unified diff