PropertySetID propertySetID = (PropertySetID) JDOHelper.getObjectId(detachedPerson);
if (propertySetID == null)
throw new IllegalArgumentException("detachedPerson does not have an object-id assigned!");
Person attachedPerson;
try {
attachedPerson = (Person) pm.getObjectById(propertySetID);
} catch (JDOObjectNotFoundException x) {
// doesn't exist => return
return;
}
// Collection<? extends DataField> detachedDataFields = detachedPerson.getDataFields();
Set<StructFieldID> nonFilteredStructFieldIDs = CollectionUtil.castSet((Set<?>) detachedPerson.getNonPersistentUserObjectMap().get("nonFilteredStructFieldIDs"));
for (DataField attachedDataField : attachedPerson.getDataFields()) {
// if (!detachedDataFields.contains(attachedDataField))
if (!nonFilteredStructFieldIDs.contains(attachedDataField.getStructFieldIDObj()))
detachedPerson.internalAddDataFieldToPersistentCollection(attachedDataField);
}
}