Examples of VersionHistory


Examples of javax.jcr.version.VersionHistory

        }
        if (!isVersionControlled()) {
            throw new DavException(DavServletResponse.SC_FORBIDDEN);
        }
        try {
            VersionHistory vh = getNode().getVersionHistory();
            DavResourceLocator loc = getLocatorFromNode(vh);
            DavResource vhr =  createResourceFromLocator(loc);
            if (vhr instanceof VersionHistoryResource) {
                return (VersionHistoryResource)vhr;
            } else {
View Full Code Here

Examples of javax.jcr.version.VersionHistory

                     * copied properties declared by mix:versionable need to be
                     * adjusted accordingly.
                     */
                    if (propName.equals(QName.JCR_VERSIONHISTORY)) {
                        // jcr:versionHistory
                        VersionHistory vh = getOrCreateVersionHistory(newState);
                        newChildState.setValues(new InternalValue[]{InternalValue.create(new UUID(vh.getUUID()))});
                    } else if (propName.equals(QName.JCR_BASEVERSION)) {
                        // jcr:baseVersion
                        VersionHistory vh = getOrCreateVersionHistory(newState);
                        newChildState.setValues(new InternalValue[]{InternalValue.create(new UUID(vh.getRootVersion().getUUID()))});
                    } else if (propName.equals(QName.JCR_PREDECESSORS)) {
                        // jcr:predecessors
                        VersionHistory vh = getOrCreateVersionHistory(newState);
                        newChildState.setValues(new InternalValue[]{InternalValue.create(new UUID(vh.getRootVersion().getUUID()))});
                    } else if (propName.equals(QName.JCR_ISCHECKEDOUT)) {
                        // jcr:isCheckedOut
                        newChildState.setValues(new InternalValue[]{InternalValue.create(true)});
                    }
                }
View Full Code Here

Examples of javax.jcr.version.VersionHistory

     * @throws RepositoryException if an error occurs
     */
    private VersionHistory getOrCreateVersionHistory(NodeState node)
            throws RepositoryException {
        VersionManager vMgr = session.getVersionManager();
        VersionHistory vh = vMgr.getVersionHistory(session, node);
        if (vh == null) {
            // create a new version history
            vh = vMgr.createVersionHistory(session, node);
        }
        return vh;
View Full Code Here

Examples of javax.jcr.version.VersionHistory

            EventListener el = new EListener(updateInfo.getPropertyNameSet(), ms);
            registerEventListener(el, node.getPath());

            // perform the update/restore according to the update info
            if (updateInfo.getVersionHref() != null) {
                VersionHistory vh = node.getVersionHistory();
                String[] hrefs = updateInfo.getVersionHref();
                Version[] versions = new Version[hrefs.length];
                for (int  i = 0; i < hrefs.length; i++) {
                    String itemPath = getLocatorFromHref(hrefs[i]).getRepositoryPath();
                    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);
                }
            } else if (updateInfo.getLabelName() != null) {
                String[] labels = updateInfo.getLabelName();
                if (labels.length == 1) {
                    node.restoreByLabel(labels[0], removeExisting);
                } else {
                    Version[] vs = new Version[labels.length];
                    VersionHistory vh = node.getVersionHistory();
                    for (int  i = 0; i < labels.length; i++) {
                        vs[i] = vh.getVersionByLabel(labels[i]);
                    }
                    getRepositorySession().getWorkspace().restore(vs, removeExisting);
                }
            } else if (updateInfo.getWorkspaceHref() != null) {
                String workspaceName = getLocatorFromHref(updateInfo.getWorkspaceHref()).getWorkspaceName();
View Full Code Here

Examples of javax.jcr.version.VersionHistory

        if (!exists()) {
            throw new DavException(DavServletResponse.SC_NOT_FOUND);
        }

        try {
            VersionHistory vh = ((Node)item).getVersionHistory();
            DavResourceLocator loc = getLocatorFromItem(vh);
            return (VersionHistoryResource) createResourceFromLocator(loc);
        } catch (RepositoryException e) {
            throw new JcrDavException(e);
        }
View Full Code Here

Examples of javax.jcr.version.VersionHistory

        if (!exists()) {
            throw new DavException(DavServletResponse.SC_NOT_FOUND);
        }

        try {
            VersionHistory vh = ((Node)item).getVersionHistory();
            DavResourceLocator loc = getLocatorFromItem(vh);
            return (VersionHistoryResource) createResourceFromLocator(loc);
        } catch (RepositoryException e) {
            throw new JcrDavException(e);
        }
View Full Code Here

Examples of javax.jcr.version.VersionHistory

         Version version = (Version)dataManager.getItemByIdentifier(versionUUID, false);
         versionName = new StringBuilder(version.getName());

         if (!dataManager.isNew(version.getParent().getUUID()))
         {
            VersionHistory versionHistory =
               (VersionHistory)dataManager.getItemByIdentifier(version.getParent().getUUID(), false);
            String[] labels = versionHistory.getVersionLabels(version);
            for (int i = 0; i < labels.length; i++)
            {
               String vl = labels[i];
               if (i == 0)
               {
View Full Code Here

Examples of javax.jcr.version.VersionHistory

        prepareTests(VersionHistory.class);
        ignoreMethod("getVersionLabels"); // UUID call
        ignoreMethod("hasVersionLabel")// UUID call
        ignoreMethod("getAllVersions");   // null iterator

        VersionHistory history = (VersionHistory) mock;
        RemoteVersionHistory remote =
            remoteFactory.getRemoteVersionHistory(history);
        VersionHistory local = localFactory.getVersionHistory(null, remote);

        runTests(local);
    }
View Full Code Here

Examples of javax.jcr.version.VersionHistory

    @Override
    public void restore(final String absPath,
                        final String versionName,
                        final boolean removeExisting)
            throws RepositoryException {
        VersionHistory history = getVersionHistory(absPath);
        restore(new Version[]{history.getVersion(versionName)}, removeExisting);
    }
View Full Code Here

Examples of javax.jcr.version.VersionHistory

        if (versions.length > 1) {
            // TODO: implement restore of multiple versions
            TODO.unimplemented().doNothing(); // TODO: RETURN
        }
        final Version version = versions[0];
        VersionHistory history = (VersionHistory) version.getParent();
        final String versionableId = history.getVersionableIdentifier();
        if (history.getRootVersion().isSame(version)) {
            throw new VersionException("Restore of root version not possible");
        }
        final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
        sessionDelegate.perform(new SessionOperation<Void>() {
            @Override
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.