Search in sources :

Example 1 with SimpleCodeTable

use of com.revolsys.record.code.SimpleCodeTable in project com.revolsys.open by revolsys.

the class FeatureLayer method setCodeTable.

@SuppressWarnings("unchecked")
private void setCodeTable(final FieldDefinition fieldDefinition, final MapEx field) {
    final MapEx domain = (MapEx) field.get("domain");
    if (domain != null) {
        final String domainType = domain.getString("type");
        final String domainName = domain.getString("name");
        final List<MapEx> codedValues = (List<MapEx>) domain.get("codedValues");
        if ("codedValue".equals(domainType) && Property.hasValuesAll(domainName, codedValues)) {
            final SimpleCodeTable codeTable = new SimpleCodeTable(domainName);
            for (final MapEx codedValue : codedValues) {
                final String code = codedValue.getString("code");
                final String description = codedValue.getString("name");
                codeTable.addValue(code, description);
            }
            fieldDefinition.setCodeTable(codeTable);
        }
    }
}
Also used : MapEx(com.revolsys.collection.map.MapEx) List(java.util.List) SimpleCodeTable(com.revolsys.record.code.SimpleCodeTable)

Aggregations

MapEx (com.revolsys.collection.map.MapEx)1 SimpleCodeTable (com.revolsys.record.code.SimpleCodeTable)1 List (java.util.List)1