cancel
Showing results for 
Search instead for 
Did you mean: 

How to get all the active and inactive running process instance ids.

former_member186748
Participant
0 Kudos

Hi,

We have a requirement where we need to generate report based on Statuses READY, IN_PROGRESS, RESERVED tasks.

I have below code, which is not giving the READY task.

TaskAbstractQueryCriteria c2 = new TaskAbstractStatusCriteria(Status.READY);

TaskAbstractQueryCriteria c3 = new TaskAbstractStatusCriteria(Status.RESERVED);

TaskAbstractQueryCriteria c4 = new TaskAbstractStatusCriteria(Status.IN_PROGRESS);

QueryResultParameters qrp = new QueryResultParameters();

qrp.setFirstResult(0);

List<TaskAbstract> lstTaskAbstract = taskInstanceManager.getTaskAbstractsByLogonID(usrKey, qrp, c2, c3, c4);

A task can be assigned to more than one person, how can getTaskAbstractsByLogonID() will behave when the task status is in READY.

If the above code gives READY tasks, my problem resolves.

Another approach...

Get all the running processes instance Ids and from there using taskInstanceManager.getTaskAbstractsByParent(processInstanceId, statuses) this, we can achieve.

But using the below code I am getting only the activeProcess.

ProcessDefinitionManager proDefManager = BPMFactory.getProcessDefinitionManager();

ProcessDefinition proDefinition = proDefManager.getActiveProcessDefinition("Vendor", "DC Name", "Process Name");

Collection<ProcessInstance> proInstCollection = proInstanceManager.getRunningProcessInstances(proDefinition.getId());

But I need all the running process, the way they show in NWA, irrespective of active or inactive(because of some changes process might have deployed, then previous process will become inactive) using api.

Any help is appreciated.

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

I met the same requirement like your second approach,

what I did was: create a job which regularly check the current active process definition and store it in a customized db table if not stored before.

next time when you want to retrieve all the running process which requires process definition(active/inactive), you can get all process definition from your db table.

former_member186748
Participant
0 Kudos

Jun,

Your idea sounds great.

I have found something in API, where I can get all the active and inactive process details between fromDate and toDate.

ProcessInstanceManager processInstanceManager = BPMFactory.getProcessInstanceManager();

List<ProcessInstance> lstProcessInstances = processInstanceManager.getProcessInstances(null, new ProcessInstanceFilterCriteria(

ProcessInstanceProperty.START_DATE, ProcessInstanceFilterOperator.FROM, fromDate), new ProcessInstanceFilterCriteria(

ProcessInstanceProperty.START_DATE, ProcessInstanceFilterOperator.TO, toDate), new ProcessInstanceFilterCriteria(
ProcessInstanceProperty.STATUS, ProcessInstanceFilterOperator.EQUALS, ProcessStatus.IN_PROGRESS));

Once I get the processInstanceId, using getTaskAbstractsByParent I am getting all the READY tasks.

Thanks

junwu
Active Contributor
0 Kudos

cool, good to know that.

when I design my solution, it was for 7.31 sp8, we don't have that api.