jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r191181 - in /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version: InternalFrozenNodeImpl.java InternalFrozenVHImpl.java VersionManagerImpl.java
Date Fri, 17 Jun 2005 18:39:54 GMT
Author: tripod
Date: Fri Jun 17 11:39:52 2005
New Revision: 191181

URL: http://svn.apache.org/viewcvs?rev=191181&view=rev
Log:
- some versioning issues

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java?rev=191181&r1=191180&r2=191181&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
Fri Jun 17 11:39:52 2005
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.PropertyImpl;
 import org.apache.jackrabbit.core.QName;
+import org.apache.jackrabbit.core.util.uuid.UUID;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
@@ -320,10 +321,12 @@
                     if (child.isNodeType(MIX_VERSIONABLE)) {
                         // create frozen versionable child
                         NodeStateEx newChild = node.addNode(child.getQName(), NT_VERSIONEDCHILD,
null, false);
-                        newChild.setPropertyValue(JCR_VERSIONHISTORY,
-                                InternalValue.create(child.getVersionHistory().getUUID()));
+                        newChild.setPropertyValue(JCR_CHILDVERSIONHISTORY,
+                                InternalValue.create(new UUID(child.getVersionHistory().getUUID())));
+                        /*
                         newChild.setPropertyValue(JCR_BASEVERSION,
                                 InternalValue.create(child.getBaseVersion().getUUID()));
+                        */
                         break;
                     }
                     // else copy but do not recurse

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java?rev=191181&r1=191180&r2=191181&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java
Fri Jun 17 11:39:52 2005
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.core.Constants;
 import org.apache.jackrabbit.core.QName;
+import org.apache.jackrabbit.core.util.uuid.UUID;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.version.VersionException;
@@ -63,7 +64,7 @@
      * {@inheritDoc}
      */
     public String getVersionHistoryId() {
-        return (String) node.getPropertyValue(Constants.JCR_VERSIONHISTORY).internalValue();
+        return node.getPropertyValue(Constants.JCR_CHILDVERSIONHISTORY).internalValue().toString();
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java?rev=191181&r1=191180&r2=191181&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
Fri Jun 17 11:39:52 2005
@@ -353,9 +353,17 @@
      * @return
      * @throws RepositoryException
      */
-    public Version checkin(NodeImpl node) throws RepositoryException {
+    public synchronized Version checkin(NodeImpl node) throws RepositoryException {
         SessionImpl session = (SessionImpl) node.getSession();
         InternalVersion version = internalCheckin(node);
+        // need to recalc successor prop
+        InternalVersion[] preds = version.getPredecessors();
+        for (int i=0; i<preds.length; i++) {
+            ItemState state = (ItemState) items.remove(new PropertyId(preds[i].getId(), JCR_SUCCESSORS));
+            if (state != null) {
+                state.discard();
+            }
+        }
         invalidateItem(new NodeId(version.getVersionHistory().getId()), true);
         VersionImpl v = (VersionImpl) session.getNodeByUUID(version.getId());
 
@@ -687,21 +695,19 @@
      * @param id
      */
     private void invalidateItem(ItemId id, boolean recursive) {
-        ItemState state = (ItemState) items.remove(id);
+        ItemState state = (ItemState) items.get(id);
         if (state != null) {
-            if (recursive) {
-                if (state instanceof NodeState) {
-                    NodeState nState = (NodeState) state;
-                    Iterator iter = nState.getPropertyEntries().iterator();
-                    while (iter.hasNext()) {
-                        NodeState.PropertyEntry pe = (NodeState.PropertyEntry) iter.next();
-                        invalidateItem(new PropertyId(nState.getUUID(), pe.getName()), false);
-                    }
-                    iter = nState.getChildNodeEntries().iterator();
-                    while (iter.hasNext()) {
-                        NodeState.ChildNodeEntry pe = (NodeState.ChildNodeEntry) iter.next();
-                        invalidateItem(new NodeId(pe.getUUID()), true);
-                    }
+            if (recursive && state instanceof NodeState) {
+                NodeState nState = (NodeState) state;
+                Iterator iter = nState.getPropertyEntries().iterator();
+                while (iter.hasNext()) {
+                    NodeState.PropertyEntry pe = (NodeState.PropertyEntry) iter.next();
+                    invalidateItem(new PropertyId(nState.getUUID(), pe.getName()), false);
+                }
+                iter = nState.getChildNodeEntries().iterator();
+                while (iter.hasNext()) {
+                    NodeState.ChildNodeEntry pe = (NodeState.ChildNodeEntry) iter.next();
+                    invalidateItem(new NodeId(pe.getUUID()), true);
                 }
             }
             state.notifyStateUpdated();



Mime
View raw message