*/
void processDeletedID(Object nodeId) {
// access object map directly - the method should be called in a synchronized
// context...
Persistent object = objectMap.get(nodeId);
if (object != null) {
DataObject dataObject = (object instanceof DataObject)
? (DataObject) object
: null;
DataContextDelegate delegate;
switch (object.getPersistenceState()) {
case PersistenceState.COMMITTED:
case PersistenceState.HOLLOW:
case PersistenceState.DELETED:
// consult delegate
delegate = context.nonNullDelegate();
if (dataObject == null || delegate.shouldProcessDelete(dataObject)) {
objectMap.remove(nodeId);
changes.remove(nodeId);
// setting DataContext to null will also set
// state to transient
object.setObjectContext(null);
if (dataObject != null) {
delegate.finishedProcessDelete(dataObject);
}
}
break;
case PersistenceState.MODIFIED:
// consult delegate
delegate = context.nonNullDelegate();
if (dataObject != null && delegate.shouldProcessDelete(dataObject)) {
object.setPersistenceState(PersistenceState.NEW);
changes.remove(nodeId);
registerNode(nodeId, object);
nodeCreated(nodeId);
delegate.finishedProcessDelete(dataObject);