jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: rev 53957 - incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version
Date Thu, 07 Oct 2004 10:53:19 GMT
Author: tripod
Date: Thu Oct  7 03:53:18 2004
New Revision: 53957

Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java
Log:
create deeper path for version history

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java
Thu Oct  7 03:53:18 2004
@@ -162,14 +162,30 @@
     public VersionHistory createVersionHistory(NodeImpl node)
             throws RepositoryException {
 
-        // check if history already exists
-        QName historyNodeName = new QName(NamespaceRegistryImpl.NS_DEFAULT_URI, node.getUUID());
-        if (historyRoot.hasNode(historyNodeName)) {
-            historyRoot.removeNode(historyNodeName);
+        // create deep path
+        String uuid = node.getUUID();
+        PersistentNode parent = historyRoot;
+        QName historyNodeName = new QName(NamespaceRegistryImpl.NS_DEFAULT_URI, uuid.substring(0,
2));
+        if (!parent.hasNode(historyNodeName)) {
+            parent = parent.addNode(historyNodeName, NodeTypeRegistry.NT_UNSTRUCTURED);
+        } else {
+            parent = parent.getNode(historyNodeName, 1);
         }
+        historyNodeName = new QName(NamespaceRegistryImpl.NS_DEFAULT_URI, uuid.substring(2,
4));
+        if (!parent.hasNode(historyNodeName)) {
+            parent = parent.addNode(historyNodeName, NodeTypeRegistry.NT_UNSTRUCTURED);
+        } else {
+            parent = parent.getNode(historyNodeName, 1);
+        }
+
+        historyNodeName = new QName(NamespaceRegistryImpl.NS_DEFAULT_URI, uuid.substring(4));
+        if (parent.hasNode(historyNodeName)) {
+            parent.removeNode(historyNodeName);
+        }
+        historyRoot.store();
 
         // create new history node in the persistent state
-        InternalVersionHistory history = InternalVersionHistory.create(historyRoot, historyNodeName);
+        InternalVersionHistory history = InternalVersionHistory.create(parent, historyNodeName);
         return new VersionHistoryImpl(node.getSession(), history);
     }
 

Mime
View raw message