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();