You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2006/05/26 02:15:48 UTC
svn commit: r409516 -
/jackrabbit/branches/1.0/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
Author: jukka
Date: Thu May 25 17:15:47 2006
New Revision: 409516
URL: http://svn.apache.org/viewvc?rev=409516&view=rev
Log:
1.0: Merged revision 393000: JCR-50 JCR-374
Modified:
jackrabbit/branches/1.0/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
Modified: jackrabbit/branches/1.0/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.0/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java?rev=409516&r1=409515&r2=409516&view=diff
==============================================================================
--- jackrabbit/branches/1.0/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java (original)
+++ jackrabbit/branches/1.0/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java Thu May 25 17:15:47 2006
@@ -294,8 +294,6 @@
}
}
-
-
/**
* checks if the given child node exists.
*
@@ -331,8 +329,7 @@
if (entry == null) {
return false;
} else {
- ItemState state = stateMgr.getItemState(entry.getId());
- stateMgr.destroy(state);
+ removeNode(entry.getId());
nodeState.removeChildNodeEntry(name, index);
nodeState.setStatus(ItemState.STATUS_EXISTING_MODIFIED);
return true;
@@ -340,6 +337,37 @@
} catch (ItemStateException e) {
throw new RepositoryException(e);
}
+ }
+
+ /**
+ * removes recursively the node with the given id
+ *
+ * @param id
+ * @throws ItemStateException
+ */
+ private void removeNode(NodeId id) throws ItemStateException {
+ NodeState state = (NodeState) stateMgr.getItemState(id);
+
+ // remove properties
+ Iterator iter = state.getPropertyNames().iterator();
+ while (iter.hasNext()) {
+ QName name = (QName) iter.next();
+ PropertyId propId = new PropertyId(id, name);
+ PropertyState propState = (PropertyState) stateMgr.getItemState(propId);
+ stateMgr.destroy(propState);
+ }
+ state.removeAllPropertyNames();
+
+ // remove child nodes
+ iter = state.getChildNodeEntries().iterator();
+ while (iter.hasNext()) {
+ NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
+ removeNode(entry.getId());
+ }
+ state.removeAllChildNodeEntries();
+
+ // destroy the state itself
+ stateMgr.destroy(state);
}
/**