Path p = m1.getPrimaryPath().computeRelativePath(getPrimaryPath());
if (nodeId.getUniqueID() != null) { n = getNode(idFactory.createNodeId(nodeId.getUniqueID()), sInfo); relPath = (path.isAbsolute()) ? getPathFactory().getRootPath().computeRelativePath(nodeId.getPath()) : path; } else { int degree = 0; if (hasNode(sessionInfo, parentId)) { n = getNode(parentId, sInfo); relPath = ancestorPath.computeRelativePath(path);
correspondingPath = correspNode.getPath(); } else { Path p = referenceableNode.getQPath().computeRelativePath(getQPath());
Path p = m1.getPrimaryPath().computeRelativePath(getPrimaryPath());
@Override public void restore(SessionInfo sessionInfo, NodeId nodeId, NodeId versionId, boolean removeExisting) throws RepositoryException { String uri = getItemUri(nodeId, sessionInfo); String vUri = getItemUri(versionId, sessionInfo); Path relPath = null; if (!exists(sessionInfo, uri)) { // restore with rel-Path part Path path = nodeId.getPath(); if (nodeId.getUniqueID() != null) { uri = getItemUri(idFactory.createNodeId(nodeId.getUniqueID(), null), sessionInfo); relPath = (path.isAbsolute()) ? getPathFactory().getRootPath().computeRelativePath(path) : path; } else { int degree = 0; while (degree < path.getLength()) { Path ancestorPath = path.getAncestor(degree); NodeId parentId = idFactory.createNodeId(nodeId.getUniqueID(), ancestorPath); if (exists(sessionInfo, getItemUri(parentId, sessionInfo))) { uri = getItemUri(parentId, sessionInfo); relPath = ancestorPath.computeRelativePath(path); break; } degree++; } } } update(uri, relPath, new String[] { vUri }, UpdateInfo.UPDATE_BY_VERSION, removeExisting, sessionInfo); }
correspondingPath = correspNode.getPath(); } else { Path p = referenceableNode.getQPath().computeRelativePath(getQPath());
if (nodeId.getUniqueID() != null) { n = getNode(idFactory.createNodeId(nodeId.getUniqueID()), sInfo); relPath = (path.isAbsolute()) ? getPathFactory().getRootPath().computeRelativePath(nodeId.getPath()) : path; } else { int degree = 0; if (hasNode(sessionInfo, parentId)) { n = getNode(parentId, sInfo); relPath = ancestorPath.computeRelativePath(path);
@Override public void restore(SessionInfo sessionInfo, NodeId nodeId, NodeId versionId, boolean removeExisting) throws RepositoryException { String uri = getItemUri(nodeId, sessionInfo); String vUri = getItemUri(versionId, sessionInfo); Path relPath = null; if (!exists(sessionInfo, uri)) { // restore with rel-Path part Path path = nodeId.getPath(); if (nodeId.getUniqueID() != null) { uri = getItemUri(idFactory.createNodeId(nodeId.getUniqueID(), null), sessionInfo); relPath = (path.isAbsolute()) ? getPathFactory().getRootPath().computeRelativePath(path) : path; } else { int degree = 0; while (degree < path.getLength()) { Path ancestorPath = path.getAncestor(degree); NodeId parentId = idFactory.createNodeId(nodeId.getUniqueID(), ancestorPath); if (exists(sessionInfo, getItemUri(parentId, sessionInfo))) { uri = getItemUri(parentId, sessionInfo); relPath = ancestorPath.computeRelativePath(path); break; } degree++; } } } update(uri, relPath, new String[] { vUri }, UpdateInfo.UPDATE_BY_VERSION, removeExisting, sessionInfo); }
Path relPath = anyParentPath.computeRelativePath(info.getPath()); Path.Element[] missingElems = relPath.getElements();
Path relPath = anyParentPath.computeRelativePath(info.getPath()); Path.Element[] missingElems = relPath.getElements();
Path nodePath = hmgr.getPath(nodeState.getId()); Path propPath = hmgr.getPath(propState.getId()); Path p = nodePath.computeRelativePath(propPath);
Path nodePath = hmgr.getPath(nodeState.getId()); Path propPath = hmgr.getPath(propState.getId()); Path p = nodePath.computeRelativePath(propPath);
Path relPath = parentPath.computeRelativePath(targetPath); isGranted = getAccessManager().isGranted(parentState, relPath, actionsArr);
Path relPath = parentPath.computeRelativePath(targetPath); isGranted = getAccessManager().isGranted(parentState, relPath, actionsArr);
/** * @see Node#restore(Version, String, boolean) */ public void restore(Version version, String relPath, boolean removeExisting) throws PathNotFoundException, ItemExistsException, VersionException, ConstraintViolationException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { checkSessionHasPendingChanges(); // additional checks are performed with subsequent calls. if (hasNode(relPath)) { // node at 'relPath' exists -> call restore on the target Node getNode(relPath).restore(version, removeExisting); } else { // node at 'relPath' does not yet exist -> build the NodeId Path nPath = getPath(relPath); Path parentPath = nPath.getAncestor(1); ItemManager itemMgr = getItemManager(); if (itemMgr.nodeExists(parentPath)) { Node parent = itemMgr.getNode(parentPath); Path relQPath = parentPath.computeRelativePath(nPath); NodeImpl parentNode = ((NodeImpl)parent); // call the restore restore(parentNode, relQPath, version, removeExisting); } else if (itemMgr.propertyExists(parentPath)) { // the item at parentParentPath is Property throw new ConstraintViolationException("Cannot restore to a parent presenting a property (relative path = '" + relPath + "'"); } else { // although the node itself must not exist, is direct ancestor must. throw new PathNotFoundException("Cannot restore to relative path '" + relPath + ": Ancestor does not exist."); } } }
/** * @see Node#restore(Version, String, boolean) */ public void restore(Version version, String relPath, boolean removeExisting) throws PathNotFoundException, ItemExistsException, VersionException, ConstraintViolationException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { checkSessionHasPendingChanges(); // additional checks are performed with subsequent calls. if (hasNode(relPath)) { // node at 'relPath' exists -> call restore on the target Node getNode(relPath).restore(version, removeExisting); } else { // node at 'relPath' does not yet exist -> build the NodeId Path nPath = getPath(relPath); Path parentPath = nPath.getAncestor(1); ItemManager itemMgr = getItemManager(); if (itemMgr.nodeExists(parentPath)) { Node parent = itemMgr.getNode(parentPath); Path relQPath = parentPath.computeRelativePath(nPath); NodeImpl parentNode = ((NodeImpl)parent); // call the restore restore(parentNode, relQPath, version, removeExisting); } else if (itemMgr.propertyExists(parentPath)) { // the item at parentParentPath is Property throw new ConstraintViolationException("Cannot restore to a parent presenting a property (relative path = '" + relPath + "'"); } else { // although the node itself must not exist, is direct ancestor must. throw new PathNotFoundException("Cannot restore to relative path '" + relPath + ": Ancestor does not exist."); } } }