chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r888503 - in /incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src: main/java/org/apache/chemistry/atompub/server/ test/java/org/apache/chemistry/atompub/server/
Date Tue, 08 Dec 2009 18:27:20 GMT
Author: fguillaume
Date: Tue Dec  8 18:27:20 2009
New Revision: 888503

URL: http://svn.apache.org/viewvc?rev=888503&view=rev
Log:
CMIS-66: make AtomPub object fetching take parameters into account

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java?rev=888503&r1=888502&r2=888503&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
Tue Dec  8 18:27:20 2009
@@ -41,6 +41,7 @@
 import org.apache.abdera.protocol.server.ProviderHelper;
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.ResponseContext;
+import org.apache.abdera.protocol.server.Target;
 import org.apache.abdera.protocol.server.context.AbstractResponseContext;
 import org.apache.abdera.protocol.server.context.BaseResponseContext;
 import org.apache.abdera.protocol.server.context.EmptyResponseContext;
@@ -531,16 +532,23 @@
             throws ResponseContextException {
         SPI spi = repository.getSPI();
         try {
+            Target target = request.getTarget();
+            String filter = target.getParameter(AtomPubCMIS.PARAM_FILTER);
+            boolean includeAllowableActions = getParameter(request,
+                    AtomPubCMIS.PARAM_INCLUDE_ALLOWABLE_ACTIONS, false);
+            boolean includeRelationships = getParameter(request,
+                    AtomPubCMIS.PARAM_INCLUDE_RELATIONSHIPS, false);
             if ("path".equals(getType())) {
                 String path = resourceName;
                 if (!path.startsWith("/")) {
                     path = "/" + path;
                 }
-                return spi.getObjectByPath(path, null, false, false);
+                return spi.getObjectByPath(path, filter,
+                        includeAllowableActions, includeRelationships);
             } else { // object
                 String id = resourceName;
-                return spi.getProperties(spi.newObjectId(id), null, false,
-                        false);
+                return spi.getProperties(spi.newObjectId(id), filter,
+                        includeAllowableActions, includeRelationships);
             }
         } finally {
             spi.close();

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java?rev=888503&r1=888502&r2=888503&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java
Tue Dec  8 18:27:20 2009
@@ -65,8 +65,8 @@
         // entry
         targetBuilder.setTemplate(TargetType.TYPE_ENTRY,
                 "{target_base}/{entrytype}/{id}");
-        targetResolver.setPattern("/object/([^/?]+)", TargetType.TYPE_ENTRY,
-                "objectid");
+        targetResolver.setPattern("/object/([^/?]+)(\\?.*)?",
+                TargetType.TYPE_ENTRY, "objectid");
         targetResolver.setPattern("/allowableactions/([^/?]+)",
                 TargetType.TYPE_ENTRY, "objectid"); // XXX entry?
         targetResolver.setPattern("/type/([^/?]+)(\\?.*)?",

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java?rev=888503&r1=888502&r2=888503&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
Tue Dec  8 18:27:20 2009
@@ -188,6 +188,12 @@
         Element ob = resp.getDocument().getRoot();
         assertNotNull(ob);
 
+        resp = client.get(base + "/object/" + doc3id + '?'
+                + AtomPubCMIS.PARAM_FILTER + "=cmis:name");
+        assertEquals(200, resp.getStatus());
+        ob = resp.getDocument().getRoot();
+        assertNotNull(ob);
+
         HttpMethod method = new GetMethod(base + "/file/" + doc3id);
         int status = new HttpClient().executeMethod(method);
         assertEquals(HttpStatus.SC_OK, status);



Mime
View raw message