jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1333984 - in /jackrabbit/oak/trunk: oak-it/jcr/pom.xml oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
Date Fri, 04 May 2012 14:23:25 GMT
Author: reschke
Date: Fri May  4 14:23:25 2012
New Revision: 1333984

URL: http://svn.apache.org/viewvc?rev=1333984&view=rev
Log:
OAK-66: expose nt:base as super type for primary node types when not explicitly declared,
update test exclusions (WIP)

Modified:
    jackrabbit/oak/trunk/oak-it/jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java

Modified: jackrabbit/oak/trunk/oak-it/jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/jcr/pom.xml?rev=1333984&r1=1333983&r2=1333984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/jcr/pom.xml Fri May  4 14:23:25 2012
@@ -97,7 +97,8 @@ org.apache.jackrabbit.test.api.SessionRe
 org.apache.jackrabbit.test.api.HasPermissionTest
 org.apache.jackrabbit.test.api.WorkspaceTest
 org.apache.jackrabbit.test.api.ShareableNodeTest
-org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest
+org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testSimpleVersionable
+org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testChildNodeDef
 org.apache.jackrabbit.test.api.nodetype.CanSetPropertyDateTest#testConversions
 org.apache.jackrabbit.test.api.nodetype.CanSetPropertyMultipleTest#testReturnFalseBecauseIsProtected
 org.apache.jackrabbit.test.api.nodetype.CanSetPropertyMultipleTest#testReturnFalseBecauseIsNotMultiple

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java?rev=1333984&r1=1333983&r2=1333984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
Fri May  4 14:23:25 2012
@@ -86,11 +86,33 @@ class NodeTypeImpl implements NodeType {
 
     @Override
     public String[] getDeclaredSupertypeNames() {
-        String[] names = new String[declaredSuperTypeNames.length];
-        for (int i = 0; i < names.length; i++) {
-            names[i] = mapper.getJcrName(declaredSuperTypeNames[i]);
+        List<String> names = new ArrayList<String>();
+        boolean addNtBase = !mixin;
+        for (String name : declaredSuperTypeNames) {
+            
+            String jcrName = mapper.getJcrName(name); 
+            
+            // TODO: figure out a more performant way
+            // check of at least one declared super type being a non-mixin type
+            if (addNtBase) {
+                try {
+                    NodeType nt = manager.getNodeType(jcrName);
+                    if (! nt.isMixin()) {
+                        addNtBase = false;
+                    }
+                }
+                catch (RepositoryException ex) {
+                    // ignored
+                }
+            }    
+            names.add(jcrName);
         }
-        return names;
+        
+        if (addNtBase) {
+            names.add(mapper.getJcrName("nt:base"));
+        }
+        
+        return names.toArray(new String[names.size()]);
     }
 
     @Override
@@ -141,9 +163,6 @@ class NodeTypeImpl implements NodeType {
             Set<String> added = new HashSet<String>();
             Queue<String> queue = new LinkedList<String>(
                     Arrays.asList(getDeclaredSupertypeNames()));
-            if (!isMixin()) {
-                queue.add(mapper.getJcrName(mapper.getOakName(NodeType.NT_BASE)));
-            }
             while (!queue.isEmpty()) {
                 String name = queue.remove();
                 if (added.add(name)) {



Mime
View raw message