Package javax.jcr.version

Examples of javax.jcr.version.Version


     * {@inheritDoc}
     */
    public NodeId checkin(final SessionInfo sessionInfo, final NodeId nodeId)
            throws VersionException, UnsupportedRepositoryOperationException, InvalidItemStateException, LockException, RepositoryException {
        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        Version newVersion = (Version) executeWithLocalEvents(new Callable() {
            public Object run() throws RepositoryException {
                return getNode(nodeId, getSessionInfoImpl(sessionInfo)).checkin();
            }
        }, sInfo);
        return idFactory.createNodeId(newVersion);
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public NodeId checkpoint(SessionInfo sessionInfo, final NodeId nodeId) throws UnsupportedRepositoryOperationException, RepositoryException {
        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        Version newVersion = (Version) executeWithLocalEvents(new Callable() {
            public Object run() throws RepositoryException {
                VersionManager vMgr = sInfo.getSession().getWorkspace().getVersionManager();
                return vMgr.checkpoint(getNodePath(nodeId, sInfo));
            }
        }, sInfo);
View Full Code Here

        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        Node activity = (activityId == null) ? null : getNode(activityId, sInfo);
        VersionManager vMgr = sInfo.getSession().getWorkspace().getVersionManager();
        vMgr.setActivity(activity);
        try {
            Version newVersion = (Version) executeWithLocalEvents(new Callable() {
                public Object run() throws RepositoryException {
                    VersionManager vMgr = sInfo.getSession().getWorkspace().getVersionManager();
                    return vMgr.checkpoint(getNodePath(nodeId, sInfo));
                }
            }, sInfo);
View Full Code Here

                        final NodeId versionId,
                        final boolean removeExisting) throws VersionException, PathNotFoundException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        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
View Full Code Here

            throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException {
        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        executeWithLocalEvents(new Callable() {
            public Object run() throws RepositoryException {
                Node node = getNode(nodeId, sInfo);
                Version version = null;
                boolean cancel;
                NamePathResolver resolver = sInfo.getNamePathResolver();
                List<NodeId> l = Arrays.asList(mergeFailedIds);
                Property mergeFailed = node.getProperty(resolver.getJCRName(NameConstants.JCR_MERGEFAILED));
                for (Value value : mergeFailed.getValues()) {
View Full Code Here

             */
            VersionHistory history = versionManager.getVersionHistory(session, node);
            if (history == null) {
                history = versionManager.createVersionHistory(session, node);
            }
            Version rootVersion = history.getRootVersion();

            // jcr:versionHistory
            conditionalAddProperty(
                    node, QName.JCR_VERSIONHISTORY, PropertyType.REFERENCE, false,
                    InternalValue.create(new UUID(history.getUUID())));

            // jcr:baseVersion
            conditionalAddProperty(
                    node, QName.JCR_BASEVERSION, PropertyType.REFERENCE, false,
                    InternalValue.create(new UUID(rootVersion.getUUID())));

            // jcr:predecessors
            conditionalAddProperty(
                    node, QName.JCR_PREDECESSORS, PropertyType.REFERENCE, true,
                    InternalValue.create(new UUID(rootVersion.getUUID())));

            // jcr:isCheckedOut
            conditionalAddProperty(
                    node, QName.JCR_ISCHECKEDOUT, PropertyType.BOOLEAN, false,
                    InternalValue.create(true));
View Full Code Here

        }

        // check lock status
        checkLock();

        Version v = session.getVersionManager().checkin(this);
        Property prop = internalSetProperty(QName.JCR_ISCHECKEDOUT, InternalValue.create(false));
        prop.save();
        prop = internalSetProperty(QName.JCR_BASEVERSION, InternalValue.create(new UUID(v.getUUID())));
        prop.save();
        prop = internalSetProperty(QName.JCR_PREDECESSORS, InternalValue.EMPTY_ARRAY, PropertyType.REFERENCE);
        prop.save();
        return v;
    }
View Full Code Here

        // checks
        sanityCheck();
        checkSessionHasPending();
        checkLock();

        Version v = getVersionHistory().getVersion(versionName);
        DateVersionSelector gvs = new DateVersionSelector(v.getCreated());
        internalRestore(v, gvs, removeExisting);
        // session.save/revert is done in internal restore
    }
View Full Code Here

        // do checks
        sanityCheck();
        checkSessionHasPending();
        checkLock();

        Version v = getVersionHistory().getVersionByLabel(versionLabel);
        if (v == null) {
            throw new VersionException("No version for label " + versionLabel + " found.");
        }
        internalRestore(v, new LabelVersionSelector(versionLabel), removeExisting);
        // session.save/revert is done in internal restore
View Full Code Here

        final Session session = mock(Session.class);
        final Workspace wk =  mock(Workspace.class);
        final VersionManager vm =  mock(VersionManager.class);
        final VersionHistory vh =  mock(VersionHistory.class);
        final VersionIterator vi =  mock(VersionIterator.class);
        final Version v = mock(Version.class);
        final Version v1 = mock(Version.class);
        when(v.getCreated()).thenReturn(cal);
        when(v1.getCreated()).thenReturn(cal1);
        when(v.getName()).thenReturn("version1");
        when(vi.nextVersion()).thenReturn(v, v1);
        when(vi.hasNext()).thenReturn(true, true, false);
        when(session.getWorkspace()).thenReturn(wk);
        when(wk.getVersionManager()).thenReturn(vm);
View Full Code Here

TOP

Related Classes of javax.jcr.version.Version

Copyright © 2018 www.massapicom. 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.