Java Client - get sub folders
Is there a method to get the subfolder list of a folder by its id ? I found the repository().fetchChildrenById(id) method but it returns all documents (documents and folders). In the UI, nuxeo is calling this url when we disclose a node in the tree :
with this enricher in the request header : X-NXenrichers.document : hasFolderishChild
May be I can use the Java Client API to make this call ?
fetchChildrenById is designed to return all kind of documents, it calls the
@children web adapter server side.
The url you give is a call to the
tree_children page provider. You can request a page provider with the java client with
Repository#queryByProvider API. In your context, the call to do would be something like below:
repository().enrichersForDocument("hasFolderishChild") .queryByProvider("tree_children", "-1", "0", "", "", "", "FOLDER_ID");
Note: the java client is still using the query endpoint API which has been deprecated. We've planned to use search endpoint instead JAVACLIENT-178.
You can get the sub-folders of a particular workspace/folder with this query
nuxeoClient.repository() .query(“SELECT * FROM Document WHERE ecm:parentId = ? AND ecm:isTrashed = 0 AND ecm:mixinType = 'Folderish' “,pageSize, pageNumber, null, “dc:title”, “DESC”, parentId);