final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
sessionDelegate.perform(new SessionOperation<Void>(true) {
@Override
public Void perform() throws RepositoryException {
String oakPath = getOakPathOrThrowNotFound(absPath);
NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
if (nodeDelegate != null) {
throw new VersionException(
"VersionManager.restore(String, Version, boolean)"
+ " not allowed on existing nodes; use"
+ " VersionManager.restore(Version, boolean) instead: "
+ absPath);
}
// check if parent exists
NodeDelegate parent = ensureParentExists(sessionDelegate, absPath);
// check for pending changes
checkPendingChangesForRestore(sessionDelegate);
// check lock status
checkNotLocked(parent.getPath());
// check for existing nodes
List<NodeDelegate> existing = getExisting(version,
Collections.<String>emptySet());
boolean success = false;
try {