private void printNodeTypeDeclaration ( NodeTypeData nodeTypeData , OutputStreamWriter out ) throws RepositoryException , IOException { /** Print name */ out . write ( "[" + qNameToString ( nodeTypeData . getName ( ) ) + "] " ) ; /** Print supertypes */ InternalQName [ ] superTypes = nodeTypeData . getDeclaredSupertypeNames ( ) ; if ( superTypes != null && superTypes . length > 0 ) { /** if there is only 1 element and it is NT_BASE then avoid printing it */ if ( superTypes . length > 1 || ! superTypes [ 0 ] . equals ( Constants . NT_BASE ) ) { out . write ( "> " + qNameToString ( superTypes [ 0 ] ) ) ; for ( int i = 1 ; i < superTypes . length ; i ++ ) { out . write ( ", " + qNameToString ( superTypes [ i ] ) ) ; } } } /** Print attributes */ StringBuilder attributes = new StringBuilder ( ) ; // if (nodeTypeData.isAbstract()) // { // attributes += "abstract "; // } if ( nodeTypeData . hasOrderableChildNodes ( ) ) { attributes . append ( "orderable " ) ; } if ( nodeTypeData . isMixin ( ) ) { attributes . append ( "mixin " ) ; } // if (!nodeTypeData.isQueryable()) // { // attributes += "noquery "; // } if ( nodeTypeData . getPrimaryItemName ( ) != null ) { attributes . append ( "primaryitem " + qNameToString ( nodeTypeData . getPrimaryItemName ( ) ) ) ; } if ( attributes . length ( ) > 0 ) { out . write ( "\r\n " ) ; out . write ( attributes . toString ( ) ) ; } /** Print all property definitions */ PropertyDefinitionData [ ] propertyDefinitions = nodeTypeData . getDeclaredPropertyDefinitions ( ) ; if ( propertyDefinitions != null ) { for ( PropertyDefinitionData propertyDefinition : propertyDefinitions ) { printPropertyDeclaration ( propertyDefinition , out ) ; } } /** Print all child definitions */ NodeDefinitionData [ ] nodeDefinitions = nodeTypeData . getDeclaredChildNodeDefinitions ( ) ; if ( nodeDefinitions != null ) { for ( NodeDefinitionData nodeDefinition : nodeDefinitions ) { printChildDeclaration ( nodeDefinition , out ) ; } } out . write ( "\r\n" ) ; }
Method recursively print to output stream node type definition in cnd format .