Package javax.jcr.nodetype

Examples of javax.jcr.nodetype.ConstraintViolationException


      // Validate
      if (session.getWorkspace().getNodeTypesHolder()
         .isNodeType(type.getName(), nodeData().getPrimaryTypeName(), nodeData().getMixinTypeNames()))
      {
         throw new ConstraintViolationException("Can not add mixin type " + mixinName + " to " + getPath());
      }

      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())
      {
View Full Code Here


      {
         throw new PathNotFoundException("Parent not found for " + itemPath.getAsString(true));
      }
      if (!parentItem.isNode())
      {
         throw new ConstraintViolationException("Parent item is not a node " + parentItem.getPath());
      }

      NodeImpl parent = (NodeImpl)parentItem;
      InternalQName name = itemPath.getName().getInternalName();

      // find node type
      NodeDefinitionData nodeDef =
         session.getWorkspace().getNodeTypesHolder()
            .getChildNodeDefinition(name, nodeData().getPrimaryTypeName(), nodeData().getMixinTypeNames());

      if (nodeDef == null)
      {
         throw new ConstraintViolationException("Can not define node type for " + name.getAsString());
      }
      InternalQName primaryTypeName = nodeDef.getName();

      if (nodeDef.getName().equals(name) || primaryTypeName.equals(Constants.JCR_ANY_NAME))
      {
View Full Code Here

      {
         throw new PathNotFoundException("Parent not found for " + itemPath.getAsString(true));
      }
      if (!parentItem.isNode())
      {
         throw new ConstraintViolationException("Parent item is not a node " + parentItem.getPath());
      }
      NodeImpl parent = (NodeImpl)parentItem;

      InternalQName name = itemPath.getName().getInternalName();
      InternalQName ptName = locationFactory.parseJCRName(nodeTypeName).getInternalName();
View Full Code Here

               nodeTypesHolder.getChildNodeDefinition(getInternalName(), parent.getPrimaryTypeName(),
                  parent.getMixinTypeNames());

            if (definition == null)
            {
               throw new ConstraintViolationException("Node definition not found for " + getPath());
            }

            // TODO same functionality in NodeTypeImpl
            InternalQName[] rnames = definition.getRequiredPrimaryTypes();
            NodeType[] rnts = new NodeType[rnames.length];
View Full Code Here

         session.getWorkspace().getNodeTypesHolder()
            .getChildNodeDefinition(getInternalName(), parent.getPrimaryTypeName(), parent.getMixinTypeNames());

      if (definition == null)
      {
         throw new ConstraintViolationException("Node definition not found for " + getPath());
      }
   }
View Full Code Here

            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 "
View Full Code Here

            + sysLocFactory.createJCRName(primaryTypeName).getAsString());
      }

      if (nodeType.isMixin())
      {
         throw new ConstraintViolationException("Add Node failed, "
            + sysLocFactory.createJCRName(primaryTypeName).getAsString() + " is MIXIN type!");
      }

      // Check if new node's node type is allowed by its parent definition

      if (!nodeTypeDataManager.isChildNodePrimaryTypeAllowed(primaryTypeName, nodeData().getPrimaryTypeName(),
         nodeData().getMixinTypeNames()))
      {
         throw new ConstraintViolationException("Can't add node " + sysLocFactory.createJCRName(name).getAsString()
            + " to " + getPath() + " node type " + sysLocFactory.createJCRName(primaryTypeName).getAsString()
            + " is not allowed as child's node type for parent node type ");

      }
      // Check if node is not protected
      NodeDefinitionData childNodeDefinition =
         session.getWorkspace().getNodeTypesHolder()
            .getChildNodeDefinition(name, nodeData().getPrimaryTypeName(), nodeData().getMixinTypeNames());
      if (childNodeDefinition == null)
      {
         throw new ConstraintViolationException("Can't find child node definition for "
            + sysLocFactory.createJCRName(name).getAsString() + " in " + getPath());
      }

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

      // Check if versionable ancestor is not checked-in
      if (!checkedOut())
View Full Code Here

         NodeData parentNodeData = getParent();
         // nodeTypeDataManager.findChildNodeDefinition(primaryTypeName,)
         if (!nodeTypeDataManager.isChildNodePrimaryTypeAllowed(primaryTypeName, parentNodeData.getPrimaryTypeName(),
            parentNodeData.getMixinTypeNames()))
         {
            throw new ConstraintViolationException("Can't add node " + nodeData.getQName().getAsString() + " to "
               + parentNodeData.getQPath().getAsString() + " node type " + sName
               + " is not allowed as child's node type for parent node type "
               + parentNodeData.getPrimaryTypeName().getAsString());
         }
      }
View Full Code Here

            }
            catch (Throwable e)
            {
               log.error("Error of value read: " + e.getMessage(), e);
            }
            throw new ConstraintViolationException("Can not set value '" + strVal + "' to " + getPath()
               + " due to value constraints ");
         }
      }
   }
View Full Code Here

      }

      // Check if node is not protected
      if (node.getDefinition().isProtected())
      {
         throw new ConstraintViolationException("Can't add protected node " + node.getName() + " to "
            + node.getParent().getPath());
      }

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

TOP

Related Classes of javax.jcr.nodetype.ConstraintViolationException

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.