Search in sources :

Example 1 with Type

use of org.openforis.idm.metamodel.NumericAttributeDefinition.Type in project collect by openforis.

the class NumericAttributeDefinitionPR method onStartDefinition.

@Override
protected void onStartDefinition() throws XmlParseException, XmlPullParserException, IOException {
    super.onStartDefinition();
    String typeStr = getAttribute(TYPE, false);
    NumericAttributeDefinition defn = (NumericAttributeDefinition) getDefinition();
    try {
        Type type = typeStr == null ? Type.REAL : Type.valueOf(typeStr.toUpperCase());
        defn.setType(type);
    } catch (IllegalArgumentException e) {
        throw new XmlParseException(getParser(), "unknown type " + typeStr);
    }
}
Also used : Type(org.openforis.idm.metamodel.NumericAttributeDefinition.Type) XmlParseException(org.openforis.idm.metamodel.xml.XmlParseException) NumericAttributeDefinition(org.openforis.idm.metamodel.NumericAttributeDefinition)

Example 2 with Type

use of org.openforis.idm.metamodel.NumericAttributeDefinition.Type in project collect by openforis.

the class NumericAttributeDefinitionFormObject method saveTo.

@Override
public void saveTo(T dest, String languageCode) {
    super.saveTo(dest, languageCode);
    Type typeEnum = null;
    if (type != null) {
        typeEnum = NumericAttributeDefinition.Type.valueOf(type);
    }
    dest.setType(typeEnum);
}
Also used : Type(org.openforis.idm.metamodel.NumericAttributeDefinition.Type)

Aggregations

Type (org.openforis.idm.metamodel.NumericAttributeDefinition.Type)2 NumericAttributeDefinition (org.openforis.idm.metamodel.NumericAttributeDefinition)1 XmlParseException (org.openforis.idm.metamodel.xml.XmlParseException)1