Complex field cannot be updated?

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?

0 votes

0 answers

994 views

ANSWER

Hi,

It seems that the problem comes from your document fetched at the beginning, which doesn't contain any schema with ds:fields property.

12/12/2013