Hi all,
I am writing a REST API extension to search and return current bpm data.
In current step, I use function [searchProcessInstances] to get all of current cases data, and then for each of it, use [searchHumanTaskInstances] get human task data.
The code is as below:
def processAPI = context.apiClient.processAPI
def identityAPI = context.apiClient.getIdentityAPI()
SearchOptionsBuilder processInstanceSearchOptionsBuilder = new SearchOptionsBuilder(0, 9999)
SearchOptions processInstanceSearchOptions = processInstanceSearchOptionsBuilder.done()
LOGGER.info(" - processInstanceSearchOptions(" + processInstanceSearchOptions.toString() + "): " + new JsonBuilder(processInstanceSearchOptions).toPrettyString())
def processInstanceResult = processAPI.searchProcessInstances(processInstanceSearchOptions)
LOGGER.info("searchResult: " + processInstanceResult.count)
int i = 1
for(def pi in processInstanceResult.result){
LOGGER.info(" Process Instance " + i.toString())
LOGGER.info(" - id: " + pi.id)
LOGGER.info(" - name: " + pi.name)
LOGGER.info(" - processDefinitionId: " + pi.processDefinitionId)
LOGGER.info(" - rootProcessInstanceId: " + pi.rootProcessInstanceId)
SearchOptionsBuilder humanTaskSearchOptionsBuilder = new SearchOptionsBuilder(0, 9999).filter(HumanTaskInstanceSearchDescriptor.ROOT_PROCESS_INSTANCE_ID, pi.rootProcessInstanceId)
SearchOptions humanTaskSearchOptions = humanTaskSearchOptionsBuilder.done()
LOGGER.info(" - humanTaskOptions(" + humanTaskSearchOptions.toString() + "): " + new JsonBuilder(humanTaskSearchOptions).toPrettyString())
def humanTaskResult = processAPI.searchHumanTaskInstances(humanTaskSearchOptions)
LOGGER.info(" - humanTask: " + new JsonBuilder(humanTaskResult.result).toPrettyString())
i+=1
}
For some reason, [searchProcessInstances] run normally, but [searchHumanTaskInstances] return error below:
26-Oct-2021 13:40:17.719 SEVERE [http-nio-59788-exec-4] org.bonitasoft.console.common.server.page.RestApiRenderer.renderResponse Error when executing rest api extension call to apiExtension|GET|summaryByCase
groovy.lang.MissingMethodException: No signature of method: com.sun.proxy.$Proxy122.searchHumanTaskInstances() is applicable for argument types: (org.bonitasoft.engine.search.impl.SearchOptionsImpl) values: [org.bonitasoft.engine.search.impl.SearchOptionsImpl@f8086bbf]
Possible solutions: searchHumanTaskInstances(org.bonitasoft.engine.search.SearchOptions)
I am using Community version of BonitaSoft. Is this the reason these function is not supported?
Thanks in advance,
EDIT: I also call 2 function to get user and user membership data from StartBy field, after block the above error code.
def user = identityAPI.getUser(processInstance.startedBy) def userMemberships = identityAPI.getUserMemberships(processInstance.startedBy, startIndex, maxResults, UserMembershipCriterion.GROUP_NAME_ASC)
Function [getUser] run normally, but [getUserMemberships] throw error below:
26-Oct-2021 16:52:15.505 SEVERE [http-nio-59788-exec-10] org.bonitasoft.console.common.server.page.RestApiRenderer.renderResponse Error when executing rest api extension call to apiExtension|GET|summaryByCase
groovy.lang.MissingMethodException: No signature of method: com.sun.proxy.$Proxy121.getUserMemberships() is applicable for argument types: (java.lang.Long, java.lang.Integer, java.lang.Integer, org.bonitasoft.engine.identity.UserMembershipCriterion) values: [878, 0, 2147483647, GROUP_NAME_ASC]
Possible solutions: getUserMemberships(long, int, int, org.bonitasoft.engine.identity.UserMembershipCriterion), getUserMembership(long)