Revision 45784

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/CSVUtils.java
327 327
            for (Map.Entry<String, String> entry : fieldType.typetags.entrySet()) {
328 328
                ftypeTags.set(entry.getKey(), entry.getValue());
329 329
            }
330
            for (Map.Entry<String, String> entry : fieldType.typeAssignments.entrySet()) {
331
                try {
332
                    fType.set(entry.getKey(), entry.getValue());
333
                } catch(Exception ex) {
334
                    LOGGER.warn("Can't set attribute '"+entry.getKey()+"' in the feature type.", ex);
335
                }
336
            }
330 337
        }
331 338
        // Processamos ahora los campos calculados
332 339
        for (FieldTypeParser fieldType : fieldTypes) {
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/FieldTypeParser.java
31 31
    public Map<String, String> tags = new HashMap<>();
32 32
    public Map<String, String> typetags = new HashMap<>();
33 33
    public Map<String, String> assignments = new HashMap<>();
34
    public Map<String, String> typeAssignments = new HashMap<>();
34 35
    // Valores obtenidos desde la deteccion automatica desde los datos
35 36
    public AutomaticDetectionOfTypes.DetectedValue detectedValue = null;
36 37
    private String typename = "string";
......
57 58
        this.tags = new HashMap<>();
58 59
        this.typetags = new HashMap<>();
59 60
        this.assignments = new HashMap<>();
61
        this.typeAssignments = new HashMap<>();
60 62
    }
61 63

  
62 64
    public void copyFrom(FieldTypeParser other) {
......
69 71
        this.typetags.putAll(other.typetags);
70 72
        this.assignments = new HashMap<>();
71 73
        this.assignments.putAll(other.assignments);
74
        this.typeAssignments = new HashMap<>();
75
        this.typeAssignments.putAll(other.typeAssignments);
72 76
    }
73 77

  
74 78
    private int getType(String value) {
......
165 169
                        }
166 170
                        break;
167 171
                    }
172
                case "typeset":
173
                    {
174
                        String x = StringUtils.trim(args[n++]);
175
                        int pos = x.indexOf("=");
176
                        if (pos < 0) {
177
                            this.typeAssignments.put(x, null);
178
                        } else {
179
                            this.typeAssignments.put(StringUtils.trim(StringUtils.substring(x, 0, pos)), StringUtils.trim(StringUtils.substring(x, pos + 1)));
180
                        }
181
                        break;
182
                    }
168 183
                default:
169 184
                    if (StringUtils.isNumeric(option) && this.size == 0) {
170 185
                        try {
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/DefaultEditableFeatureType.java
26 26

  
27 27
import java.util.Iterator;
28 28
import javax.json.JsonObject;
29
import org.apache.commons.lang3.StringUtils;
30
import org.gvsig.fmap.dal.DataTypeUtils;
29 31

  
30 32
import org.gvsig.fmap.dal.DataTypes;
31 33
import org.gvsig.fmap.dal.exception.DataListException;
......
466 468
    }
467 469

  
468 470
    public void copyFrom(JsonObject json) {
469

  
471
        // TODO: falta por implementar copyFrom(json)
470 472
    }
473
    
474
    @Override
475
    public void set(String name, String value) {
476
        if (StringUtils.isBlank(name)) {
477
            throw new IllegalArgumentException("Name can't be empty");
478
        }
479
        switch (name.trim().toLowerCase()) {
480
            case "checkfeaturesatfinishediting":
481
                this.setCheckFeaturesAtFinishEditing(DataTypeUtils.toBoolean(value, false));
482
                break;
483
            case "checkfeaturesatinsert":
484
                this.setCheckFeaturesAtInsert(DataTypeUtils.toBoolean(value, false));
485
                break;
486
            case "defaultgeometryattributename":
487
            case "defaultgeometryname":
488
            case "defaultgeometry":
489
                this.setDefaultGeometryAttributeName(DataTypeUtils.toString(value, null));
490
                break;
491
            default:
492
                throw new IllegalArgumentException("Name attribute '" + name + "' not valid.");
493
        }
494
    }
495
    
471 496
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/EditableFeatureType.java
206 206
        public void setCheckFeaturesAtFinishEditing(boolean check);
207 207
        
208 208
        public void setCheckFeaturesAtInsert(boolean check);
209

  
210
        public void set(String name, String value);
209 211
}

Also available in: Unified diff