Complex field cannot be updated?

kapelan_
Champ in-the-making
Champ in-the-making

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?

1 REPLY 1

Vladimir_Pasqui
Star Collaborator
Star Collaborator

Hi,