Package javax.jcr

Examples of javax.jcr.Node.restore()


    /**
     * @see javax.jcr.version.VersionManager#restore(String, String, boolean)
     */
    public void restore(String absPath, String versionName, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
        Node n = itemManager.getNode(resolver.getQPath(absPath));
        n.restore(versionName, removeExisting);
    }

    /**
     * @see javax.jcr.version.VersionManager#restore(Version, boolean)
     */
 
View Full Code Here


    /**
     * @see javax.jcr.version.VersionManager#restore(String, Version, boolean)
     */
    public void restore(String absPath, Version version, boolean removeExisting) throws PathNotFoundException, ItemExistsException, VersionException, ConstraintViolationException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
        Node n = itemManager.getNode(resolver.getQPath(absPath));
        n.restore(version, removeExisting);
    }

    /**
     * @see javax.jcr.version.VersionManager#restoreByLabel(String, String, boolean)
     */
 
View Full Code Here

        executeWithLocalEvents(new Callable() {
            public Object run() throws RepositoryException {
                Version v = (Version) getNode(versionId, sInfo);
                if (hasNode(sessionInfo, nodeId)) {
                    Node n = getNode(nodeId, sInfo);
                    n.restore(v, removeExisting);
                } else {
                    // restore with rel-Path part
                    Node n = null;
                    Path relPath = null;
                    Path path = nodeId.getPath();
View Full Code Here

                        }
                    }
                    if (n == null) {
                        throw new PathNotFoundException("Path not found " + nodeId);
                    } else {
                        n.restore(v, sInfo.getNamePathResolver().getJCRPath(relPath), removeExisting);
                    }
                }
                return null;
            }
        }, sInfo);
View Full Code Here

        phase="restore N2 uncommitted.";

        tx = new UserTransactionImpl(s2);
        tx.begin();

        n2.restore("1.0", false);
        Version v2_2 = n2.getBaseVersion();

        check(v1_1, phase, "jcr:rootVersion", 1);
        check(v2_1, phase, "jcr:rootVersion", 1);
        check(v1_2, phase, "1.0", 0);
View Full Code Here

        Version versionB = versionable.getBaseVersion();
        String[] labels = history.getVersionLabels(versionB);
        assertEquals(1, labels.length);
        assertEquals("labelB", labels[0]);
        Version versionA = history.getVersionByLabel("labelA");
        versionable.restore(versionA, true);
        assertEquals("A", versionable.getProperty("foo").getString());
        versionable.restore(versionB, true);
        assertEquals("B", versionable.getProperty("foo").getString());
        return versionable;
    }
View Full Code Here

        assertEquals(1, labels.length);
        assertEquals("labelB", labels[0]);
        Version versionA = history.getVersionByLabel("labelA");
        versionable.restore(versionA, true);
        assertEquals("A", versionable.getProperty("foo").getString());
        versionable.restore(versionB, true);
        assertEquals("B", versionable.getProperty("foo").getString());
        return versionable;
    }

    private void assertProperties(Node test, Node versionable)
View Full Code Here

      try
      {
         Node srcVersionNode = (Node)session.getItem(normalizePath);

         Version baseVersion = srcVersionNode.getBaseVersion();
         srcVersionNode.restore(baseVersion, true);
         session.save();

         sb.append("ok");
      }
      catch (RepositoryException e)
View Full Code Here

         Version baseVersion1 = srcVersionNode.getBaseVersion();
         Version[] predesessors = baseVersion1.getPredecessors();
         Version restoreToBaseVersion = predesessors[0];

         srcVersionNode.restore(restoreToBaseVersion, true);
         session.save();

         sb.append("ok");
      }
      catch (RepositoryException e)
View Full Code Here

                    versions[i] = vh.getVersion(getItemName(itemPath));
                }
                if (versions.length == 1) {
                    String relPath = DomUtil.getChildText(udElem, XML_RELPATH, NAMESPACE);
                    if (relPath == null) {
                        node.restore(versions[0], removeExisting);
                    } else {
                        node.restore(versions[0], relPath, removeExisting);
                    }
                } else {
                    getRepositorySession().getWorkspace().restore(versions, removeExisting);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.