BS-11333 : For the monitoring, need to get the number of open process instances by process definition

- Fix the search on the CaseDatastore for the failed cases, to use the ProcessInstanceState to filter on the state