use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class CaseInstanceRestServiceImpl method queryCaseInstances.
public List<CaseInstanceDto> queryCaseInstances(CaseInstanceQueryDto queryDto, Integer firstResult, Integer maxResults) {
ProcessEngine engine = getProcessEngine();
queryDto.setObjectMapper(getObjectMapper());
CaseInstanceQuery query = queryDto.toQuery(engine);
List<CaseInstance> matchingInstances;
if (firstResult != null || maxResults != null) {
matchingInstances = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingInstances = query.list();
}
List<CaseInstanceDto> instanceResults = new ArrayList<CaseInstanceDto>();
for (CaseInstance instance : matchingInstances) {
CaseInstanceDto resultInstance = CaseInstanceDto.fromCaseInstance(instance);
instanceResults.add(resultInstance);
}
return instanceResults;
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessEngineRestServiceTest method createCaseInstanceMock.
private void createCaseInstanceMock() {
List<CaseInstance> caseInstances = new ArrayList<CaseInstance>();
CaseInstance mockCaseInstance = MockProvider.createMockCaseInstance();
caseInstances.add(mockCaseInstance);
CaseInstanceQuery mockCaseInstanceQuery = mock(CaseInstanceQuery.class);
when(mockCaseInstanceQuery.list()).thenReturn(caseInstances);
when(mockCaseService.createCaseInstanceQuery()).thenReturn(mockCaseInstanceQuery);
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class CaseInstanceRestServiceQueryTest method setUpMockCaseInstanceQuery.
private CaseInstanceQuery setUpMockCaseInstanceQuery(List<CaseInstance> mockedCaseInstances) {
CaseInstanceQuery query = mock(CaseInstanceQuery.class);
when(query.list()).thenReturn(mockedCaseInstances);
when(query.count()).thenReturn((long) mockedCaseInstances.size());
when(processEngine.getCaseService().createCaseInstanceQuery()).thenReturn(query);
return query;
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseInstanceQueryTest method testQueryNoAuthenticatedTenants.
public void testQueryNoAuthenticatedTenants() {
identityService.setAuthentication("user", null, null);
CaseInstanceQuery query = caseService.createCaseInstanceQuery();
assertThat(query.count(), is(1L));
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseInstanceQueryTest method testQueryNoTenantIdSet.
public void testQueryNoTenantIdSet() {
CaseInstanceQuery query = caseService.createCaseInstanceQuery();
assertThat(query.count(), is(3L));
}
Aggregations