void postprocess() {
if (!objectsByDescriptor.isEmpty()) {
CompoundDiff result = parent.getResultDiff();
Map<ObjectId, DataRow> modifiedSnapshots = parent
.getResultModifiedSnapshots();
Collection<ObjectId> deletedIds = parent.getResultDeletedIds();
for (Map.Entry<ClassDescriptor, List<Persistent>> entry : objectsByDescriptor
.entrySet()) {
ClassDescriptor descriptor = entry.getKey();
for (Persistent object : entry.getValue()) {
ObjectId id = object.getObjectId();
ObjectId finalId;
// record id change and update attributes for generated ids
if (id.isReplacementIdAttached()) {
Map<String, Object> replacement = id.getReplacementIdMap();
Iterator<Property> idProperties = descriptor.getIdProperties();
while (idProperties.hasNext()) {
AttributeProperty property = (AttributeProperty) idProperties
.next();
Object value = replacement.get(property
.getAttribute()
.getDbAttributeName());
// TODO: andrus, 11/28/2006: this operation may be redundant
// if the id wasn't generated. We may need to optimize it...
if (value != null) {
property.writePropertyDirectly(object, null, value);
}
}
ObjectId replacementId = id.createReplacementId();
result.add(new NodeIdChangeOperation(id, replacementId));
// classify replaced permanent ids as "deleted", as
// DataRowCache has no notion of replaced id...
if (!id.isTemporary()) {
deletedIds.add(id);