tripodsan commented on a change in pull request #163:
URL: 
https://github.com/apache/jackrabbit-filevault/pull/163#discussion_r711728641



##########
File path: 
vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/DocViewSAXImporter.java
##########
@@ -1295,6 +1300,31 @@ public void endElement(String uri, String localName, 
String qName) throws SAXExc
         }
     }
 
+    private int getNumChildrenWithType(Node parent, Node child) throws 
RepositoryException {
+
+        int count=0;
+       
+        NodeIterator iter = parent.getNodes();
+
+        EffectiveNodeType ent = EffectiveNodeType.ofNode(parent); 
+        Optional<NodeDefinition> def = 
ent.getApplicableChildNodeDefinition(child.getName(), 
child.getPrimaryNodeType());
+        
+        while (iter.hasNext()) {
+            Node sibling = iter.nextNode();
+            Optional<NodeDefinition>  childDef = 
ent.getApplicableChildNodeDefinition(sibling.getName(), 
sibling.getPrimaryNodeType());
+            Boolean test = (def == childDef) || (def != null && 
def.equals(childDef));
+
+            /*This is not working
+            if(def.equals(childDef)) { 
+                count++; 
+            }*/
+            
if(Arrays.equals(def.get().getRequiredPrimaryTypes(),childDef.get().getRequiredPrimaryTypes()))
 {
+                count++; 
+            }

Review comment:
       the problem is rather, that the 
[ItemDefintion](https://github.com/apache/jackrabbit-oak/blob/c6ddcc55bee3de915459af01e91edad32d538f3d/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java#L42)
 doesn't implement equals :-(
   
   @ankitaagar I think your must implement the equals yourself or we add it as 
helper function to `EffectiveNodeType`

##########
File path: 
vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/DocViewSAXImporter.java
##########
@@ -1295,6 +1300,31 @@ public void endElement(String uri, String localName, 
String qName) throws SAXExc
         }
     }
 
+    private int getNumChildrenWithType(Node parent, Node child) throws 
RepositoryException {
+
+        int count=0;
+       
+        NodeIterator iter = parent.getNodes();
+
+        EffectiveNodeType ent = EffectiveNodeType.ofNode(parent); 
+        Optional<NodeDefinition> def = 
ent.getApplicableChildNodeDefinition(child.getName(), 
child.getPrimaryNodeType());
+        
+        while (iter.hasNext()) {
+            Node sibling = iter.nextNode();
+            Optional<NodeDefinition>  childDef = 
ent.getApplicableChildNodeDefinition(sibling.getName(), 
sibling.getPrimaryNodeType());
+            Boolean test = (def == childDef) || (def != null && 
def.equals(childDef));
+
+            /*This is not working
+            if(def.equals(childDef)) { 
+                count++; 
+            }*/
+            
if(Arrays.equals(def.get().getRequiredPrimaryTypes(),childDef.get().getRequiredPrimaryTypes()))
 {
+                count++; 
+            }

Review comment:
       the problem is rather, that the 
[ItemDefintion](https://github.com/apache/jackrabbit-oak/blob/c6ddcc55bee3de915459af01e91edad32d538f3d/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java#L42)
 doesn't implement equals :-(
   
   @ankitaagar I think you must implement the equals yourself or we add it as 
helper function to `EffectiveNodeType`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to