code: private void initDefinition(NodeData parent) throws RepositoryException, ConstraintViolationException
     {
        if (this.isRoot())
        {
           // root - no parent
           this.definition =
              new NodeDefinitionData(null, null, true, true, OnParentVersionAction.ABORT, true,
                 new InternalQName[]{Constants.NT_BASE}, null, false);
           return;
        }
  
        if (parent == null)
        {
           parent = (NodeData)dataManager.getItemData(getParentIdentifier());
        }
  
        this.definition =
           session.getWorkspace().getNodeTypesHolder().getChildNodeDefinition(getInternalName(),
              nodeData().getPrimaryTypeName(), parent.getPrimaryTypeName(), parent.getMixinTypeNames());
  
        if (definition == null)
        {
           throw new ConstraintViolationException("Node definition not found for " + getPath());
        }
     }
docs: Init NodeDefinition.
  
  @param parent NodeData
  @throws RepositoryException
  if error occurs
  @throws ConstraintViolationException
  if definition not found