use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.
the class CaseDefinitionRestServiceImpl method getCaseDefinitionsCount.
@Override
public CountResultDto getCaseDefinitionsCount(UriInfo uriInfo) {
CaseDefinitionQueryDto queryDto = new CaseDefinitionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
ProcessEngine engine = getProcessEngine();
CaseDefinitionQuery query = queryDto.toQuery(engine);
long count = query.count();
CountResultDto result = new CountResultDto();
result.setCount(count);
return result;
}
use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.
the class CaseDefinitionRestServiceImpl method getCaseDefinitions.
@Override
public List<CaseDefinitionDto> getCaseDefinitions(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
CaseDefinitionQueryDto queryDto = new CaseDefinitionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
List<CaseDefinitionDto> definitions = new ArrayList<CaseDefinitionDto>();
ProcessEngine engine = getProcessEngine();
CaseDefinitionQuery query = queryDto.toQuery(engine);
List<CaseDefinition> matchingDefinitions = null;
if (firstResult != null || maxResults != null) {
matchingDefinitions = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingDefinitions = query.list();
}
for (CaseDefinition definition : matchingDefinitions) {
CaseDefinitionDto def = CaseDefinitionDto.fromCaseDefinition(definition);
definitions.add(def);
}
return definitions;
}
use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseDefinitionQueryTest method testQueryAuthenticatedTenant.
public void testQueryAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
assertThat(query.count(), is(2L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeCaseDefinitionsWithoutTenantId().count(), is(2L));
}
use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseDefinitionQueryTest method testQueryNoTenantIdSet.
public void testQueryNoTenantIdSet() {
CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
assertThat(query.count(), is(3L));
}
use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseDefinitionQueryTest method testQueryByLatestWithoutTenantId.
public void testQueryByLatestWithoutTenantId() {
// deploy a second version without tenant id
deployment(CMMN);
CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery().caseDefinitionKey(CASE_DEFINITION_KEY).latestVersion().withoutTenantId();
assertThat(query.count(), is(1L));
CaseDefinition cDefinition = query.singleResult();
assertThat(cDefinition.getTenantId(), is(nullValue()));
assertThat(cDefinition.getVersion(), is(2));
}
Aggregations