06-09-2008 06:19 AM
07-22-2009 04:36 AM
07-22-2009 11:58 AM
08-11-2009 10:02 AM
public Reference updateFile(String uuid, String fileName, byte[] bytes){
Content content = new Content();
try {
content = findContentWithUUID(uuid);
// Set content
Reference reference = content.getNode();
NamedValue[] properties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, fileName)};
CMLUpdate update = new CMLUpdate(properties, new Predicate(
new Reference[] { reference }, STORE, null), "id2");
CMLAddAspect addAspect = new CMLAddAspect(Constants.ASPECT_VERSIONABLE, null, new Predicate(
new Reference[] { reference }, STORE, null), "id1");
CML cml = new CML();
cml.setUpdate(new CMLUpdate[]{update});
cml.setAddAspect(new CMLAddAspect[]{addAspect});
//update document properties name
UpdateResult[] updateResults = getRepositoryService().update(cml);
ContentFormat format = new ContentFormat(
findMimeType(fileName.substring(fileName.lastIndexOf(".")+1)), "UTF-8");
//update the content of document
Content content2 = getContentService().write(content.getNode(), Constants.PROP_CONTENT, bytes, format);
System.out.println(content2.getLength() + fileName + " updated…");
} catch (Exception e) {
e.printStackTrace();
}
return reference;
}
02-23-2010 09:56 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.