Retrieve all tasks with their BDM values in one API

1
0
-1

Hey,

I have a list of tasks (~1000) and I'm trying to sort them with respect to their BDM values and a comparator function. For this, I'm iterating through each task, through an API for each task I'm retrieving it's BDM data, and with respect to this I'm sorting it. This takes a lot of time and is not practical. Is there a way I can decrease the number of API calls, get all tasks with their BDM values in one API call itself which could help me out?

Thanks!

1 answer

1
0
-1

Hello,

Multiple way to do that.

First, let's assume that you do this operation server side, in a REST API Extension for example, or via a JAVA program. using the standard REST API, you don't have any solution.

In the JAVA, you can access the JAVA API.

Then, using a SearchOptionsBuilder, you can get in one SQL request all the tasks you look for (the 1000).

Then, having the task, you have to load the BDM.

Multiple options:

* you saved in the BDM a column "caseId". You have the list of task, then the list of cases. You can load in one request all the BDM (you have to create a new custom query, findByCasesID, with parameters "listOfCase" - the default query "findByCaseId" will return only one BDM)

* option: you can access the BDM database directly in JAVA and build your own SQL Query to get only the attribut you want

You didn't saved in the BDM the caseID.

So, you have to load case by case the BDM information. You have no choice to access, case per case, the BDM variables (it's persistenceID), then after you can load in one request all BDM.

You can have a look in the LongBoad page (https://github.com/Bonitasoft-Community/page_longboard) and here (https://github.com/Bonitasoft-Community/page_longboard/blob/master/src/main/java/com/bonitasoft/custompage/longboard/casehistory/CaseHistory.java:1847) the piece of code to load a BDM variable from a CaseID.

Hope this help

Notifications