chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1022454 - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub: AtomEntry.java AtomPubUtils.java DiscoveryService.java
Date Thu, 14 Oct 2010 10:18:25 GMT
Author: fmui
Date: Thu Oct 14 10:18:24 2010
New Revision: 1022454

URL: http://svn.apache.org/viewvc?rev=1022454&view=rev
Log:
- fixed a problem with deleted objects in content changes lists 
  (Object infos for deleted objects cannot be retrieved because the objects don’t exist
anymore. Now a minimal Atom entry is generated.)

Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java?rev=1022454&r1=1022453&r2=1022454&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java
Thu Oct 14 10:18:24 2010
@@ -34,9 +34,6 @@ import org.apache.chemistry.opencmis.com
 
 /**
  * Atom Entry class.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class AtomEntry extends AtomDocumentBase {
 
@@ -101,6 +98,26 @@ public class AtomEntry extends AtomDocum
     }
 
     /**
+     * Writes a delete object.
+     */
+    public void writeDeletedObject(ObjectData object) throws XMLStreamException, JAXBException
{
+        CmisObjectType objectJaxb = convert(object);
+        if (objectJaxb == null) {
+            return;
+        }
+
+        long now = System.currentTimeMillis();
+        
+        writeAuthor(DEFAULT_AUTHOR);
+        writeId(generateAtomId(object.getId()));
+        writePublished(now);
+        writeTitle(object.getId());
+        writeUpdated(now);
+
+        JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createObject(objectJaxb),
getWriter(), true);
+    }
+
+    /**
      * Writes a type.
      * 
      * @throws JAXBException

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java?rev=1022454&r1=1022453&r2=1022454&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
Thu Oct 14 10:18:24 2010
@@ -241,6 +241,39 @@ public final class AtomPubUtils {
     }
 
     /**
+     * Writes the a object entry in a content changes list.
+     * 
+     * Content changes objects need special treatment because some of them could
+     * have been deleted and an object info cannot be generated.
+     */
+    public static void writeContentChangesObjectEntry(CmisService service, AtomEntry entry,
ObjectData object,
+            List<ObjectInFolderContainer> children, String repositoryId, String pathSegment,
+            String relativePathSegment, UrlBuilder baseUrl, boolean isRoot) throws XMLStreamException,
JAXBException {
+        if (object == null) {
+            throw new CmisRuntimeException("Object not set!");
+        }
+
+        ObjectInfo info = service.getObjectInfo(repositoryId, object.getId());
+        if (info != null) {
+            writeObjectEntry(service, entry, object, children, repositoryId, pathSegment,
relativePathSegment, baseUrl,
+                    isRoot);
+            return;
+        }
+
+        // start delete object entry
+        entry.startEntry(isRoot);
+
+        // write object
+        entry.writeDeletedObject(object);
+
+        // write links
+        entry.writeServiceLink(baseUrl.toString(), repositoryId);
+
+        // we are done
+        entry.endEntry();
+    }
+
+    /**
      * Writes an objects entry children feed.
      */
     public static void writeObjectChildren(CmisService service, AtomEntry entry, ObjectInfo
folderInfo,

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java?rev=1022454&r1=1022453&r2=1022454&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java
Thu Oct 14 10:18:24 2010
@@ -23,7 +23,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_QUERY;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrlBuilder;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeObjectEntry;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeContentChangesObjectEntry;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBigIntegerParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getEnumParameter;
@@ -259,7 +259,7 @@ public class DiscoveryService {
                 if (object == null) {
                     continue;
                 }
-                writeObjectEntry(service, entry, object, null, repositoryId, null, null,
baseUrl, false);
+                writeContentChangesObjectEntry(service, entry, object, null, repositoryId,
null, null, baseUrl, false);
             }
         }
 



Mime
View raw message