jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1417359 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Date Wed, 05 Dec 2012 11:13:17 GMT
Author: angela
Date: Wed Dec  5 11:13:16 2012
New Revision: 1417359

URL: http://svn.apache.org/viewvc?rev=1417359&view=rev
Log:
OAK-490 : Add EffectiveNodeTypeManager#isNodeType

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java?rev=1417359&r1=1417358&r2=1417359&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
Wed Dec  5 11:13:16 2012
@@ -150,15 +150,7 @@ public abstract class ReadOnlyNodeTypeMa
 
     @Override
     public NodeType getNodeType(String name) throws RepositoryException {
-        Tree types = getTypes();
-        if (types != null) {
-            Tree type = types.getChild(getOakName(name));
-            if (type != null) {
-                return new NodeTypeImpl(this, getValueFactory(),
-                        new NodeUtil(type, getNameMapper()));
-            }
-        }
-        throw new NoSuchNodeTypeException(name);
+        return internalGetNodeType(getOakName(name));
     }
 
     @Override
@@ -260,14 +252,18 @@ public abstract class ReadOnlyNodeTypeMa
             throw new NoSuchNodeTypeException(nodeTypeName);
         }
 
+        String oakName = getOakName(nodeTypeName);
         NodeUtil node = new NodeUtil(tree);
         String ntName = node.getPrimaryNodeTypeName();
-        if (nodeTypeName.equals(ntName) || getNodeType(ntName).isNodeType(nodeTypeName))
{
+        if (oakName.equals(ntName) || internalGetNodeType(ntName).isNodeType(nodeTypeName))
{
             return true;
         }
-        for (String mixinName : node.getNames(JcrConstants.JCR_MIXINTYPES, new String[0]))
{
-            if (nodeTypeName.equals(mixinName) || getNodeType(mixinName).isNodeType(nodeTypeName))
{
-                return true;
+        String[] mixinNames = node.getStrings(JcrConstants.JCR_MIXINTYPES);
+        if (mixinNames != null) {
+            for (String mixinName : mixinNames) {
+                if (oakName.equals(mixinName) || internalGetNodeType(mixinName).isNodeType(nodeTypeName))
{
+                    return true;
+                }
             }
         }
         return false;
@@ -543,6 +539,16 @@ public abstract class ReadOnlyNodeTypeMa
     }
 
     //------------------------------------------------------------< private >---
+    private NodeType internalGetNodeType(String oakName) throws NoSuchNodeTypeException {
+        Tree types = getTypes();
+        if (types != null) {
+            Tree type = types.getChild(oakName);
+            if (type != null) {
+                return new NodeTypeImpl(this, getValueFactory(), new NodeUtil(type, getNameMapper()));
+            }
+        }
+        throw new NoSuchNodeTypeException(getNameMapper().getJcrName(oakName));
+    }
 
     private static Collection<NodeType> getEffectiveNodeTypes(Queue<NodeType>
queue) {
         Map<String, NodeType> types = Maps.newHashMap();

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1417359&r1=1417358&r2=1417359&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Wed Dec  5 11:13:16 2012
@@ -859,8 +859,7 @@ public class NodeImpl extends ItemImpl<N
     public boolean isNodeType(final String nodeTypeName) throws RepositoryException {
         checkStatus();
 
-        String oakName = sessionDelegate.getOakNameOrThrow(nodeTypeName);
-        return sessionDelegate.getEffectiveNodeTypeProvider().isNodeType(dlg.getTree(), oakName);
+        return sessionDelegate.getEffectiveNodeTypeProvider().isNodeType(dlg.getTree(), nodeTypeName);
     }
 
     @Override



Mime
View raw message