/**
* {@inheritDoc}
* @see HierarchyEntry#revert()
*/
public void revert() throws RepositoryException {
ItemState state = internalGetItemState();
if (state == null) {
// nothing to do
return;
}
int oldStatus = state.getStatus();
switch (oldStatus) {
case Status.EXISTING_MODIFIED:
case Status.STALE_MODIFIED:
// revert state modifications
state.revert();
state.setStatus(Status.EXISTING);
break;
case Status.EXISTING_REMOVED:
// revert state modifications
state.revert();
state.setStatus(Status.EXISTING);
break;
case Status.NEW:
// reverting a NEW state is equivalent to its removal.
// however: no need remove the complete hierarchy as revert is
// always related to Item#refresh(false) which affects the
// complete tree (and all add-operations within it) anyway.
state.setStatus(Status.REMOVED);
parent.internalRemoveChildEntry(this);
break;
case Status.STALE_DESTROYED:
// overlayed does not exist any more -> reverting of pending
// transient changes (that lead to the stale status) can be