Nuxeo-android-connector and custom schema

Hi,

thanks a lot for this complex plateform, make it simpler to build them all.

I try to connect my android application with Nuxeo Plateform 5.6

I would like to retrieve my custom schema attribute and don't find how to do that.

        DocumentService rs = new DocumentService(session);
        DocRef wsRef = new DocRef("/default-domain/workspaces/mypublicws");
        docs = rs.getChildren(wsRef);
        for (Iterator iterator = docs.iterator(); iterator.hasNext();) {
            Document document = (Document) iterator.next();
            PropertyMap map = document.getProperties();

            Log.i("Public Hut", document.getTitle() + "--" + map.getString("vendorseed:datesowingmin"));
        }

The PropertyMap result does not contain my custom attributes even during debug phase.

THE QUESTION IS: How to get my custom schema properties (maybe called metadata ?).

nuxeo-android-connector version:

<dependency>
  <groupId>org.nuxeo.android</groupId>
  <artifactId>nuxeo-android-connector</artifactId>
  <version>2.0-SNAPSHOT</version>
</dependency>

Thanks in advance

0 votes

1 answers

2458 views

ANSWER



Hi,

By default, only the minimal document properties are returned. You can ask for more mapped properties by specifying the wanted schemas in the header (or “*” to get all):

import org.nuxeo.ecm.automation.client.Constants;
import org.nuxeo.ecm.automation.client.adapters.DocumentService;
import org.nuxeo.ecm.automation.client.model.Documents;
Documents docs = (Documents) session.newRequest(DocumentService.GetDocumentChildren)
        .setInput(doc)
        .setHeader(Constants.HEADER_NX_SCHEMAS, "*").execute();

See org.nuxeo.ecm.automation.client.Constants.HEADER_NX_SCHEMAS.
Since 5.7, it is possible to change the default schemas for the whole session instead of per request, see org.nuxeo.ecm.automation.client.Session.setDefaultSchemas(String).

1 votes



Thanks a lot,

that is the kind of problem which make me spent a lot of time, with a simpler answer.

My problem is solved, Thanks to you and nuxeo-android contributors

03/13/2013