CMMN query for multiple business keys or names

Hello, is there any way with the Java API to query caseInstances for a list of multiple business keys and/or names? I see this can be done for case instance variable values, but I didn’t find a way to do it for business keys… the following code snippet doesn’t work, it only returns the last case instance of the list.

 var query = runtimeService.createCaseInstanceQuery().includeCaseVariables().or();
 documentIds.forEach(documentId -> query.caseInstanceBusinessKey(documentId));
 query.endOr();

I’m using version 6.7.2 with Spring Boot.

Wouldn’t

cmmnRuntimeService.createCaseInstanceQuery()
    .or()
        caseInstanceBusinessKey(somevalue)
    .endOr();

work?

Thanks for your reply. I just tried and it doesn’t work, it’s the same as the snippet I posted, it only takes into account the last value you give, it doesn’t seem to support multiple values.

Hmm, you’re right. The or() api’s only stores the latest value (that’s the case for all fields over all queries). The proper solution would be to add businessKeyIn(), which would be a nice contribution ;-).

Actually, for variable values it works, because AbstractVariableQueryImpl contains an ArrayList of variable values, which can be also different values of the same variable. But there is nothing like that for the business key and the name of the case instance.

@ErmannoRusso there is indeed a functionality missing for query for multiple business keys and names for a case instance. Would you like to provide a PR that will add this functionality?

Cheers,
Filip

Hi Filip, I don’t think I can yet, I’m quite new with the product and still getting familiar with it.
Maybe in the future if nobody else does it before me!