Skip to content

Commit

Permalink
[ACA-4057] Edit getProcessInstanceByName method to search the process…
Browse files Browse the repository at this point in the history
… instance directly by its name (#6303)

* Add size value to getProcessInstanceByName

* edit getProcessInstanceByName method to search the process instance directly by its name

* add more options for filtering the list
  • Loading branch information
Iulia Burcă committed Nov 4, 2020
1 parent 5f76a7c commit fff574c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/testing/src/lib/process-services/actions/process.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,11 @@ export class ProcessUtil {
}
}

async getProcessInstanceByName(processInstanceName: string): Promise<any> {
async getProcessInstanceByName(processInstanceName: string, processInstanceStatus?: string, maxNumberOfResults?: number): Promise<any> {
try {
const processInstanceList = await this.api.apiService.activiti.processApi.getProcessInstances({state: 'all'});
const chosenProcessInstance = processInstanceList.data.find( (processInstanace) => {
return processInstanace.name === processInstanceName;
});
return chosenProcessInstance;
return await this.api.apiService.activiti.processApi.filterProcessInstances({filter: {name: processInstanceName, state: processInstanceStatus}, size: maxNumberOfResults});
} catch (error) {
Logger.error('Get Process Instance by Name - Service error, Response: ', JSON.parse(JSON.stringify(error)));
Logger.error('List process instances using a filter - Service error, Response: ', JSON.parse(JSON.stringify(error)));
}
}

Expand Down

0 comments on commit fff574c

Please sign in to comment.