/**
* {@inheritDoc}
* @see HierarchyEntry#transientRemove()
*/
public void transientRemove() throws InvalidItemStateException, RepositoryException {
ItemState state = internalGetItemState();
if (state == null) {
// nothing to do -> correct status must be set upon resolution.
return;
}
// if during recursive removal an invalidated entry is found, reload
// it in order to determine the current status.
if (state.getStatus() == Status.INVALIDATED) {
reload(false, false);
// check if upon reload the item has been removed -> nothing to do
if (Status.isTerminal(state.getStatus())) {
return;
}
}
switch (state.getStatus()) {
case Status.NEW:
remove();
break;
case Status.EXISTING:
case Status.EXISTING_MODIFIED:
state.setStatus(Status.EXISTING_REMOVED);
// NOTE: parent does not need to be informed. an transiently
// removed propertyEntry is automatically moved to the 'attic'
// if a conflict with a new entry occurs.
break;
case Status.REMOVED:
case Status.STALE_DESTROYED:
throw new InvalidItemStateException("Item has already been removed by someone else. Status = " + Status.getName(state.getStatus()));
default:
throw new RepositoryException("Cannot transiently remove an ItemState with status " + Status.getName(state.getStatus()));
}
}