Permalink
Browse files

fixed CMIS-164

git-svn-id: https://svn.apache.org/repos/asf/incubator/chemistry/trunk@925796 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 8c64d0e commit 6a75b0843f8ee96be901a55360aa144c76ca317b @fmui fmui committed Mar 21, 2010
@@ -136,13 +136,15 @@ public void writeAuthor(String author) throws XMLStreamException {
* Writes an Atom updated tag.
*/
public void writeUpdated(GregorianCalendar updated) throws XMLStreamException {
+ writeSimpleDate(Constants.NAMESPACE_APP, "edited", updated);
writeSimpleDate(Constants.NAMESPACE_ATOM, "updated", updated);
}
/**
* Writes an Atom updated tag.
*/
public void writeUpdated(long updated) throws XMLStreamException {
+ writeSimpleDate(Constants.NAMESPACE_APP, "edited", updated);
writeSimpleDate(Constants.NAMESPACE_ATOM, "updated", updated);
}
@@ -65,6 +65,7 @@ public void startEntry(boolean isRoot) throws XMLStreamException {
writeNamespace(Constants.NAMESPACE_ATOM);
writeNamespace(Constants.NAMESPACE_CMIS);
writeNamespace(Constants.NAMESPACE_RESTATOM);
+ writeNamespace(Constants.NAMESPACE_APP);
}
}
@@ -41,13 +41,16 @@
import org.apache.opencmis.commons.impl.Converter;
import org.apache.opencmis.commons.impl.JaxBHelper;
import org.apache.opencmis.commons.impl.dataobjects.ContentStreamDataImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertiesDataImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertyStringDataImpl;
import org.apache.opencmis.commons.impl.jaxb.CmisObjectType;
import org.apache.opencmis.commons.provider.AccessControlList;
import org.apache.opencmis.commons.provider.ContentStreamData;
import org.apache.opencmis.commons.provider.ObjectData;
import org.apache.opencmis.commons.provider.PropertiesData;
import org.apache.opencmis.commons.provider.PropertyData;
import org.apache.opencmis.commons.provider.PropertyIdData;
+import org.apache.opencmis.commons.provider.PropertyStringData;
/**
* Parser for Atom Entries.
@@ -58,6 +61,7 @@
public class AtomEntryParser {
private final static String TAG_ENTRY = "entry";
+ private final static String TAG_TITLE = "title";
private final static String TAG_OBJECT = "object";
private final static String TAG_CONTENT = "content";
private final static String TAG_BASE64 = "base64";
@@ -186,6 +190,8 @@ public void parse(InputStream stream) throws Exception {
* Parses an Atom entry.
*/
private void parseEntry(XMLStreamReader parser) throws Exception {
+ String atomTitle = null;
+
next(parser);
// walk through all tags in entry
@@ -209,6 +215,9 @@ else if (Constants.NAMESPACE_ATOM.equals(name.getNamespaceURI())) {
if (TAG_CONTENT.equals(name.getLocalPart())) {
parseAtomContent(parser);
}
+ else if (TAG_TITLE.equals(name.getLocalPart())) {
+ atomTitle = readText(parser);
+ }
else {
skip(parser);
}
@@ -226,6 +235,12 @@ else if (event == XMLStreamReader.END_ELEMENT) {
}
}
}
+
+ // overwrite cmis:name with Atom title
+ if ((fObject != null) && (fObject.getProperties() != null) && (atomTitle != null)) {
+ PropertyStringData nameProperty = new PropertyStringDataImpl(PropertyIds.CMIS_NAME, atomTitle);
+ ((PropertiesDataImpl) fObject.getProperties()).addProperty(nameProperty);
+ }
}
/**
Oops, something went wrong.

0 comments on commit 6a75b08

Please sign in to comment.