jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r431896 - /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
Date Wed, 16 Aug 2006 13:25:54 GMT
Author: mreutegg
Date: Wed Aug 16 06:25:54 2006
New Revision: 431896

URL: http://svn.apache.org/viewvc?rev=431896&view=rev
Log:
Replace ChildNodeEntries.remove(NodeId) with ChildNodeEntries.remove(NodeState)

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?rev=431896&r1=431895&r2=431896&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
Wed Aug 16 06:25:54 2006
@@ -847,9 +847,8 @@
     // TODO: review. move with SPI Ids
     synchronized void moveChildNodeEntry(NodeState newParent, NodeState childState, QName
newName)
         throws RepositoryException {
-        NodeId childId = childState.getNodeId();
         // rename only
-        ChildNodeEntry oldEntry = childNodeEntries.remove(childId);
+        ChildNodeEntry oldEntry = childNodeEntries.remove(childState);
         if (oldEntry != null) {
             if (newParent == this) {
                 ChildNodeEntry newEntry = childNodeEntries.add(name, childState.getUUID());
@@ -1136,13 +1135,24 @@
         }
 
         /**
-         * Removes the child node entry refering to the node with the given id.
+         * Removes the child node entry refering to the node state.
          *
-         * @param id id of node whose entry is to be removed.
+         * @param nodeState the node state whose entry is to be removed.
          * @return the removed entry or <code>null</code> if there is no such
entry.
          */
-        ChildNodeEntry remove(NodeId id) {
-            ChildNodeEntry entry = (ChildNodeEntry) entries.get(id);
+        ChildNodeEntry remove(NodeState nodeState) {
+            ChildNodeEntry entry = null;
+            for (Iterator it = get(nodeState.getName()).iterator(); it.hasNext(); ) {
+                ChildNodeEntry tmp = (ChildNodeEntry) it.next();
+                try {
+                    if (tmp.getNodeState() == nodeState) {
+                        entry = tmp;
+                        break;
+                    }
+                } catch (ItemStateException e) {
+                    log.warn("error accessing child node state: " + e.getMessage());
+                }
+            }
             if (entry != null) {
                 return remove(entry.getName(), entry.getIndex());
             }



Mime
View raw message