Author: fguillaume
Date: Wed Jul 15 14:41:38 2009
New Revision: 794290
URL: http://svn.apache.org/viewvc?rev=794290&view=rev
Log:
CMIS-29: Workaround for Alfresco additional "BaseType" property
Modified:
incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractObjectReader.java
incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/PropertiesElement.java
Modified:
incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractObjectReader.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractObjectReader.java?rev=794290&r1=794289&r2=794290&view=diff
==============================================================================
---
incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractObjectReader.java
(original)
+++
incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractObjectReader.java
Wed Jul 15 14:41:38 2009
@@ -13,6 +13,8 @@
*
* Authors:
* Bogdan Stefanescu, Nuxeo
+ * Florent Guillaume, Nuxeo
+ * Ugo Cei, Sourcesense
*/
package org.apache.chemistry.atompub.client.stax;
@@ -117,15 +119,16 @@
protected void readPropertyWithType(ReadContext ctx, StaxReader reader,
T object, XmlProperty p, Type entryType) {
- PropertyDefinition def = entryType.getPropertyDefinition(p.getName());
+ String name = p.getName();
+ PropertyDefinition def = entryType.getPropertyDefinition(name);
if (def == null) {
- if (p.getName().equals("ContentStreamURI")) {
- // ignore, old Alfresco compat
+ if (name.equals("ContentStreamURI") || name.equals("BaseType")) {
+ // Alfresco COMPAT
// see org.apache.chemistry.atompub.abdera.PropertiesElement
return;
}
- throw new ParseException("No such property definition: "
- + p.getName() + " in type: " + entryType);
+ throw new ParseException("No such property definition: " + name
+ + " in type: " + entryType);
}
p.setDefinition(def);
readProperty(ctx, reader, object, p);
Modified:
incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/PropertiesElement.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/PropertiesElement.java?rev=794290&r1=794289&r2=794290&view=diff
==============================================================================
---
incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/PropertiesElement.java
(original)
+++
incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/PropertiesElement.java
Wed Jul 15 14:41:38 2009
@@ -56,7 +56,7 @@
// don't merge these two lines as JDK 5 has problems compiling it
val.setText(contentStreamURI);
- // Alfresco compat (incorrect property name and type):
+ // Alfresco COMPAT (incorrect property name and type):
el = addExtension(CMIS.PROPERTY_STRING);
el.setAttributeValue(CMIS.NAME, "ContentStreamURI");
val = el.addExtension(CMIS.VALUE);
@@ -73,6 +73,16 @@
continue;
}
setProperty(values.get(name), propertyDefinition);
+
+ // Alfresco COMPAT (BaseType not in 0.6)
+ if (name.equals(Property.TYPE_ID)) {
+ // emit BaseType as well
+ ExtensibleElement el = addExtension(CMIS.PROPERTY_STRING);
+ el.setAttributeValue(CMIS.NAME, "BaseType");
+ Element val = el.addExtension(CMIS.VALUE);
+ // don't merge these two lines
+ val.setText(type.getBaseType().toString());
+ }
}
}