You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2012/11/20 06:43:21 UTC

svn commit: r1411548 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java

Author: jens
Date: Tue Nov 20 05:43:20 2012
New Revision: 1411548

URL: http://svn.apache.org/viewvc?rev=1411548&view=rev
Log:
InMemeory: fix a bug when checking out a version with updated properties

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java?rev=1411548&r1=1411547&r2=1411548&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java Tue Nov 20 05:43:20 2012
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.apache.chemistry.opencmis.commons.PropertyIds;
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
@@ -61,9 +62,16 @@ public class DocumentVersionImpl extends
         setContent(content, false);
         fIsMajor = verState == VersioningState.MAJOR || verState == null;
         fIsPwc = verState == VersioningState.CHECKEDOUT;
-        fProperties = new HashMap<String, PropertyData<?>>(); // ensure that we
+        fProperties = new HashMap<String, PropertyData<?>>();
+        // copy user properties from latest version
+        DocumentVersionImpl src = (DocumentVersionImpl)container.getLatestVersion(false);
+        if (null != src && null != src.fProperties) {
+            for (Entry<String, PropertyData<?>> prop : src.fProperties.entrySet()) {
+                fProperties.put(prop.getKey(), prop.getValue());
+            }
+        }
+
         label = createVersionLabel();
-        // have a map
     }
 
     public void setContent(ContentStream content, boolean mustPersist) {