[dna-commits] DNA SVN: r973 - trunk/dna-jcr/src/main/java/org/jboss/dna/jcr.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Thu Jun 4 15:16:36 EDT 2009


Author: rhauch
Date: 2009-06-04 15:16:36 -0400 (Thu, 04 Jun 2009)
New Revision: 973

Modified:
   trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java
Log:
DNA-442 Small change to allow node types to be registered in any order (within the batch)

Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java	2009-06-04 18:13:03 UTC (rev 972)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java	2009-06-04 19:16:36 UTC (rev 973)
@@ -1413,10 +1413,21 @@
 
                 List<JcrNodeDefinition> nodeDefs = new ArrayList<JcrNodeDefinition>(
                                                                                     nodeType.getDeclaredChildNodeDefinitions().length);
+                for (JcrNodeDefinition nodeDef : nodeType.getDeclaredChildNodeDefinitions()) {
+                    nodeDefs.add(nodeDef.with(this.context).with(this));
+                }
 
+                // Create a new node type that also has the correct property and child node definitions associated
+                JcrNodeType newNodeType = new JcrNodeType(this.context, this, nodeType.getInternalName(), supertypes,
+                                                          nodeType.getInternalPrimaryItemName(), nodeDefs, propertyDefs,
+                                                          nodeType.isMixin(), nodeType.hasOrderableChildNodes());
+                typesPendingRegistration.add(newNodeType);
+            }
+
+            // Make sure the nodes have primary types that are either already registered, or pending registration ...
+            for (JcrNodeType nodeType : typesPendingRegistration) {
                 for (JcrNodeDefinition nodeDef : nodeType.getDeclaredChildNodeDefinitions()) {
                     JcrNodeType[] requiredPrimaryTypes = new JcrNodeType[nodeDef.requiredPrimaryTypeNames().length];
-
                     int i = 0;
                     for (Name primaryTypeName : nodeDef.requiredPrimaryTypeNames()) {
                         requiredPrimaryTypes[i] = findTypeInMapOrList(primaryTypeName, typesPendingRegistration);
@@ -1427,15 +1438,7 @@
                         }
                         i++;
                     }
-
-                    nodeDefs.add(nodeDef.with(this.context).with(this));
                 }
-
-                // Create a new node type that also has the correct property and child node definitions associated
-                JcrNodeType newNodeType = new JcrNodeType(this.context, this, nodeType.getInternalName(), supertypes,
-                                                          nodeType.getInternalPrimaryItemName(), nodeDefs, propertyDefs,
-                                                          nodeType.isMixin(), nodeType.hasOrderableChildNodes());
-                typesPendingRegistration.add(newNodeType);
             }
 
             // Graph.Batch batch = graph.batch();




More information about the dna-commits mailing list