chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r901722 - in /incubator/chemistry/trunk/chemistry: chemistry-api/src/main/java/org/apache/chemistry/ chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/ chemistry-atompub/src/main/java/org/apache/chemistry/atompub/
Date Thu, 21 Jan 2010 14:31:19 GMT
Author: fguillaume
Date: Thu Jan 21 14:31:19 2010
New Revision: 901722

URL: http://svn.apache.org/viewvc?rev=901722&view=rev
Log:
CMIS-99: Add xsi:type to cmisra:type for JAXB

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMIS.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/AtomPub.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMIS.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMIS.java?rev=901722&r1=901721&r2=901722&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMIS.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMIS.java
Thu Jan 21 14:31:19 2010
@@ -16,6 +16,10 @@
  */
 package org.apache.chemistry;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.xml.namespace.QName;
 
 /**
@@ -229,4 +233,24 @@
 
     public static final QName DISPLAY_NAME_NONS = new QName("displayName");
 
+    // types from schema
+
+    public static final QName SCHEMA_TYPE_DOCUMENT = CMISName("cmisTypeDocumentDefinitionType");
+
+    public static final QName SCHEMA_TYPE_FOLDER = CMISName("cmisTypeFolderDefinitionType");
+
+    public static final QName SCHEMA_TYPE_RELATIONSHIP = CMISName("cmisTypeRelationshipDefinitionType");
+
+    public static final QName SCHEMA_TYPE_POLICY = CMISName("cmisTypePolicyDefinitionType");
+
+    public static final Map<BaseType, QName> SCHEMA_TYPES;
+
+    static {
+        Map<BaseType, QName> map = new HashMap<BaseType, QName>();
+        map.put(BaseType.DOCUMENT, SCHEMA_TYPE_DOCUMENT);
+        map.put(BaseType.FOLDER, SCHEMA_TYPE_FOLDER);
+        map.put(BaseType.RELATIONSHIP, SCHEMA_TYPE_RELATIONSHIP);
+        map.put(BaseType.POLICY, SCHEMA_TYPE_POLICY);
+        SCHEMA_TYPES = Collections.unmodifiableMap(map);
+    }
 }

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=901722&r1=901721&r2=901722&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
Thu Jan 21 14:31:19 2010
@@ -64,6 +64,8 @@
         Factory factory = request.getAbdera().getFactory();
         Feed feed = factory.newFeed();
         feed.declareNS(CMIS.CMIS_NS, CMIS.CMIS_PREFIX);
+        feed.declareNS(AtomPubCMIS.CMISRA_NS, AtomPubCMIS.CMISRA_PREFIX);
+        feed.declareNS(AtomPub.XSI_NS, AtomPub.XSI_PREFIX);
         feed.setId(getId(request));
         feed.setTitle(getTitle(request));
         feed.addLink(request.getResolvedUri().toString(), "self");
@@ -138,6 +140,9 @@
         // CMIS-specific
         Element te = factory.newElement(AtomPubCMIS.TYPE, entry);
         te.setAttributeValue(AtomPubCMIS.ID, tid);
+        QName schemaType = CMIS.SCHEMA_TYPES.get(type.getBaseType());
+        te.setAttributeValue(AtomPub.XSI_TYPE, schemaType.getPrefix() + ':'
+                + schemaType.getLocalPart());
         Element el;
         // note: setText is called in a separate statement as JDK 5 has problems
         // compiling when it's on one line (compiler generics bug)

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/AtomPub.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/AtomPub.java?rev=901722&r1=901721&r2=901722&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/AtomPub.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/AtomPub.java
Thu Jan 21 14:31:19 2010
@@ -31,6 +31,10 @@
      * ----- Namespaces -----
      */
 
+    public static final String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance";
+
+    public static final String XSI_PREFIX = "xsi";
+
     public static final String ATOM_NS = "http://www.w3.org/2005/Atom";
 
     public static final String APP_NS = "http://www.w3.org/2007/app";
@@ -39,6 +43,8 @@
      * ----- XML Qualified Names-----
      */
 
+    public static final QName XSI_TYPE = new QName(XSI_NS, "type");
+
     public static final QName ATOM_FEED = new QName(ATOM_NS, "feed");
 
     public static final QName ATOM_ENTRY = new QName(ATOM_NS, "entry");



Mime
View raw message