Hi,sorry if this is a repeated topic; I've found something similar but not exactly the same case. I'm writing a java client to integrate CMIS with my application. My createDocument method seems to work fine, I can see the document on Alfresco interface, but its size is 0 bytes, and the content is empty. Not sure if this is an Alfresco or CMIS issue (I'm working on Alfresco 3.3). Any suggestion would be welcomed…Code snipet:
BigInteger length = new BigInteger(new Long(IOUtils.toByteArray(is).length).toString());
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.NAME, documentName);
properties.put(PropertyIds.OBJECT_TYPE_ID, documentObjectType);
String mimeType = URLConnection.getFileNameMap().getContentTypeFor(documentName);
if (StringUtils.isEmpty(mimeType)) {
String extension = getDocumentExtension(documentName);
if (StringUtils.isEmpty(extension)) {
mimeType = "plain/text";
} else {
mimeType = "application/" + extension;
}
}
ContentStream content = new ContentStreamImpl(documentName, length, mimeType, is);
folder.createDocument(properties, content, VersioningState.NONE, null, null, null, getSession().getDefaultContext());
Thanks!