Revision 44501
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/FeatureAttributeDescriptor.java | ||
---|---|---|
270 | 270 |
public String getLocalizedLabel(); |
271 | 271 |
|
272 | 272 |
public String getLabelOfValue(Object value); |
273 |
|
|
274 |
public boolean hasOnlyMetadataChanges(FeatureAttributeDescriptor other); |
|
275 |
|
|
273 | 276 |
} |
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/FeatureType.java | ||
---|---|---|
332 | 332 |
FeatureStore getAsFeatureStore(); |
333 | 333 |
|
334 | 334 |
public String getNewFieldName(); |
335 |
/** |
|
336 |
* Return the store associated to this type. |
|
337 |
* It will return Null when it's in not editing mode |
|
335 |
|
|
336 |
/** |
|
337 |
* Return the original feature type of this type. |
|
338 |
* It will return Null when the store it's in not editing mode |
|
338 | 339 |
* or the featureType has not been change |
339 | 340 |
* |
340 |
* @return the original FeatureStore of the type.
|
|
341 |
* @return the original FeatureType of the type.
|
|
341 | 342 |
*/ |
342 | 343 |
public FeatureType getOriginalFeatureType(); |
344 |
|
|
345 |
public boolean hasOnlyMetadataChanges(FeatureType other); |
|
346 |
|
|
343 | 347 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/test/java/org/gvsig/fmap/dal/feature/DummyFeatureType.java | ||
---|---|---|
471 | 471 |
return null; |
472 | 472 |
} |
473 | 473 |
|
474 |
@Override |
|
475 |
public boolean hasOnlyMetadataChanges(FeatureType other) { |
|
476 |
return false; |
|
477 |
} |
|
478 |
|
|
474 | 479 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/test/java/org/gvsig/fmap/dal/feature/DummyFeatureAttributeDescriptor.java | ||
---|---|---|
573 | 573 |
public DataProfile getDataProfile() { |
574 | 574 |
return null; |
575 | 575 |
} |
576 |
|
|
577 |
@Override |
|
578 |
public boolean hasOnlyMetadataChanges(FeatureAttributeDescriptor other) { |
|
579 |
return false; |
|
580 |
} |
|
576 | 581 |
|
577 | 582 |
} |
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/DefaultFeatureAttributeDescriptor.java | ||
---|---|---|
1155 | 1155 |
return this.indexed; |
1156 | 1156 |
} |
1157 | 1157 |
|
1158 |
@Override |
|
1158 | 1159 |
public boolean isForeingKey() { |
1159 | 1160 |
return this.foreingKey!=null && this.foreingKey.isForeingKey(); |
1160 | 1161 |
} |
1161 | 1162 |
|
1163 |
@Override |
|
1162 | 1164 |
public ForeingKey getForeingKey() { |
1163 | 1165 |
return this.foreingKey; |
1164 | 1166 |
} |
... | ... | |
1383 | 1385 |
DefaultFeatureType.RECENTS_USEDS.add(this); |
1384 | 1386 |
} |
1385 | 1387 |
|
1388 |
@Override |
|
1389 |
public boolean hasOnlyMetadataChanges(FeatureAttributeDescriptor other) { |
|
1390 |
if( other == null ) { |
|
1391 |
throw new NullPointerException(); |
|
1392 |
} |
|
1393 |
DefaultFeatureAttributeDescriptor old = (DefaultFeatureAttributeDescriptor) other; |
|
1394 |
if( !StringUtils.equalsIgnoreCase(old.name, this.name) ) { |
|
1395 |
return false; |
|
1396 |
} |
|
1397 |
if( old.isComputed() && old.isComputed()==this.isComputed() ) { |
|
1398 |
return true; |
|
1399 |
} |
|
1400 |
if( this.dataType!=old.dataType ) { |
|
1401 |
return false; |
|
1402 |
} |
|
1403 |
if( this.size != old.size ) { |
|
1404 |
return false; |
|
1405 |
} |
|
1406 |
if( this.precision != old.precision ) { |
|
1407 |
return false; |
|
1408 |
} |
|
1409 |
if( this.primaryKey != old.primaryKey ) { |
|
1410 |
return false; |
|
1411 |
} |
|
1412 |
if( this.geomType != old.geomType ) { |
|
1413 |
return false; |
|
1414 |
} |
|
1415 |
if( this.SRS != old.SRS ) { |
|
1416 |
return false; |
|
1417 |
} |
|
1418 |
if( this.isAutomatic != old.isAutomatic ) { |
|
1419 |
return false; |
|
1420 |
} |
|
1421 |
return true; |
|
1422 |
} |
|
1423 |
|
|
1386 | 1424 |
} |
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/DefaultFeatureType.java | ||
---|---|---|
1123 | 1123 |
} |
1124 | 1124 |
return store.getOriginalFeatureType(this); |
1125 | 1125 |
} |
1126 |
@Override |
|
1127 |
public boolean hasOnlyMetadataChanges(FeatureType old) { |
|
1128 |
if( old == null ) { |
|
1129 |
throw new NullPointerException(); |
|
1130 |
} |
|
1131 |
// Si hay campos nuevos -> false |
|
1132 |
for (FeatureAttributeDescriptor attr : this) { |
|
1133 |
if( old.getAttributeDescriptor(attr.getName())==null ) { |
|
1134 |
return false; |
|
1135 |
} |
|
1136 |
} |
|
1137 |
|
|
1138 |
// Si se ha eliminado algun campo -> false |
|
1139 |
for (FeatureAttributeDescriptor attr : old) { |
|
1140 |
if( this.getAttributeDescriptor(old.getName())==null ) { |
|
1141 |
return false; |
|
1142 |
} |
|
1143 |
} |
|
1144 |
|
|
1145 |
// No hay campos nuevos ni se ha eliminado ninguno, asi que comparamos |
|
1146 |
// los campos uno a uno. |
|
1147 |
for (FeatureAttributeDescriptor attr : this) { |
|
1148 |
FeatureAttributeDescriptor attrold = old.getAttributeDescriptor(attr.getName()); |
|
1149 |
if( !attr.hasOnlyMetadataChanges(attrold) ) { |
|
1150 |
return false; |
|
1151 |
} |
|
1152 |
} |
|
1153 |
return true; |
|
1154 |
} |
|
1126 | 1155 |
} |
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/DefaultFeatureStore.java | ||
---|---|---|
196 | 196 |
private SpatialManager spatialManager; |
197 | 197 |
|
198 | 198 |
private FeatureType defaultFeatureType = null; |
199 |
private List featureTypes = new ArrayList();
|
|
199 |
private List<FeatureType> featureTypes = new ArrayList<>();
|
|
200 | 200 |
|
201 | 201 |
private int mode = MODE_QUERY; |
202 | 202 |
private long versionOfUpdate = 0; |
... | ... | |
1234 | 1234 |
if (type == null) { |
1235 | 1235 |
throw new NullFeatureTypeException(getName()); |
1236 | 1236 |
} |
1237 |
if (mode == MODE_QUERY && type.hasOnlyMetadataChanges(this.featureTypeManager.getOriginalFeatureType())) { |
|
1238 |
FeatureType theType = type.getCopy(); |
|
1239 |
if( defaultFeatureType.getId().equals(theType.getId()) ) { |
|
1240 |
defaultFeatureType = theType; |
|
1241 |
} |
|
1242 |
for (int i = 0; i < featureTypes.size(); i++) { |
|
1243 |
FeatureType featureType = featureTypes.get(i); |
|
1244 |
if( featureType.getId().equals(theType.getId()) ) { |
|
1245 |
featureTypes.set(i, theType); |
|
1246 |
break; |
|
1247 |
} |
|
1248 |
} |
|
1249 |
saveDALFile(); |
|
1250 |
return ; |
|
1251 |
} |
|
1237 | 1252 |
boolean typehasStrongChanges = ((DefaultEditableFeatureType) type).hasStrongChanges(); |
1238 | 1253 |
if (typehasStrongChanges) { |
1239 | 1254 |
checkInEditingMode(); |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretable/table/DynFieldFacadeOfAFeatureAttributeDescriptor.java | ||
---|---|---|
604 | 604 |
return null; |
605 | 605 |
} |
606 | 606 |
|
607 |
@Override |
|
608 |
public boolean hasOnlyMetadataChanges(FeatureAttributeDescriptor other) { |
|
609 |
return false; |
|
610 |
} |
|
611 |
|
|
607 | 612 |
} |
Also available in: Unified diff