Author: fmui
Date: Mon Sep 13 16:46:51 2010
New Revision: 996598
URL: http://svn.apache.org/viewvc?rev=996598&view=rev
Log:
- added more intelligent handling of the file name if getContentStream()
doesn't return it (the AtomPub binding cannot return a file name)
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentDocumentImpl.java
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentDocumentImpl.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentDocumentImpl.java?rev=996598&r1=996597&r2=996598&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentDocumentImpl.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentDocumentImpl.java
Mon Sep 13 16:46:51 2010
@@ -321,12 +321,19 @@ public class PersistentDocumentImpl exte
ContentStream contentStream =
getBinding().getObjectService().getContentStream(getRepositoryId(), objectId,
streamId, null, null, null);
+ // the AtomPub binding doesn't return a file name
+ // -> get the file name from properties, if present
+ String filename = contentStream.getFileName();
+ if (filename == null) {
+ filename = getContentStreamFileName();
+ }
+
// TODO: what should happen if the length is not set?
long length = (contentStream.getBigLength() == null ? -1 :
contentStream.getBigLength().longValue());
// convert and return stream object
- return
getSession().getObjectFactory().createContentStream(contentStream.getFileName(),
length,
- contentStream.getMimeType(), contentStream.getStream());
+ return getSession().getObjectFactory().createContentStream(filename,
length, contentStream.getMimeType(),
+ contentStream.getStream());
}
/*