jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r647072 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
Date Fri, 11 Apr 2008 07:48:08 GMT
Author: dpfister
Date: Fri Apr 11 00:48:04 2008
New Revision: 647072

URL: http://svn.apache.org/viewvc?rev=647072&view=rev
Log:
JCR-1104 - JSR 283 support
- shareble nodes (work in progress)
- fix test failure introduced in r646336

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java?rev=647072&r1=647071&r2=647072&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
Fri Apr 11 00:48:04 2008
@@ -225,14 +225,18 @@
      * one parent.
      *
      * @param state item state
+     * @param useOverlayed whether to use overlayed state for shareable nodes
      * @return set of parent <code>NodeId</code>s. If state has no parent,
      *         array has length <code>0</code>.
      */
-    protected Set getParentIds(ItemState state) {
+    protected Set getParentIds(ItemState state, boolean useOverlayed) {
         if (state.isNode()) {
             // if this is a node, quickly check whether it is shareable and
             // whether it contains more than one parent
             NodeState ns = (NodeState) state;
+            if (ns.isShareable() && useOverlayed && ns.hasOverlayedState())
{
+                ns = (NodeState) ns.getOverlayedState();
+            }
             Set s = ns.getSharedSet();
             if (s.size() > 1) {
                 return s;
@@ -618,7 +622,7 @@
         }
         try {
             ItemState state = getItemState(descendant);
-            Set parentIds = getParentIds(state);
+            Set parentIds = getParentIds(state, false);
             while (parentIds.size() > 0) {
                 if (parentIds.contains(ancestor)) {
                     return true;
@@ -627,7 +631,7 @@
                 Iterator iter = parentIds.iterator();
                 while (iter.hasNext()) {
                     NodeId parentId = (NodeId) iter.next();
-                    grandparentIds.addAll(getParentIds(getItemState(parentId)));
+                    grandparentIds.addAll(getParentIds(getItemState(parentId), false));
                 }
                 parentIds = grandparentIds;
             }
@@ -658,10 +662,7 @@
         int depth = 1;
         try {
             ItemState state = getItemState(descendant);
-            if (state.hasOverlayedState()) {
-                state = state.getOverlayedState();
-            }
-            Set parentIds = getParentIds(state);
+            Set parentIds = getParentIds(state, true);
             while (parentIds.size() > 0) {
                 if (parentIds.contains(ancestor)) {
                     return depth;
@@ -672,10 +673,7 @@
                 while (iter.hasNext()) {
                     NodeId parentId = (NodeId) iter.next();
                     state = getItemState(parentId);
-                    if (state.hasOverlayedState()) {
-                        state = state.getOverlayedState();
-                    }
-                    grandparentIds.addAll(getParentIds(state));
+                    grandparentIds.addAll(getParentIds(state, true));
                 }
                 parentIds = grandparentIds;
             }



Mime
View raw message