Revision 45769

View differences:

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/DefaultEditableFeature.java
328 328
    public void copyFrom(JsonObject values, Predicate<FeatureAttributeDescriptor> filter) {
329 329
      // iterate over the attributes and copy one by one
330 330
        for (FeatureAttributeDescriptor attr : this.getType()) {
331
            if (attr==null  ) {
332
                continue;
333
            }
331 334
            if( filter!=null && !filter.test(attr) ) {
332 335
                continue;
333 336
            }
334
            if (attr==null || attr.isAutomatic() || attr.isReadOnly() || attr.isComputed() ) {
337
            if (attr.isAutomatic()  || attr.isComputed() ) {
335 338
                continue;
336 339
            }
340
            if( this.isInserted() &&  attr.isReadOnly()) {
341
                continue;
342
            }
337 343
            String attrname = attr.getName();
338 344
            if( !values.containsKey(attrname) ) {
339 345
                continue;
......
458 464
      // iterate over the attributes and copy one by one
459 465
        FeatureType sourceType = source.getType();
460 466
        for (FeatureAttributeDescriptor attr : this.getType()) {
467
            if (attr==null  ) {
468
                continue;
469
            }
461 470
            if( filter!=null && !filter.test(attr) ) {
462 471
                continue;
463 472
            }
464
            if (attr==null || attr.isAutomatic() || attr.isReadOnly() || attr.isComputed() ) {
473
            if (attr.isAutomatic()  || attr.isComputed() ) {
465 474
                continue;
466 475
            }
476
            if( this.isInserted() &&  attr.isReadOnly()) {
477
                continue;
478
            }
467 479
            String attrname = attr.getName();
468 480
            if( sourceType.getAttributeDescriptor(attrname)==null ) {
469 481
              continue;
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/DefaultFeature.java
167 167
    protected void set(FeatureAttributeDescriptor attribute, Object value) {
168 168
        int i = attribute.getIndex();
169 169

  
170
        if (attribute.isReadOnly()) {
171
            throw new SetReadOnlyAttributeException(attribute.getName(), this.getType());
170
        if( this.isInserted() ) {
171
            if (attribute.isReadOnly()) {
172
                throw new SetReadOnlyAttributeException(attribute.getName(), this.getType());
173
            }
174
        } else {
175
            if (attribute.isComputed()) {
176
                throw new SetReadOnlyAttributeException(attribute.getName(), this.getType());
177
            }
172 178
        }
173 179
        FeatureAttributeEmulator emulator = attribute.getFeatureAttributeEmulator();
174 180
        if (emulator != null) {

Also available in: Unified diff