Revision 39568
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java | ||
---|---|---|
1213 | 1213 |
} |
1214 | 1214 |
} |
1215 | 1215 |
|
1216 |
/** |
|
1217 |
* Save changes in the provider without leaving the edit mode. |
|
1218 |
* Do not call observers to communicate a change of ediding mode. |
|
1219 |
* The operation's history is eliminated to prevent inconsistencies |
|
1220 |
* in the data. |
|
1221 |
* |
|
1222 |
* @throws DataException |
|
1223 |
*/ |
|
1224 |
synchronized public void commitChanges() throws DataException { |
|
1225 |
LOG.debug("commitChanges of mode: {}", new Integer(mode)); |
|
1226 |
if( !canCommitChanges() ) { |
|
1227 |
throw new WriteNotAllowedException(getName()); |
|
1228 |
} |
|
1229 |
try { |
|
1230 |
switch (mode) { |
|
1231 |
case MODE_QUERY: |
|
1232 |
throw new NeedEditingModeException(this.getName()); |
|
1233 |
|
|
1234 |
case MODE_APPEND: |
|
1235 |
this.provider.endAppend(); |
|
1236 |
exitEditingMode(); |
|
1237 |
invalidateIndexes(); |
|
1238 |
this.provider.beginAppend(); |
|
1239 |
hasInserts = false; |
|
1240 |
break; |
|
1241 |
|
|
1242 |
case MODE_FULLEDIT: |
|
1243 |
if (hasStrongChanges && !this.allowWrite()) { |
|
1244 |
throw new WriteNotAllowedException(getName()); |
|
1245 |
} |
|
1246 |
if (hasStrongChanges) { |
|
1247 |
validateFeatures(Feature.FINISH_EDITING); |
|
1248 |
provider.performChanges(featureManager.getDeleted(), |
|
1249 |
featureManager.getInserted(), |
|
1250 |
featureManager.getUpdated(), |
|
1251 |
featureTypeManager.getFeatureTypesChanged()); |
|
1252 |
} |
|
1253 |
invalidateIndexes(); |
|
1254 |
featureManager = |
|
1255 |
new FeatureManager(new MemoryExpansionAdapter()); |
|
1256 |
featureTypeManager = |
|
1257 |
new FeatureTypeManager(this, new MemoryExpansionAdapter()); |
|
1258 |
spatialManager = |
|
1259 |
new SpatialManager(this, provider.getEnvelope()); |
|
1260 |
|
|
1261 |
commands = |
|
1262 |
new DefaultFeatureCommandsStack(this, featureManager, |
|
1263 |
spatialManager, featureTypeManager); |
|
1264 |
featureCount = null; |
|
1265 |
hasStrongChanges = false; |
|
1266 |
hasInserts = false; |
|
1267 |
break; |
|
1268 |
} |
|
1269 |
} catch (Exception e) { |
|
1270 |
throw new FinishEditingException(e); |
|
1271 |
} |
|
1272 |
} |
|
1273 |
|
|
1274 |
synchronized public boolean canCommitChanges() { |
|
1275 |
/* |
|
1276 |
* FIXME: retornara true si se puede invocar a |
|
1277 |
* la funcion commitChanges.... en general no deberia poderse |
|
1278 |
* invocar a esta funcion si no estas en edicion o se han |
|
1279 |
* realizado cambios en la estructura de datos. |
|
1280 |
*/ |
|
1281 |
return true; |
|
1282 |
} |
|
1283 |
|
|
1216 | 1284 |
public void beginEditingGroup(String description) |
1217 | 1285 |
throws NeedEditingModeException { |
1218 | 1286 |
checkInEditingMode(); |
Also available in: Unified diff