本文整理汇总了Java中org.camunda.bpm.engine.repository.CaseDefinitionQuery类的典型用法代码示例。如果您正苦于以下问题:Java CaseDefinitionQuery类的具体用法?Java CaseDefinitionQuery怎么用?Java CaseDefinitionQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CaseDefinitionQuery类属于org.camunda.bpm.engine.repository包,在下文中一共展示了CaseDefinitionQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testQueryByTenantIdsIncludeDefinitionsWithoutTenantId
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
public void testQueryByTenantIdsIncludeDefinitionsWithoutTenantId() {
CaseDefinitionQuery query = repositoryService
.createCaseDefinitionQuery()
.tenantIdIn(TENANT_ONE)
.includeCaseDefinitionsWithoutTenantId();
assertThat(query.count(), is(2L));
query = repositoryService
.createCaseDefinitionQuery()
.tenantIdIn(TENANT_TWO)
.includeCaseDefinitionsWithoutTenantId();
assertThat(query.count(), is(2L));
query = repositoryService
.createCaseDefinitionQuery()
.tenantIdIn(TENANT_ONE, TENANT_TWO)
.includeCaseDefinitionsWithoutTenantId();
assertThat(query.count(), is(3L));
}
示例2: testQueryByKey
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
public void testQueryByKey() {
CaseDefinitionQuery query = repositoryService
.createCaseDefinitionQuery()
.caseDefinitionKey(CASE_DEFINITION_KEY);
// one definition for each tenant
assertThat(query.count(), is(3L));
query = repositoryService
.createCaseDefinitionQuery()
.caseDefinitionKey(CASE_DEFINITION_KEY)
.withoutTenantId();
// one definition without tenant id
assertThat(query.count(), is(1L));
query = repositoryService
.createCaseDefinitionQuery()
.caseDefinitionKey(CASE_DEFINITION_KEY)
.tenantIdIn(TENANT_ONE);
// one definition for tenant one
assertThat(query.count(), is(1L));
}
示例3: testQueryByLatestNoTenantIdSet
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
public void testQueryByLatestNoTenantIdSet() {
// deploy a second version for tenant one
deploymentForTenant(TENANT_ONE, CMMN);
CaseDefinitionQuery query = repositoryService
.createCaseDefinitionQuery()
.caseDefinitionKey(CASE_DEFINITION_KEY)
.latestVersion();
// one definition for each tenant
assertThat(query.count(), is(3L));
Map<String, CaseDefinition> caseDefinitionsForTenant = getCaseDefinitionsForTenant(query.list());
assertThat(caseDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
assertThat(caseDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
assertThat(caseDefinitionsForTenant.get(null).getVersion(), is(1));
}
示例4: testQueryByLatestWithTenantIds
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
public void testQueryByLatestWithTenantIds() {
// deploy a second version for tenant one
deploymentForTenant(TENANT_ONE, CMMN);
CaseDefinitionQuery query = repositoryService
.createCaseDefinitionQuery()
.caseDefinitionKey(CASE_DEFINITION_KEY)
.latestVersion()
.tenantIdIn(TENANT_ONE, TENANT_TWO);
// one definition for each tenant
assertThat(query.count(), is(2L));
Map<String, CaseDefinition> caseDefinitionsForTenant = getCaseDefinitionsForTenant(query.list());
assertThat(caseDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
assertThat(caseDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
}
示例5: testQueryByLatestWithoutTenantId
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
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));
}
示例6: testQueryByLatestWithTenantIdsIncludeDefinitionsWithoutTenantId
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
public void testQueryByLatestWithTenantIdsIncludeDefinitionsWithoutTenantId() {
// deploy a second version without tenant id
deployment(CMMN);
// deploy a third version for tenant one
deploymentForTenant(TENANT_ONE, CMMN);
deploymentForTenant(TENANT_ONE, CMMN);
CaseDefinitionQuery query = repositoryService
.createCaseDefinitionQuery()
.caseDefinitionKey(CASE_DEFINITION_KEY)
.latestVersion()
.tenantIdIn(TENANT_ONE, TENANT_TWO)
.includeCaseDefinitionsWithoutTenantId();
assertThat(query.count(), is(3L));
Map<String, CaseDefinition> caseDefinitionsForTenant = getCaseDefinitionsForTenant(query.list());
assertThat(caseDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(3));
assertThat(caseDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
assertThat(caseDefinitionsForTenant.get(null).getVersion(), is(2));
}
示例7: testQueryByLatest
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
public void testQueryByLatest() {
CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
query
.latestVersion();
verifyQueryResults(query, 3);
query
.caseDefinitionKey("one")
.latestVersion();
verifyQueryResults(query, 1);
query
.caseDefinitionKey("two").latestVersion();
verifyQueryResults(query, 1);
}
示例8: applySortBy
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
@Override
protected void applySortBy(CaseDefinitionQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_CATEGORY_VALUE)) {
query.orderByCaseDefinitionCategory();
} else if (sortBy.equals(SORT_BY_KEY_VALUE)) {
query.orderByCaseDefinitionKey();
} else if (sortBy.equals(SORT_BY_ID_VALUE)) {
query.orderByCaseDefinitionId();
} else if (sortBy.equals(SORT_BY_VERSION_VALUE)) {
query.orderByCaseDefinitionVersion();
} else if (sortBy.equals(SORT_BY_NAME_VALUE)) {
query.orderByCaseDefinitionName();
} else if (sortBy.equals(SORT_BY_DEPLOYMENT_ID_VALUE)) {
query.orderByDeploymentId();
} else if (sortBy.equals(SORT_BY_TENANT_ID)) {
query.orderByTenantId();
}
}
示例9: getCaseDefinitions
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
@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;
}
示例10: setUpRuntimeData
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
private void setUpRuntimeData(CaseDefinition mockCaseDefinition) {
repositoryServiceMock = mock(RepositoryService.class);
when(processEngine.getRepositoryService()).thenReturn(repositoryServiceMock);
when(repositoryServiceMock.getCaseDefinition(eq(MockProvider.EXAMPLE_CASE_DEFINITION_ID))).thenReturn(mockCaseDefinition);
when(repositoryServiceMock.getCaseModel(eq(MockProvider.EXAMPLE_CASE_DEFINITION_ID))).thenReturn(createMockCaseDefinitionCmmnXml());
caseDefinitionQueryMock = mock(CaseDefinitionQuery.class);
when(caseDefinitionQueryMock.caseDefinitionKey(MockProvider.EXAMPLE_CASE_DEFINITION_KEY)).thenReturn(caseDefinitionQueryMock);
when(caseDefinitionQueryMock.tenantIdIn(anyString())).thenReturn(caseDefinitionQueryMock);
when(caseDefinitionQueryMock.withoutTenantId()).thenReturn(caseDefinitionQueryMock);
when(caseDefinitionQueryMock.latestVersion()).thenReturn(caseDefinitionQueryMock);
when(caseDefinitionQueryMock.singleResult()).thenReturn(mockCaseDefinition);
when(caseDefinitionQueryMock.list()).thenReturn(Collections.singletonList(mockCaseDefinition));
when(repositoryServiceMock.createCaseDefinitionQuery()).thenReturn(caseDefinitionQueryMock);
}
示例11: testQueryByTenantId
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
public void testQueryByTenantId() {
CaseDefinitionQuery query = repositoryService
.createCaseDefinitionQuery()
.tenantIdIn(TENANT_ONE);
assertThat(query.count(), is(1L));
query = repositoryService.
createCaseDefinitionQuery()
.tenantIdIn(TENANT_TWO);
assertThat(query.count(), is(1L));
}
示例12: testQueryByTenantIds
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
public void testQueryByTenantIds() {
CaseDefinitionQuery query = repositoryService
.createCaseDefinitionQuery()
.tenantIdIn(TENANT_ONE, TENANT_TWO);
assertThat(query.count(), is(2L));
}
示例13: testQueryByLatestWithTenantId
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
public void testQueryByLatestWithTenantId() {
// deploy a second version for tenant one
deploymentForTenant(TENANT_ONE, CMMN);
CaseDefinitionQuery query = repositoryService
.createCaseDefinitionQuery()
.caseDefinitionKey(CASE_DEFINITION_KEY)
.latestVersion()
.tenantIdIn(TENANT_ONE);
assertThat(query.count(), is(1L));
CaseDefinition caseDefinition = query.singleResult();
assertThat(caseDefinition.getTenantId(), is(TENANT_ONE));
assertThat(caseDefinition.getVersion(), is(2));
query = repositoryService
.createCaseDefinitionQuery()
.caseDefinitionKey(CASE_DEFINITION_KEY)
.latestVersion()
.tenantIdIn(TENANT_TWO);
assertThat(query.count(), is(1L));
caseDefinition = query.singleResult();
assertThat(caseDefinition.getTenantId(), is(TENANT_TWO));
assertThat(caseDefinition.getVersion(), is(1));
}
示例14: testQueryByNonExistingTenantId
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
public void testQueryByNonExistingTenantId() {
CaseDefinitionQuery query = repositoryService
.createCaseDefinitionQuery()
.tenantIdIn("nonExisting");
assertThat(query.count(), is(0L));
}
示例15: testQueryAuthenticatedTenant
import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //导入依赖的package包/类
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));
}