Package javax.jcr.nodetype

Examples of javax.jcr.nodetype.ConstraintViolationException


      NodeData parent = (NodeData)dataManager.getItemData(node.getParentIdentifier());
      NodeDefinitionData ndef =
         ntManager.getChildNodeDefinition(qname, parent.getPrimaryTypeName(), parent.getMixinTypeNames());
      if (ndef == null)
      {
         throw new ConstraintViolationException("Definition not found for " + qname.getAsString());
      }
      int action = ndef.getOnParentVersion();

      if (log.isDebugEnabled())
         log.debug("Entering node " + node.getQPath().getAsString() + ", "
View Full Code Here


               validateMandatoryItem(itemState);
            }

            if (path.isDescendantOf(itemState.getAncestorToSave()))
            {
               throw new ConstraintViolationException(path.getAsString()
                  + " is the same or descendant of either Session.move()'s destination or source node only "
                  + path.getAsString());
            }
         }
      }
View Full Code Here

            .getManadatoryItemDefs(nData.getPrimaryTypeName(), nData.getMixinTypeNames());
      for (ItemDefinitionData itemDefinitionData : mandatoryItemDefs)
      {
         if (getItemData(nData, new QPathEntry(itemDefinitionData.getName(), 0), ItemType.UNKNOWN) == null)
         {
            throw new ConstraintViolationException("Mandatory item " + itemDefinitionData.getName()
               + " not found. Node [" + nData.getQPath().getAsString() + " primary type: "
               + nData.getPrimaryTypeName().getAsString() + "]");
         }

      }
View Full Code Here

         throw new NoSuchNodeTypeException("Nodetype " + mixinName + " not found or not mixin type.");

      // 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())
         throw new VersionException("Node " + getPath() + " or its nearest ancestor is checked-in");
View Full Code Here

            ItemType.UNKNOWN);

      if (parentItem == null)
         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))

         primaryTypeName = nodeDef.getDefaultPrimaryType();
View Full Code Here

            ItemType.UNKNOWN);

      if (parentItem == null)
         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

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

      if (nodeType == null)
         throw new NoSuchNodeTypeException("Nodetype not found "
            + 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())
         throw new VersionException("Node " + getPath() + " or its nearest ancestor is checked-in");
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.