12-10-2013 09:16 PM
I'm trying to update document's metadata by using Nuxeo Automation Java Client. It's working on SimpleType fields but every try on complexType fields failed. I red it is possible by updating a document with the JSON values. So I tried example code:
// Fetch the document
Document document = (Document) session.newRequest(DocumentService.GetDocumentChild).setInput(new PathRef("/")).set("name", "testDoc").execute();
// Send the fields representation as json
// Read the json file
File fieldAsJsonFile = FileUtils.getResourceFileFromContext("creation.json");
String fieldsDataAsJSon = FileUtils.readFile(fieldAsJsonFile);
// Don't forget to replace CRLF or LF
fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\n", "");
fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\r", "");
// Set the json values to the related metadata
document.set("ds:fields", fieldsDataAsJSon);
// Document Update
session.newRequest(UpdateDocument.ID).setInput(document).set("properties",document).execute();
Server is sending me back a message: "Property not found: ds:fields". Probably I'm using it wrong, but someone can tell how I should work with it properly?
12-12-2013 06:17 AM
Hi,
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.