protected Node createNode ( final Node parentNode , final String nodeName , final String nodeType , final List < String > mixinTypes , final Map < String , String [ ] > permissions , final boolean isLeaf , final boolean callSave ) throws RepositoryException { boolean useParameters = ! useParametersOnLeafOnly ( ) || ( useParametersOnLeafOnly ( ) && isLeaf ) ; Node node ; if ( nodeType == null || nodeType . isEmpty ( ) || ! useParameters ) { node = parentNode . addNode ( nodeName , DEFAULT_NODE_TYPE ) ; } else { node = parentNode . addNode ( nodeName , nodeType ) ; } if ( node . getIndex ( ) > 1 ) { // The node has already been created by a concurrent session parentNode . refresh ( false ) ; return parentNode . getNode ( nodeName ) ; } if ( useParameters ) { if ( permissions != null && ! permissions . isEmpty ( ) ) { if ( node . canAddMixin ( "exo:privilegeable" ) ) { node . addMixin ( "exo:privilegeable" ) ; } ( ( ExtendedNode ) node ) . setPermissions ( permissions ) ; } if ( mixinTypes != null ) { for ( int i = 0 , length = mixinTypes . size ( ) ; i < length ; i ++ ) { String mixin = mixinTypes . get ( i ) ; if ( node . canAddMixin ( mixin ) ) { node . addMixin ( mixin ) ; } } } } if ( callSave ) { try { parentNode . save ( ) ; } catch ( ItemExistsException e ) { if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "An exception occurred: " + e . getMessage ( ) ) ; } parentNode . refresh ( false ) ; // Need to check until the concurrent tx that caused this ItemExistsException is fully committed while ( ! parentNode . hasNode ( nodeName ) ) ; return parentNode . getNode ( nodeName ) ; } } return node ; }
Creates the node of the given node type with the given node name directly under the given parent node using the given mixin types and permissions