I have two process instance and thats not been ended. But i can search them by runtimeService and historyService. At the before I think just the ended process instance can searched by the hisotryService. I am wrong or the camunda wrong?
Here is my code
public ResponseEntity<Map<String, Object>> getRecords(PageAndSize pageAndSize) {
User user = userService.getCurrentUser();
List<ProcessInstance> instances = runtimeService.
createProcessInstanceQuery()
.variableValueEquals(
SignUpProjectProcessCommonConstants.
VAR_APPLICANT_ID,
String.valueOf(user.getId())
).list();
List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery()
.variableValueEquals(
SignUpProjectProcessCommonConstants.
VAR_APPLICANT_ID,
String.valueOf(user.getId())
).list();
List<String> ids = instances.stream().map(Execution::getId).collect(Collectors.toList());
ids.addAll(historicProcessInstances.stream().map(HistoricProcessInstance::getId).collect(Collectors.toList()));
List<ProjectApplicationRecord2VO> voList = toVO(ids, false);
Page page = PageableUtil.getPage(pageAndSize, voList);
return new ResponseEntity<>(PageableUtil.resolvePage(page), HttpStatus.OK);
}
And here is the process instances
Please help me. Thanks you all.