-1

Good morning. I have a task to make a request that would find all the documents of a certain type. After receiving the result, I need to display the fields of all found documents in the table. How can I do that? Thanks for answers.

Kun Aguero
  • 25
  • 3
  • 2
    Welcome to SO, what did you try? Do you call the REST-API? Please show us your sourcecode. – cSteusloff Apr 11 '18 at 06:27
  • I'm trying to write a web script, but as soon as it came to writing a query there were problems) I recently in alfresco and Java so there are difficulties in the simplest situations – Kun Aguero Apr 11 '18 at 07:01
  • which sourcecode to show? – Kun Aguero Apr 11 '18 at 07:02
  • 1
    What problems do you have with writing the query? Please [edit] your question and include the relevant part of your model and the query you try. –  Apr 11 '18 at 07:20

2 Answers2

2

You can use Lucene query to find all folders of the specific type.

Vikash Patel
  • 1,328
  • 9
  • 28
2

To retrieve all documents of a certain type you can use Lucene query, this is a working example of query to get all nodes with type ipt:delegation using java.

    String query = "TYPE:\"ipt:delegation\"";
    SearchParameters sp = new SearchParameters();
    StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
    sp.addStore(storeRef);
    sp.setLanguage(SearchService.LANGUAGE_LUCENE);
    sp.setQuery(query);
    ResultSet results = null;
    try {
        results = searchService().query(sp);
        for (ResultSetRow row : results) {
            NodeRef nodeRef = row.getNodeRef();
        // do your work - 
        }
    }

And to retrieve document fields you can use nodeService.getProperties(nodeRef).

Oussama Werfelli
  • 513
  • 3
  • 14