if (isProcessed)
return;
}
NSArray entityNames = ercnSnapshot.shapshotsForUpdateGroupedByEntity().allKeys();
EOEditingContext ec = new EOEditingContext();
ec.lock();
Enumeration entitiesEnumerator = entityNames.objectEnumerator();
while (entitiesEnumerator.hasMoreElements()) {
String entityName = (String)entitiesEnumerator.nextElement();
if (! ERCNSnapshot.shouldSynchronizeEntity(entityName)) continue;
EOEntity entity = EOModelGroup.defaultGroup().entityNamed(entityName);
EODatabaseContext dbContext = ERCNNotificationCoordinator.databaseContextForEntityNamed(entityName, ec);
EODatabase database = dbContext.database();
NSArray snapshots = (NSArray)ercnSnapshot.shapshotsForUpdateGroupedByEntity().objectForKey(entityName);
Enumeration snapshotsEnumerator = snapshots.objectEnumerator();
while (snapshotsEnumerator.hasMoreElements()) {
NSDictionary snapshot = (NSDictionary)snapshotsEnumerator.nextElement();
if (NSLog.debug.isEnabled())
NSLog.debug.appendln(ERCNNotificationCoordinator.LOG_HEADER + "Snapshot: " + snapshot);
if (snapshot != null) {
EOGlobalID globalID = entity.globalIDForRow(snapshot);
dbContext.lock();
database.forgetSnapshotForGlobalID(globalID);
database.recordSnapshotForGlobalID(snapshot, globalID);
dbContext.unlock();
}
}
}
ec.unlock();
}