chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r896476 - in /incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src: main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
Date Wed, 06 Jan 2010 15:22:43 GMT
Author: fguillaume
Date: Wed Jan  6 15:22:42 2010
New Revision: 896476

URL: http://svn.apache.org/viewvc?rev=896476&view=rev
Log:
Return type property definitions when a single type is requested

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.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/CMISTypesCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java?rev=896476&r1=896475&r2=896476&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java
Wed Jan  6 15:22:42 2010
@@ -32,6 +32,7 @@
 import org.apache.abdera.model.Feed;
 import org.apache.abdera.model.Person;
 import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.ResponseContext;
 import org.apache.abdera.protocol.server.context.ResponseContextException;
 import org.apache.chemistry.CMIS;
 import org.apache.chemistry.PropertyDefinition;
@@ -47,6 +48,8 @@
  */
 public class CMISTypesCollection extends CMISCollection<Type> {
 
+    protected boolean singleEntry;
+
     public CMISTypesCollection(String type, String id, Repository repository) {
         super(type, "types", id, repository);
     }
@@ -88,9 +91,17 @@
      */
 
     @Override
+    public ResponseContext getEntry(RequestContext request) {
+        singleEntry = true;
+        return super.getEntry(request);
+    }
+
+    @Override
     public String addEntryDetails(RequestContext request, Entry entry,
             IRI feedIri, Type type) throws ResponseContextException {
-        boolean includePropertyDefinitions = "true".equals(request.getParameter("includePropertyDefinitions"));
+        boolean includePropertyDefinitions = singleEntry
+                || getParameter(request,
+                        AtomPubCMIS.PARAM_INCLUDE_PROPERTY_DEFINITIONS, false);
         Factory factory = request.getAbdera().getFactory();
 
         entry.setId(getId(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=896476&r1=896475&r2=896476&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
Wed Jan  6 15:22:42 2010
@@ -207,6 +207,21 @@
         resp.release();
     }
 
+    public void testType() throws Exception {
+        ClientResponse resp = client.get(base + "/type/cmis:document");
+        assertEquals(HttpStatus.SC_OK, resp.getStatus());
+        Element el = resp.getDocument().getRoot();
+        assertNotNull(el);
+        Element t = el.getFirstChild(new QName(AtomPubCMIS.CMISRA_NS, "type"));
+        assertNotNull(t);
+        // check that when we get a simple type, the property definitions are
+        // returned as well
+        Element p = t.getFirstChild(new QName(CMIS.CMIS_NS,
+                "propertyIdDefinition"));
+        assertNotNull(p);
+        resp.release();
+    }
+
     public void testChildren() throws Exception {
         ClientResponse resp = client.get(base + "/children/" + rootFolderId);
         assertEquals(HttpStatus.SC_OK, resp.getStatus());



Mime
View raw message