cancel
Showing results for 
Search instead for 
Did you mean: 

Java Client - get sub folders

Ghazi_HAKIM
Confirmed Champ
Confirmed Champ

Hello,

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 :

http://localhost:8080/nuxeo/api/v1/search/pp/tree_children/execute?currentPageIndex=0&pageSize=-1&so...

with this enricher in the request header : X-NXenrichers.document : hasFolderishChild

May be I can use the Java Client API to make this call ?

1 ACCEPTED ANSWER

Kevin_Leturc
Star Contributor
Star Contributor

Hello,

The 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.

View answer in original post

2 REPLIES 2

Kevin_Leturc
Star Contributor
Star Contributor

Hello,

The 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.

Jyothsna_SM1
Champ in-the-making
Champ in-the-making

Hi,

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);

Getting started

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.