Package javax.jcr.version

Examples of javax.jcr.version.VersionIterator.nextVersion()


        // get the version names again
        iter = versionManager.getVersionHistory(versionableNode.getPath()).getAllLinearVersions();
        StringBuffer actual = new StringBuffer();
        while (iter.hasNext()) {
            actual.append(iter.nextVersion().getName()).append(",");
        }
        assertEquals("Node.restore() on simple versioning must create a new version.",
                expected.toString(), actual.toString());
    }
View Full Code Here


    public void testLinearVersionsJcr2_4() throws Exception {
        // first get all linear versions
        VersionIterator iter = versionManager.getVersionHistory(versionableNode.getPath()).getAllLinearVersions();
        StringBuffer expected = new StringBuffer();
        while (iter.hasNext()) {
            expected.append(iter.nextVersion().getName()).append(",");
        }
        // restore version
        versionManager.restore(new Version[] {version}, true);
        // append new base version
        expected.append(versionManager.getBaseVersion(versionableNode.getPath()).getName()).append(",");
View Full Code Here

        // get the version names again
        iter = versionManager.getVersionHistory(versionableNode.getPath()).getAllLinearVersions();
        StringBuffer actual = new StringBuffer();
        while (iter.hasNext()) {
            actual.append(iter.nextVersion().getName()).append(",");
        }
        assertEquals("Node.restore() on simple versioning must create a new version.",
                expected.toString(), actual.toString());
    }
}
View Full Code Here

    public VersionResource[] getVersions() throws DavException {
        try {
            VersionIterator vIter = ((VersionHistory)item).getAllVersions();
            ArrayList<VersionResource> l = new ArrayList<VersionResource>();
            while (vIter.hasNext()) {
                DavResourceLocator versionLoc = getLocatorFromItem(vIter.nextVersion());
                VersionResource vr = (VersionResource) createResourceFromLocator(versionLoc);
                l.add(vr);
            }
            return l.toArray(new VersionResource[l.size()]);
        } catch (RepositoryException e) {
View Full Code Here

    public void testRemoveAllBut2() throws RepositoryException {
        String baseVersion = versionableNode.getBaseVersion().getName();
        VersionHistory vh = versionableNode.getVersionHistory();
        VersionIterator vi = vh.getAllVersions();
        while (vi.hasNext()) {
            Version currenVersion = vi.nextVersion();
            String versionName = currenVersion.getName();
            if (!versionName.equals("jcr:rootVersion") && !versionName.equals(baseVersion)) {
                vh.removeVersion(versionName);
            }
        }
View Full Code Here

            versionableNode.checkout();
        }

        VersionIterator it = vHistory.getAllVersions();
        while (it.hasNext()) {
            v = it.nextVersion();
            if (!versions.containsKey(v.getUUID())) {
                fail("VersionHistory.getAllVersions() must only contain the root version and versions, that have been created by a Node.checkin() call.");
            }
            versions.remove(v.getUUID());
        }
View Full Code Here

            versionManager.checkout(versionableNode.getPath());
        }

        VersionIterator it = vHistory.getAllVersions();
        while (it.hasNext()) {
            v = it.nextVersion();
            if (!versions.containsKey(v.getIdentifier())) {
                fail("VersionHistory.getAllVersions() must only contain the root version and versions, that have been created by a Node.checkin() call.");
            }
            versions.remove(v.getIdentifier());
            // check order of linear version history (see JCR 2.0, 15.1.1.2)
View Full Code Here

                public boolean hasNext() {
                    return versions.hasNext();
                }

                public JcrVersion next() {
                    return new JcrVersion(getNode(), versions.nextVersion(), typeManager, pathManager, nodeFactory);
                }

                public void remove() {
                    throw new UnsupportedOperationException();
                }
View Full Code Here

        // get the names of the versions
        List<String> names = new LinkedList<String>();
        VersionIterator vit = vh.getAllVersions();
        while (vit.hasNext()) {
            Version v = vit.nextVersion();
            if (!v.getName().equals("jcr:rootVersion")) {
                names.add(v.getName());
            }
        }
        assertEquals("Number of versions", 3, names.size());
View Full Code Here

                // node is an internal structure.
                VersionIterator it = ((VersionHistory) getNode()).getAllVersions();
                while (it.hasNext()) {
                    // omit item filter here. if the version history is visible
                    // its versions should be visible as well.
                    Version v = it.nextVersion();
                    DavResourceLocator vhLocator = getLocator();
                    DavResourceLocator resourceLocator = vhLocator.getFactory().createResourceLocator(vhLocator.getPrefix(), vhLocator.getWorkspacePath(), v.getPath(), false);
                    DavResource childRes = getFactory().createResource(resourceLocator, getSession());
                    list.add(childRes);
                }
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.