Package javax.jcr.version

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


         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

         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

         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

      if (definition.isProtected())
         throw new ConstraintViolationException("Can not add mixin type. Node is protected " + getPath());

      // 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())
         throw new LockException("Node " + getPath() + " is locked ");
View Full Code Here

      if (session.getTransientNodesManager().hasPendingChanges(getInternalPath()))
         throw new InvalidItemStateException("Node has pending changes " + getPath());

      if (hasProperty(Constants.JCR_MERGEFAILED))
         throw new VersionException("Node has jcr:mergeFailed " + getPath());

      if (!checkLocking())
         throw new LockException("Node " + getPath() + " is locked ");

      // the new version identifier
View Full Code Here

      // 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

      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

         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

         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

TOP

Related Classes of javax.jcr.version.VersionException

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.