jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1521755 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
Date Wed, 11 Sep 2013 08:07:01 GMT
Author: mreutegg
Date: Wed Sep 11 08:07:00 2013
New Revision: 1521755

URL: http://svn.apache.org/r1521755
Log:
OAK-168: Basic JCR VersionManager support

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java?rev=1521755&r1=1521754&r2=1521755&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
Wed Sep 11 08:07:00 2013
@@ -62,9 +62,12 @@ import org.apache.jackrabbit.oak.api.Pro
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.core.IdentifierManager;
 import org.apache.jackrabbit.oak.core.ImmutableTree;
+import org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState;
+import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder;
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.util.TODO;
 
 /**
@@ -537,8 +540,18 @@ class VersionableState {
     private int getOPV(NodeBuilder parent, NodeBuilder child, String childName)
             throws RepositoryException {
         ImmutableTree parentTree = new ImmutableTree(parent.getNodeState());
+        NodeState childState;
+        if (NT_FROZENNODE.equals(child.getName(JCR_PRIMARYTYPE))) {
+            // need to translate into a regular node to get proper OPV value
+            NodeBuilder builder = new MemoryNodeBuilder(EmptyNodeState.EMPTY_NODE);
+            builder.setProperty(JCR_PRIMARYTYPE, child.getName(JCR_FROZENPRIMARYTYPE), Type.NAME);
+            builder.setProperty(JCR_MIXINTYPES, child.getNames(JCR_MIXINTYPES), Type.NAMES);
+            childState = builder.getNodeState();
+        } else {
+            childState = child.getNodeState();
+        }
         ImmutableTree childTree = new ImmutableTree(
-                parentTree, childName, child.getNodeState());
+                parentTree, childName, childState);
         return ntMgr.getDefinition(parentTree, childTree).getOnParentVersion();
     }
 



Mime
View raw message