chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r967106 - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory: ./ server/
Date Fri, 23 Jul 2010 14:28:33 GMT
Author: jens
Date: Fri Jul 23 14:28:33 2010
New Revision: 967106

URL: http://svn.apache.org/viewvc?rev=967106&view=rev
Log:
InMemory: set allowable actions correctly for versioned documents, change exception for check-out
if there is no user

Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java?rev=967106&r1=967105&r2=967106&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java
Fri Jul 23 14:28:33 2010
@@ -61,6 +61,7 @@ public class DataObjectCreator {
         if (so instanceof Version) {
             isCheckedOut = ((Version) so).isPwc();
             canCheckIn = isCheckedOut && ((Version) so).getParentDocument().getCheckedOutBy().equals(user);
+            canCheckOut = !((Version) so).getParentDocument().isCheckedOut();
         } else if (so instanceof VersionedDocument) {
             isCheckedOut = ((VersionedDocument) so).isCheckedOut();
             canCheckOut = !((VersionedDocument) so).isCheckedOut();
@@ -115,9 +116,7 @@ public class DataObjectCreator {
         }
 
         if (isDocument) {
-            if (!isVersioned || canCheckIn) {
-                set.add(Action.CAN_SET_CONTENT_STREAM);
-            }
+            set.add(Action.CAN_SET_CONTENT_STREAM);
         }
 
         allowableActions.setAllowableActions(set);

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java?rev=967106&r1=967105&r2=967106&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java
Fri Jul 23 14:28:33 2010
@@ -23,6 +23,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.ObjectStore;
@@ -154,7 +155,7 @@ public class InMemoryAbstractServiceImpl
 
     protected void checkHasUser(String user) {
         if (null == user || user.length() == 0)
-            throw new CmisUpdateConflictException("Object can't be checked-in, no user is
given.");
+            throw new CmisPermissionDeniedException("Object can't be checked-in, no user
is given.");
     }
 
     protected void testCheckedOutByCurrentUser(String user, VersionedDocument verDoc) {

Modified: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java?rev=967106&r1=967105&r2=967106&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
Fri Jul 23 14:28:33 2010
@@ -52,6 +52,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl;
 import org.apache.chemistry.opencmis.commons.impl.server.ObjectInfoImpl;
@@ -719,6 +720,24 @@ public class InMemoryObjectServiceImpl e
             user = "unknown";
 
         StoredObject so = null;
+        
+        // check if content stream parameters are set and if not set some defaults
+        if (null != contentStream && (contentStream.getFileName() == null || contentStream.getFileName().length()
== 0 ||
+            contentStream.getMimeType() == null || contentStream.getMimeType().length() ==
0)) {
+            ContentStreamImpl cs = new ContentStreamImpl();
+            cs.setStream(contentStream.getStream());
+            if (contentStream.getFileName() == null || contentStream.getFileName().length()
== 0)
+                cs.setFileName(name);
+            else
+                cs.setFileName(contentStream.getFileName());
+            cs.setLength(contentStream.getBigLength());
+            if (contentStream.getMimeType() == null || contentStream.getMimeType().length()
== 0)
+                cs.setMimeType("application/octet-stream");
+            else
+                cs.setMimeType(contentStream.getMimeType());
+            cs.setExtensions(contentStream.getExtensions());
+            contentStream = cs;
+        }
 
         // Now we are sure to have document type definition:
         if (((DocumentTypeDefinition) typeDef).isVersionable()) {



Mime
View raw message