org.modeshape.jcr

## Interface NodeTypes.NodeDefinitionSet

- Enclosing class:
    NodeTypes

      public static interface NodeTypes.NodeDefinitionSet

  A set of child node definitions under a parent with a specific primary type and optional mixin types.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `determineReasonForMismatch(Name childName, Name childPrimaryType, boolean skipProtected, SiblingCounter siblingCounter, Name parentPrimaryType, Set<Name> parentMixinTypes, Path parentPath, String workspaceName, String repositoryName, ExecutionContext context)` Method that can be called after `findBestDefinitionForChild(Name, Name, boolean, SiblingCounter)` returns null to throw an appropriate exception for why each of the parent's child node definition are not applicable for the proposed child.
    `org.modeshape.jcr.JcrNodeDefinition` | `findBestDefinitionForChild(Name childName, Name childPrimaryType, boolean skipProtected, SiblingCounter siblingCounter)` Find the best child node definition for creating a new child with the given name and primary type.

- - ### Method Detail

    - #### findBestDefinitionForChild

          org.modeshape.jcr.JcrNodeDefinition findBestDefinitionForChild(Name childName,
                                                                       Name childPrimaryType,
                                                                       boolean skipProtected,
                                                                       SiblingCounter siblingCounter)

      Find the best child node definition for creating a new child with the given name and primary type. If none of the parent's child node definitions allow a child with the given name and type, then null is returned and the caller can call `determineReasonForMismatch(org.modeshape.jcr.value.Name, org.modeshape.jcr.value.Name, boolean, org.modeshape.jcr.cache.SiblingCounter, org.modeshape.jcr.value.Name, java.util.Set<org.modeshape.jcr.value.Name>, org.modeshape.jcr.value.Path, java.lang.String, java.lang.String, org.modeshape.jcr.ExecutionContext)` for an appropriate exception.
      Parameters:
        `childName` - the name of the proposed child; may be null if the child name is to be determined by the definition
        `childPrimaryType` - the primary type of the proposed child; may be null if the default type is to be used
        `skipProtected` - true if this method should not consider any of the parent's child node definitions that are protected, or false if it should consider all child node definitions
        `siblingCounter` - a function that this method can call to determine how many siblings with the child's name already exist under the parent
      Returns:
        the child node definition for the child, or null if one could not be found

    - #### determineReasonForMismatch

          void determineReasonForMismatch(Name childName,
                                        Name childPrimaryType,
                                        boolean skipProtected,
                                        SiblingCounter siblingCounter,
                                        Name parentPrimaryType,
                                        Set<Name> parentMixinTypes,
                                        Path parentPath,
                                        String workspaceName,
                                        String repositoryName,
                                        ExecutionContext context)
                                          throws ConstraintViolationException,
                                                 ItemExistsException

      Method that can be called after `findBestDefinitionForChild(Name, Name, boolean, SiblingCounter)` returns null to throw an appropriate exception for why each of the parent's child node definition are not applicable for the proposed child.
      Parameters:
        `childName` - the name of the proposed child; may be null if the child name is to be determined by the definition
        `childPrimaryType` - the primary type of the proposed child; may be null if the default type is to be used
        `skipProtected` - true if this method should not consider any of the parent's child node definitions that are protected, or false if it should consider all child node definitions
        `siblingCounter` - a function that this method can call to determine how many siblings with the child's name already exist under the parent
        `parentPrimaryType` - the primary type of the parent node; may not be null
        `parentMixinTypes` - the mixin types of the parent node
        `parentPath` -
        `workspaceName` -
        `repositoryName` -
        `context` -
      Throws:
        `ConstraintViolationException`
        `ItemExistsException`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.