use of org.camunda.bpm.engine.runtime.ExecutionQuery in project camunda-bpm-platform by camunda.
the class ExecutionRestServiceImpl method queryExecutionsCount.
@Override
public CountResultDto queryExecutionsCount(ExecutionQueryDto queryDto) {
ProcessEngine engine = getProcessEngine();
queryDto.setObjectMapper(getObjectMapper());
ExecutionQuery query = queryDto.toQuery(engine);
long count = query.count();
CountResultDto result = new CountResultDto();
result.setCount(count);
return result;
}
use of org.camunda.bpm.engine.runtime.ExecutionQuery in project camunda-bpm-platform by camunda.
the class ExecutionRestServiceQueryTest method setUpMockExecutionQuery.
private ExecutionQuery setUpMockExecutionQuery(List<Execution> mockedExecutions) {
ExecutionQuery sampleExecutionQuery = mock(ExecutionQuery.class);
when(sampleExecutionQuery.list()).thenReturn(mockedExecutions);
when(sampleExecutionQuery.count()).thenReturn((long) mockedExecutions.size());
when(processEngine.getRuntimeService().createExecutionQuery()).thenReturn(sampleExecutionQuery);
return sampleExecutionQuery;
}
use of org.camunda.bpm.engine.runtime.ExecutionQuery in project camunda-bpm-platform by camunda.
the class ExecutionAuthorizationTest method testQueryWithReadInstancesPermissionOnOneTaskProcess.
public void testQueryWithReadInstancesPermissionOnOneTaskProcess() {
// given
startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
startProcessInstanceByKey(MESSAGE_BOUNDARY_PROCESS_KEY);
startProcessInstanceByKey(MESSAGE_BOUNDARY_PROCESS_KEY);
startProcessInstanceByKey(MESSAGE_BOUNDARY_PROCESS_KEY);
startProcessInstanceByKey(MESSAGE_BOUNDARY_PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY, userId, READ_INSTANCE);
// when
ExecutionQuery query = runtimeService.createExecutionQuery();
// then
verifyQueryResults(query, 3);
}
use of org.camunda.bpm.engine.runtime.ExecutionQuery in project camunda-bpm-platform by camunda.
the class ExecutionAuthorizationTest method testSimpleQueryWithMultiple.
public void testSimpleQueryWithMultiple() {
// given
String processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, READ);
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);
// when
ExecutionQuery query = runtimeService.createExecutionQuery();
// then
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.runtime.ExecutionQuery in project camunda-bpm-platform by camunda.
the class ExecutionAuthorizationTest method testSimpleQueryWithoutAuthorization.
public void testSimpleQueryWithoutAuthorization() {
// given
startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
// when
ExecutionQuery query = runtimeService.createExecutionQuery();
// then
verifyQueryResults(query, 0);
}
Aggregations