Package javax.jcr.version

Examples of javax.jcr.version.VersionException


            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


      }

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

      VersionImpl version =
         (VersionImpl)dataManager
            .getItem(nodeData(), new QPathEntry(Constants.JCR_ROOTVERSION, 0), true, ItemType.NODE);
      if (version == null)
      {
         throw new VersionException("There are no root version in the version history " + getPath());
      }

      return version;
   }
View Full Code Here

      VersionImpl version =
         (VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(jcrVersionName.getInternalName(), 1), pool,
            ItemType.NODE);
      if (version == null)
      {
         throw new VersionException("There are no version with name '" + versionName + "' in the version history "
            + getPath());
      }

      return version;
   }
View Full Code Here

      VersionImpl version = (VersionImpl)dataManager.getItemByIdentifier(versionData.getIdentifier(), true);

      if (version == null)
      {
         throw new VersionException("There are no version with label '" + label + "' in the version history "
            + getPath());
      }

      return version;
View Full Code Here

   protected List<String> getVersionLabelsList(Version version) throws VersionException, RepositoryException
   {
      if (!isVersionBelongToThis(version))
      {
         throw new VersionException("There are no version '" + version.getPath() + "' in the version history "
            + getPath());
      }

      List<PropertyData> labelsList = getData().getVersionLabels();
      List<String> vlabels = new ArrayList<String>();
View Full Code Here

      NodeData version = getData().getVersionData(jcrPath.getName().getInternalName());

      if (version == null)
      {
         throw new VersionException("Version is not found " + jcrPath.getAsString(false));
      }

      return version;
   }
View Full Code Here

   protected NodeData getVersionLabelsData() throws VersionException, RepositoryException
   {
      NodeData labels = getData().getVersionLabelsData();
      if (labels == null)
      {
         throw new VersionException("Mandatory node jcr:versionLabels is not found for version history " + getPath());
      }

      return labels;
   }
View Full Code Here

   protected NodeData getVersionDataByIdentifier(String versionIdentifier) throws VersionException, RepositoryException
   {
      NodeData version = (NodeData)dataManager.getItemData(versionIdentifier);
      if (version == null)
      {
         throw new VersionException("Version is not found, uuid: " + versionIdentifier);
      }

      return version;
   }
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.