jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r776362 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java
Date Tue, 19 May 2009 15:47:02 GMT
Author: jukka
Date: Tue May 19 15:47:01 2009
New Revision: 776362

URL: http://svn.apache.org/viewvc?rev=776362&view=rev
Log:
JCR-422: Implement a backup tool

Handle node references

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

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java?rev=776362&r1=776361&r2=776362&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java
Tue May 19 15:47:01 2009
@@ -24,6 +24,8 @@
 import org.apache.jackrabbit.core.state.ChangeLog;
 import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.state.ItemStateException;
+import org.apache.jackrabbit.core.state.NodeReferences;
+import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.spi.Name;
@@ -139,7 +141,15 @@
             }
         }
 
-        // TODO: Copy node references?
+        // Copy all node references
+        NodeReferencesId refsId = new NodeReferencesId(sourceNode.getNodeId());
+        if (source.exists(refsId)) {
+            changes.modified(source.load(refsId));
+        } else if (target.exists(refsId)) {
+            NodeReferences references = target.load(refsId);
+            references.clearAllReferences();
+            changes.modified(references);
+        }
 
         // Persist the copied states
         target.store(changes);



Mime
View raw message