Revision 46024 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
DefaultEditableFeature.java | ||
---|---|---|
355 | 355 |
this.copyFrom(values, null); |
356 | 356 |
} |
357 | 357 |
|
358 |
private boolean notCopyAttribute(FeatureAttributeDescriptor attr,Predicate<FeatureAttributeDescriptor> filter) { |
|
359 |
// helper function to use in copyFrom |
|
360 |
if (attr==null ) { |
|
361 |
return true; |
|
362 |
} |
|
363 |
if (attr.isAutomatic() || attr.isComputed() ) { |
|
364 |
return true; |
|
365 |
} |
|
366 |
if( this.isInserted() && attr.isReadOnly()) { |
|
367 |
return true; |
|
368 |
} |
|
369 |
if( filter!=null && !filter.test(attr) ) { |
|
370 |
return true; |
|
371 |
} |
|
372 |
return false; |
|
373 |
} |
|
358 |
// private boolean notCopyAttribute(FeatureAttributeDescriptor attr,Predicate<FeatureAttributeDescriptor> filter) {
|
|
359 |
// // helper function to use in copyFrom
|
|
360 |
// if (attr==null ) {
|
|
361 |
// return true;
|
|
362 |
// }
|
|
363 |
// if (attr.isAutomatic() || attr.isComputed() ) {
|
|
364 |
// return true;
|
|
365 |
// }
|
|
366 |
// if( this.isInserted() && attr.isReadOnly()) {
|
|
367 |
// return true;
|
|
368 |
// }
|
|
369 |
// if( filter!=null && !filter.test(attr) ) {
|
|
370 |
// return true;
|
|
371 |
// }
|
|
372 |
// return false;
|
|
373 |
// }
|
|
374 | 374 |
|
375 | 375 |
@Override |
376 | 376 |
public void copyFrom(JsonObject values, Predicate<FeatureAttributeDescriptor> filter) { |
... | ... | |
380 | 380 |
} |
381 | 381 |
boolean geometryCopied = false; |
382 | 382 |
for (FeatureAttributeDescriptor attr : this.getType()) { |
383 |
if( notCopyAttribute(attr, filter) ) {
|
|
383 |
if( !canSetValue(attr, filter) ) {
|
|
384 | 384 |
continue; |
385 | 385 |
} |
386 | 386 |
String attrname = attr.getName(); |
... | ... | |
514 | 514 |
} |
515 | 515 |
FeatureType sourceType = source.getType(); |
516 | 516 |
for (FeatureAttributeDescriptor attr : this.getType()) { |
517 |
if( notCopyAttribute(attr, filter) ) {
|
|
517 |
if( !canSetValue(attr, filter) ) {
|
|
518 | 518 |
continue; |
519 | 519 |
} |
520 | 520 |
String attrname = attr.getName(); |
Also available in: Unified diff