Revision 44678 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/DefaultFeatureAttributeDescriptor.java
DefaultFeatureAttributeDescriptor.java | ||
---|---|---|
35 | 35 |
import java.util.Map; |
36 | 36 |
import java.util.Map.Entry; |
37 | 37 |
import java.util.Objects; |
38 |
import java.util.logging.Level; |
|
38 | 39 |
import org.apache.commons.lang3.ArrayUtils; |
39 | 40 |
import org.apache.commons.lang3.StringUtils; |
40 | 41 |
import org.cresques.cts.IProjection; |
... | ... | |
149 | 150 |
|
150 | 151 |
public DefaultFeatureAttributeDescriptor() { |
151 | 152 |
// Usada en la persistencia |
153 |
this.precision = DataType.PRECISION_NONE; |
|
154 |
this.scale = DataType.SCALE_NONE; |
|
155 |
this.roundMode = BigDecimal.ROUND_HALF_UP; |
|
152 | 156 |
} |
153 | 157 |
|
154 | 158 |
protected DefaultFeatureAttributeDescriptor(FeatureType type) { |
... | ... | |
165 | 169 |
this.size = 0; |
166 | 170 |
this.name = null; |
167 | 171 |
this.objectClass = null; |
168 |
this.precision = 0;
|
|
169 |
this.scale = 0;
|
|
172 |
this.precision = DataType.PRECISION_NONE;
|
|
173 |
this.scale = DataType.SCALE_NONE;
|
|
170 | 174 |
this.roundMode = BigDecimal.ROUND_HALF_UP; |
171 | 175 |
this.evaluator = null; |
172 | 176 |
this.primaryKey = false; |
... | ... | |
713 | 717 |
|
714 | 718 |
@Override |
715 | 719 |
public void saveToState(PersistentState state) throws PersistenceException { |
720 |
Coercion toString = ToolsLocator.getDataTypesManager().getCoercion(DataTypes.STRING); |
|
721 |
|
|
716 | 722 |
state.set("allowNull", allowNull); |
717 | 723 |
state.set("dataType", dataType.getType()); |
718 | 724 |
state.set("dataProfile", dataProfile); |
... | ... | |
729 | 735 |
state.set("precision", precision); |
730 | 736 |
state.set("scale", scale); |
731 | 737 |
state.set("roundMode", roundMode); |
732 |
state.set("locale", this.locale == null ? null : this.locale.toLanguageTag()); |
|
738 |
try { |
|
739 |
state.set("locale", toString.coerce(this.locale)); |
|
740 |
} catch (CoercionException ex) { |
|
741 |
state.setNull("locale"); |
|
742 |
} |
|
733 | 743 |
state.set("evaluator", evaluator); |
734 | 744 |
|
735 | 745 |
state.set("primaryKey", primaryKey); |
... | ... | |
816 | 826 |
definition.addDynFieldString("name"); |
817 | 827 |
definition.addDynFieldString("objectClass"); |
818 | 828 |
definition.addDynFieldInt("precision"); |
819 |
definition.addDynFieldInt("scale"); |
|
820 |
definition.addDynFieldInt("roundMode"); |
|
821 |
definition.addDynFieldString("locale"); |
|
822 |
definition.addDynFieldObject("evaluator") |
|
823 |
.setClassOfValue(Evaluator.class); |
|
829 |
definition.addDynFieldInt("scale").setMandatory(false).setDefaultDynValue(DataType.SCALE_NONE); |
|
830 |
definition.addDynFieldInt("roundMode").setMandatory(false).setDefaultDynValue(BigDecimal.ROUND_HALF_UP); |
|
831 |
definition.addDynFieldString("locale").setMandatory(false).setDefaultDynValue("null"); |
|
832 |
definition.addDynFieldObject("evaluator").setClassOfValue(Evaluator.class); |
|
824 | 833 |
definition.addDynFieldBoolean("primaryKey"); |
825 | 834 |
definition.addDynFieldBoolean("readOnly"); |
826 | 835 |
definition.addDynFieldObject("SRS") |
... | ... | |
1411 | 1420 |
return this; |
1412 | 1421 |
} |
1413 | 1422 |
|
1414 |
@Override |
|
1415 |
public boolean supportSize() { |
|
1416 |
return this.getDataType().supportSize(); |
|
1417 |
} |
|
1418 |
|
|
1419 |
@Override |
|
1420 |
public boolean supportPrecision() { |
|
1421 |
return this.getDataType().supportPrecision(); |
|
1422 |
} |
|
1423 |
|
|
1424 |
@Override |
|
1425 |
public boolean supportScale() { |
|
1426 |
return this.getDataType().supportScale(); |
|
1427 |
} |
|
1428 |
|
|
1429 | 1423 |
private class ConstantValueEvaluator extends AbstractEvaluator { |
1430 | 1424 |
|
1431 | 1425 |
@Override |
Also available in: Unified diff