Examples of VersionIterator


Examples of javax.jcr.version.VersionIterator

                    } catch (RepositoryException e) {
                        log.error("Error while restoring node: " + e);
                        log.error("  child path: " + restoredChild);
                        log.error("  selected version: " + v.getName());
                        StringBuffer avail = new StringBuffer();
                        VersionIterator vi = history.getAllVersions();
                        while (vi.hasNext()) {
                            avail.append(vi.nextVersion().getName());
                            if (vi.hasNext()) {
                                avail.append(", ");
                            }
                        }
                        log.error("  available versions: " + avail);
                        log.error("  versionselector: " + vsel);
View Full Code Here

Examples of javax.jcr.version.VersionIterator

     * See CMIS 1.0 section 2.2.7.6 getAllVersions
     */
    public Iterator<JcrVersion> getVersions() {
        try {
            VersionHistory versionHistory = getVersionHistory(getNode());
            final VersionIterator versions = versionHistory.getAllLinearVersions();

            return new Iterator<JcrVersion>() {
                public boolean hasNext() {
                    return versions.hasNext();
                }

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

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

Examples of javax.jcr.version.VersionIterator

                    } catch (RepositoryException e) {
                        log.error("Error while restoring node: " + e);
                        log.error("  child path: " + restoredChild);
                        log.error("  selected version: " + v.getName());
                        StringBuffer avail = new StringBuffer();
                        VersionIterator vi = history.getAllVersions();
                        while (vi.hasNext()) {
                            avail.append(vi.nextVersion().getName());
                            if (vi.hasNext()) {
                                avail.append(", ");
                            }
                        }
                        log.error("  available versions: " + avail);
                        log.error("  versionselector: " + vsel);
View Full Code Here

Examples of javax.jcr.version.VersionIterator

            v = versionableNode.checkin();
            versions.put(v.getUUID(), v);
            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

Examples of javax.jcr.version.VersionIterator

            v = versionManager.checkin(versionableNode.getPath());
            versions.put(v.getIdentifier(), v);
            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());
        }
View Full Code Here

Examples of javax.jcr.version.VersionIterator

                    } catch (RepositoryException e) {
                        log.error("Error while restoring node: " + e.toString());
                        log.error("  child path: " + restoredChild.safeGetJCRPath());
                        log.error("  selected version: " + v.getName());
                        StringBuffer avail = new StringBuffer();
                        VersionIterator vi = history.getAllVersions();
                        while (vi.hasNext()) {
                            avail.append(vi.nextVersion().getName());
                            if (vi.hasNext()) {
                                avail.append(", ");
                            }
                        }
                        log.error("  available versions: " + avail);
                        log.error("  versionselector: " + vsel);
View Full Code Here

Examples of javax.jcr.version.VersionIterator

                    } catch (RepositoryException e) {
                        log.error("Error while restoring node: " + e.toString());
                        log.error("  child path: " + restoredChild.safeGetJCRPath());
                        log.error("  selected version: " + v.getName());
                        StringBuffer avail = new StringBuffer();
                        VersionIterator vi = history.getAllVersions();
                        while (vi.hasNext()) {
                            avail.append(vi.nextVersion().getName());
                            if (vi.hasNext()) {
                                avail.append(", ");
                            }
                        }
                        log.error("  available versions: " + avail);
                        log.error("  versionselector: " + vsel);
View Full Code Here

Examples of javax.jcr.version.VersionIterator

    public static Version selectByDate(VersionHistory history, Calendar date)
            throws RepositoryException {
        long time = (date != null) ? date.getTimeInMillis() : Long.MAX_VALUE;
        long latestDate = Long.MIN_VALUE;
        Version latestVersion = null;
        VersionIterator iter = history.getAllVersions();
        while (iter.hasNext()) {
            Version v = iter.nextVersion();
            long c = v.getCreated().getTimeInMillis();
            if (c > latestDate && c <= time) {
                latestDate = c;
                latestVersion = v;
            }
View Full Code Here

Examples of javax.jcr.version.VersionIterator

     * @see javax.jcr.version.VersionHistory#getRootVersion()
     */
    public void testInitallyGetAllVersionsContainsTheRootVersion() throws RepositoryException {
        Version rootVersion = vHistory.getRootVersion();
        Version v = null;
        VersionIterator it = vHistory.getAllVersions();
        while (it.hasNext()) {
            // break after the first version, that MUST be the root version
            v = it.nextVersion();
            break;
        }
        assertEquals("The version that is autocreated on version history creation must be the root version", rootVersion, v);
    }
View Full Code Here

Examples of javax.jcr.version.VersionIterator

        for (int i = 0; i < cnt; i++) {
            versions.add(versionableNode.checkin());
            versionableNode.checkout();
        }

        VersionIterator it = vHistory.getAllVersions();
        while (it.hasNext()) {
            Version v = it.nextVersion();
            if (!versions.contains(v)) {
                fail("VersionHistory.getAllVersions() must only contain the root version and versions, that have been created by a Node.checkin() call.");
            }
            versions.remove(v);
        }
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.