chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1400477 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory: server/ storedobj/impl/
Date Sat, 20 Oct 2012 15:46:36 GMT
Author: jens
Date: Sat Oct 20 15:46:36 2012
New Revision: 1400477

URL: http://svn.apache.org/viewvc?rev=1400477&view=rev
Log:
InMemory bug fix: change modify date after rename,  store version label as string instead
of calculating from enumerating the series

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

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.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/server/InMemoryObjectServiceImpl.java?rev=1400477&r1=1400476&r2=1400477&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
Sat Oct 20 15:46:36 2012
@@ -604,8 +604,7 @@ public class InMemoryObjectServiceImpl e
         }
 
         // update properties
-        boolean hasUpdatedName = false;
-        boolean hasUpdatedOtherProps = false;
+        boolean hasUpdatedProp = false;
 
         if(properties != null) {
         	for (String key : properties.getProperties().keySet()) {
@@ -625,7 +624,7 @@ public class InMemoryObjectServiceImpl e
         								+ key);
         			}
         			oldProperties.remove(key);
-        			hasUpdatedOtherProps = true;
+        			hasUpdatedProp = true;
         		} else {
         			if (propDef.getUpdatability().equals(Updatability.WHENCHECKEDOUT)) {
         				if (!isCheckedOut)
@@ -638,7 +637,7 @@ public class InMemoryObjectServiceImpl e
         								+ key);
         			}
         			oldProperties.put(key, value);
-        			hasUpdatedOtherProps = true;
+        			hasUpdatedProp = true;
         		}
         	}
 
@@ -656,11 +655,11 @@ public class InMemoryObjectServiceImpl e
         		}
 
         		so.rename((String) pd.getFirstValue()); // note: this does persist
-        		hasUpdatedName = true;
+        		hasUpdatedProp = true;
         	}
         }
 
-        if (hasUpdatedOtherProps) {
+        if (hasUpdatedProp) {
             // set user, creation date, etc.
             if (user == null) {
                 user = "unknown";
@@ -670,7 +669,7 @@ public class InMemoryObjectServiceImpl e
             so.persist();
         }
 
-        if (hasUpdatedName || hasUpdatedOtherProps) {
+        if (hasUpdatedProp) {
             objectId.setValue(so.getId()); // might have a new id
             if (null != changeToken) {
                 String changeTokenVal = so.getChangeToken();

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=1400477&r1=1400476&r2=1400477&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
Sat Oct 20 15:46:36 2012
@@ -51,6 +51,7 @@ public class DocumentVersionImpl extends
     private String fComment; // checkin comment
     boolean fIsMajor;
     boolean fIsPwc; // true if this is the PWC
+    String label;
 
     public DocumentVersionImpl(String repositoryId, VersionedDocument container, ContentStream
content,
             VersioningState verState, ObjectStoreImpl objStore) {
@@ -61,6 +62,7 @@ public class DocumentVersionImpl extends
         fIsMajor = verState == VersioningState.MAJOR || verState == null;
         fIsPwc = verState == VersioningState.CHECKEDOUT;
         fProperties = new HashMap<String, PropertyData<?>>(); // ensure that
we
+        label = createVersionLabel();
         // have a map
     }
 
@@ -89,8 +91,8 @@ public class DocumentVersionImpl extends
         return fComment;
     }
 
-    public String getVersionLabel() {
-        int majorNo = 0;
+    private String createVersionLabel() {
+        int majorNo = 1;
         int minorNo = 0;
         List<DocumentVersion> allVersions = fContainer.getAllVersions();
         for (DocumentVersion ver : allVersions) {
@@ -286,4 +288,8 @@ public class DocumentVersionImpl extends
     	fContainer.setName(newName);
     }
 
+    public String getVersionLabel() {
+        return label;
+    }
+
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.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/StoredObjectImpl.java?rev=1400477&r1=1400476&r2=1400477&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
Sat Oct 20 15:46:36 2012
@@ -250,6 +250,7 @@ public class StoredObjectImpl implements
             setName((String) properties.get(PropertyIds.NAME).getFirstValue());
             setTypeId((String) properties.get(PropertyIds.OBJECT_TYPE_ID).getFirstValue());
         } else {
+            setModifiedBy(user);
             setModifiedAtNow();
         }
     }



Mime
View raw message