Examples of VersionException


Examples of javax.jcr.version.VersionException

      // when this validation is done.

      // Check if versionable ancestor is not checked-in
      if (!checkedOut())
      {
         throw new VersionException("Node " + getPath() + " or its nearest ancestor is checked-in");
      }

      // Check locking
      if (!checkLocking())
      {
View Full Code Here

Examples of javax.jcr.version.VersionException

      if (session.hasPendingChanges())
         throw new InvalidItemStateException("Session has pending changes ");

      if (((VersionImpl)version).getInternalName().equals(Constants.JCR_ROOTVERSION))
         throw new VersionException("It is illegal to call restore() on jcr:rootVersion");

      if (!versionHistory(false).isVersionBelongToThis(version))
         throw new VersionException("Bad version " + version.getPath());

      // Check locking
      if (!checkLocking())
         throw new LockException("Node " + getPath() + " is locked ");
View Full Code Here

Examples of javax.jcr.version.VersionException

         if (session.hasPendingChanges())
            throw new InvalidItemStateException("Session has pending changes ");

         if (((VersionImpl)version).getInternalName().equals(Constants.JCR_ROOTVERSION))
            throw new VersionException("It is illegal to call restore() on jcr:rootVersion");

         QPath destPath = locationFactory.parseRelPath(relPath).getInternalPath();
         NodeImpl destParent =
            (NodeImpl)dataManager.getItem(nodeData(), destPath.makeParentPath().getEntries(), false, ItemType.NODE);
        
         if (destParent == null)
            throw new PathNotFoundException("Parent not found for " + relPath);

         if (!destParent.isNode())
            throw new ConstraintViolationException("Parent item is not a node. Rel path " + relPath);

         NodeImpl destNode =
            (NodeImpl)dataManager.getItem(destParent.nodeData(),
               new QPathEntry(destPath.getName(), destPath.getIndex()), false, ItemType.NODE);

         if (destNode != null)
         {
            // Dest node exists

            if (!destNode.isNode())
               throw new ConstraintViolationException("Item at relPath is not a node " + destNode.getPath());

            if (!destNode.isNodeType(Constants.MIX_VERSIONABLE))
               throw new UnsupportedRepositoryOperationException("Node at relPath is not versionable "
                  + destNode.getPath());

            if (!destNode.versionHistory(false).isVersionBelongToThis(version))
               throw new VersionException("Bad version " + version.getPath());

            // Check locking
            if (!destNode.parent().checkLocking())
               throw new LockException("Node " + destNode.getPath() + " is locked ");
         }
         else
         {
            // Dest node not found
            if (!destParent.checkedOut())
               throw new VersionException("Parent of a node at relPath is versionable and checked-in "
                  + destParent.getPath());
         }

         ((VersionImpl)version).restore(session, destParent.nodeData(), destPath.getName(), removeExisting);
      }
View Full Code Here

Examples of javax.jcr.version.VersionException

         throw new ConstraintViolationException("Can't add protected node "
            + sysLocFactory.createJCRName(name).getAsString() + " to " + getPath());

      // Check if versionable ancestor is not checked-in
      if (!checkedOut())
         throw new VersionException("Node " + getPath() + " or its nearest ancestor is checked-in");

      if (!checkLocking())
         // Check locking
         throw new LockException("Node " + getPath() + " is locked ");
View Full Code Here

Examples of javax.jcr.version.VersionException

         throw new ItemNotFoundException(getPath() + " has no child node with name " + destPath.getName().getAsString());
      }

      if (!checkedOut())
      {
         throw new VersionException(" cannot change child node ordering of a checked-in node ");
      }

      if (destPath != null && srcPath.getDepth() != destPath.getDepth())
      {
         throw new ItemNotFoundException("Source and destenation is not relative paths of depth one, "
View Full Code Here

Examples of javax.jcr.version.VersionException

                return internalCreateVersionHistory(node, copiedFrom);
            }
        });

        if (state == null) {
            throw new VersionException("History already exists for node " + node.getNodeId());
        }
        Name root = NameConstants.JCR_ROOTVERSION;
        return new VersionHistoryInfo(
                state.getNodeId(),
                state.getState().getChildNodeEntry(root, 1).getId());
View Full Code Here

Examples of javax.jcr.version.VersionException

    public void removeVersion(VersionHistory history, final Name name)
            throws VersionException, RepositoryException {

        final VersionHistoryImpl historyImpl = (VersionHistoryImpl) history;
        if (!historyImpl.hasNode(name)) {
            throw new VersionException("Version with name " + name.toString()
                    + " does not exist in this VersionHistory");
        }

        escFactory.doSourced((SessionImpl) history.getSession(), new SourcedTarget() {
            public Object run() throws RepositoryException {
View Full Code Here

Examples of javax.jcr.version.VersionException

        }

        // TODO: review usage of write-root and object obtained from session-context (OAK-931)
        VersionManager vMgr = sessionContext.getWorkspace().getVersionManager();
        if (!vMgr.isCheckedOut(absPath)) {
            throw new VersionException("Target node is checked in.");
        }
        if (sessionContext.getWorkspace().getLockManager().isLocked(absPath)) {
            throw new LockException("Target node is locked.");
        }
        ntTypesRoot = root.getTree(NODE_TYPES_PATH);
View Full Code Here

Examples of javax.jcr.version.VersionException

     */
    public synchronized InternalVersion getVersion(Name versionName)
            throws VersionException {
        NodeId versionId = nameCache.get(versionName);
        if (versionId == null) {
            throw new VersionException("Version " + versionName + " does not exist.");
        }

        InternalVersion v = versionCache.get(versionId);
        if (v == null) {
            v = createVersionInstance(versionName);
View Full Code Here

Examples of javax.jcr.version.VersionException

        InternalVersionImpl v = (InternalVersionImpl) getVersion(versionName);
        if (v.equals(rootVersion)) {
            String msg = "Removal of " + versionName + " not allowed.";
            log.debug(msg);
            throw new VersionException(msg);
        }
        // check if any references (from outside the version storage) exist on this version
        if (vMgr.hasItemReferences(v.getId())) {
            throw new ReferentialIntegrityException("Unable to remove version. At least once referenced.");
        }
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.