[exo-jcr-commits] exo-jcr SVN: r1746 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Feb 9 13:22:41 EST 2010


Author: nfilotto
Date: 2010-02-09 13:22:41 -0500 (Tue, 09 Feb 2010)
New Revision: 1746

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
Log:
EXOJCR-305: The Peter's recommendations have been applied

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java	2010-02-09 17:27:31 UTC (rev 1745)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java	2010-02-09 18:22:41 UTC (rev 1746)
@@ -1355,23 +1355,23 @@
    {
 
       checkValid();
-      return isLocked(this);
+      return isLocked((NodeData)this.getData());
    }
 
    /**
     * Checks if a given node is locked only if the node is not new otherwise, we check the first
     * ancestor that is not new
-    * @param node the node to check
+    * @param data the data of the node to check
     * @return <code>true</code> if the node is locked, <code>false</code> otherwise
     * @throws RepositoryException if an error occurs
     */
-   private boolean isLocked(NodeImpl node) throws RepositoryException
+   private boolean isLocked(NodeData data) throws RepositoryException
    {
-      if (dataManager.isNew(node.getInternalIdentifier()))
+      if (dataManager.isNew(data.getIdentifier()))
       {
          // The node is new, so we will check directly its parent instead
-         NodeImpl parent = node.getParent();
-         if (parent == null)
+         NodeData parentData = (NodeData)dataManager.getItemData(data.getParentIdentifier());
+         if (parentData == null)
          {
             // The node is the root node and is new, so we consider it as unlocked
             return false;            
@@ -1379,13 +1379,13 @@
          else
          {
             // the node has a parent that we need to test
-            return isLocked(parent);
+            return isLocked(parentData);
          }
       }
       else
       {
          // The node already exists so we need to check if it is locked
-         return session.getLockManager().isLocked((NodeData)node.getData());
+         return session.getLockManager().isLocked(data);
       }      
    }
 



More information about the exo-jcr-commits mailing list