本文整理汇总了Java中org.camunda.bpm.engine.repository.ProcessDefinitionQuery类的典型用法代码示例。如果您正苦于以下问题:Java ProcessDefinitionQuery类的具体用法?Java ProcessDefinitionQuery怎么用?Java ProcessDefinitionQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessDefinitionQuery类属于org.camunda.bpm.engine.repository包,在下文中一共展示了ProcessDefinitionQuery类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: list
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
/**
* Gets currently active process definitions
*
* @return {@link} of process definitions
*/
public Result<WorkflowDto> list() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery()
.active()
.orderByProcessDefinitionName()
.asc()
.latestVersion();
List<ProcessDefinition> workflows = query.list();
List<WorkflowDto> dtos = workflows.stream()
.map(workflow -> new WorkflowDto(
workflow.getId(),
workflow.getKey(),
workflow.getName(),
workflow.getDescription()
))
.collect(Collectors.toList());
Result<WorkflowDto> result = new Result<>();
result.setCount(query.count());
result.setItems(dtos);
return result;
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:31,代码来源:WorkflowList.java
示例2: shouldReturnLatestProcessDefinition
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Ignore
@Test
public void shouldReturnLatestProcessDefinition() {
// given
String processDefinitionKey = "processDefinitionKey";
String processVersionTag = "processVersionTag";
ProcessDefinition processDefinitionMock = mock(ProcessDefinition.class);
ProcessDefinitionQuery processDefinitionQueryMock = mock(ProcessDefinitionQuery.class);
// Query<ProcessDefinitionQuery, ProcessDefinition> processDefinitionQueryMock = (Query<ProcessDefinitionQuery, ProcessDefinition>) mock(Query.class);
when(repositoryServiceMock.createProcessDefinitionQuery()
.processDefinitionKey(processDefinitionKey)
.versionTag(processVersionTag)
.orderByProcessDefinitionId()
.desc()).thenReturn(processDefinitionQueryMock);
when(processDefinitionQueryMock.list()).thenReturn(Collections.singletonList(processDefinitionMock));
// when
ProcessDefinition processDefinition = processDefinitionService.fetchLatestProcessDefinitionByKeyAndVersionTag(processDefinitionKey, processVersionTag);
// then
assertThat(processDefinition, equalTo(processDefinitionMock));
}
开发者ID:satspeedy,项目名称:camunda-migrator,代码行数:26,代码来源:ProcessDefinitionServiceTest.java
示例3: shouldReturnProcessDefinitions
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Ignore
@Test
public void shouldReturnProcessDefinitions() {
// given
String processDefinitionKey = "processDefinitionKey";
String processVersionTag = "processVersionTag";
ProcessDefinition processDefinitionMock = mock(ProcessDefinition.class);
ProcessDefinition processDefinition2Mock = mock(ProcessDefinition.class);
ProcessDefinitionQuery processDefinitionQueryMock = mock(ProcessDefinitionQuery.class);
when(repositoryServiceMock.createProcessDefinitionQuery()
.processDefinitionKey(processDefinitionKey)
.versionTag(processVersionTag)
.orderByProcessDefinitionId()
.desc()).thenReturn(processDefinitionQueryMock);
when(processDefinitionQueryMock.list()).thenReturn(Arrays.asList(processDefinitionMock, processDefinition2Mock));
// when
final List<ProcessDefinition> processDefinitions = processDefinitionService.fetchProcessDefinitionsByKeyAndVersionTag(processDefinitionKey, processVersionTag);
// then
assertThat(processDefinitions, hasSize(2));
assertThat(processDefinitions, hasItems(processDefinitionMock, processDefinition2Mock));
}
开发者ID:satspeedy,项目名称:camunda-migrator,代码行数:26,代码来源:ProcessDefinitionServiceTest.java
示例4: find
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
public Optional<ProcessDefinition> find(ProcessDefinitionSpec spec) {
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
add(processDefinitionQuery, ProcessDefinitionQuery::processDefinitionKey, spec.getProcessDefinitionKey());
add(processDefinitionQuery, ProcessDefinitionQuery::versionTag, spec.getVersionTag());
add(processDefinitionQuery, ProcessDefinitionQuery::processDefinitionVersion, spec.getProcessDefinitionVersion());
if (spec.getDeploymentSpec() != null) {
Optional<Deployment> deployment = findDeployment(spec.getDeploymentSpec());
if (!deployment.isPresent()) {
return Optional.empty();
} else {
add(processDefinitionQuery, ProcessDefinitionQuery::deploymentId, deployment.get(), Deployment::getId);
}
}
return Optional.ofNullable(processDefinitionQuery.singleResult());
}
开发者ID:camunda,项目名称:camunda-bpm-migration,代码行数:19,代码来源:ProcessDefinitionFinder.java
示例5: testQueryByLatestAndName_NotFound
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
public void testQueryByLatestAndName_NotFound() {
String firstDeployment = repositoryService
.createDeployment()
.addClasspathResource("org/camunda/bpm/engine/test/api/repository/first-process.bpmn20.xml")
.deploy()
.getId();
String secondDeployment = repositoryService
.createDeployment()
.addClasspathResource("org/camunda/bpm/engine/test/api/repository/second-process.bpmn20.xml")
.deploy()
.getId();
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
query
.processDefinitionName("First Test Process")
.latestVersion();
verifyQueryResults(query, 0);
repositoryService.deleteDeployment(firstDeployment, true);
repositoryService.deleteDeployment(secondDeployment, true);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:ProcessDefinitionQueryTest.java
示例6: suspendAndActivateProcessDefinitionsForAllTenants
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Test
public void suspendAndActivateProcessDefinitionsForAllTenants() {
// given activated process definitions
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
// first suspend
engineRule.getRepositoryService()
.updateProcessDefinitionSuspensionState()
.byProcessDefinitionKey(PROCESS_DEFINITION_KEY)
.suspend();
assertThat(query.active().count(), is(0L));
assertThat(query.suspended().count(), is(3L));
// then activate
engineRule.getRepositoryService()
.updateProcessDefinitionSuspensionState()
.byProcessDefinitionKey(PROCESS_DEFINITION_KEY)
.activate();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:MultiTenancyProcessDefinitionSuspensionStateTest.java
示例7: applySortBy
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Override
protected void applySortBy(ProcessDefinitionQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_CATEGORY_VALUE)) {
query.orderByProcessDefinitionCategory();
} else if (sortBy.equals(SORT_BY_KEY_VALUE)) {
query.orderByProcessDefinitionKey();
} else if (sortBy.equals(SORT_BY_ID_VALUE)) {
query.orderByProcessDefinitionId();
} else if (sortBy.equals(SORT_BY_VERSION_VALUE)) {
query.orderByProcessDefinitionVersion();
} else if (sortBy.equals(SORT_BY_NAME_VALUE)) {
query.orderByProcessDefinitionName();
} else if (sortBy.equals(SORT_BY_DEPLOYMENT_ID_VALUE)) {
query.orderByDeploymentId();
} else if (sortBy.equals(SORT_BY_TENANT_ID)) {
query.orderByTenantId();
} else if (sortBy.equals(SORT_BY_VERSION_TAG)) {
query.orderByVersionTag();
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:ProcessDefinitionQueryDto.java
示例8: suspendProcessDefinitionForNonTenant
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Test
public void suspendProcessDefinitionForNonTenant() {
// given activated process definitions
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
engineRule.getRepositoryService()
.updateProcessDefinitionSuspensionState()
.byProcessDefinitionKey(PROCESS_DEFINITION_KEY)
.processDefinitionWithoutTenantId()
.suspend();
assertThat(query.active().count(), is(2L));
assertThat(query.suspended().count(), is(1L));
assertThat(query.suspended().withoutTenantId().count(), is(1L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:MultiTenancyProcessDefinitionSuspensionStateTest.java
示例9: activateProcessDefinitionForNonTenant
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Test
public void activateProcessDefinitionForNonTenant() {
// given suspend process definitions
engineRule.getRepositoryService()
.updateProcessDefinitionSuspensionState()
.byProcessDefinitionKey(PROCESS_DEFINITION_KEY)
.suspend();
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.suspended().count(), is(3L));
assertThat(query.active().count(), is(0L));
engineRule.getRepositoryService()
.updateProcessDefinitionSuspensionState()
.byProcessDefinitionKey(PROCESS_DEFINITION_KEY)
.processDefinitionWithoutTenantId()
.activate();
assertThat(query.suspended().count(), is(2L));
assertThat(query.active().count(), is(1L));
assertThat(query.active().withoutTenantId().count(), is(1L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:MultiTenancyProcessDefinitionSuspensionStateTest.java
示例10: delayedSuspendProcessDefinitionsForAllTenants
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Test
public void delayedSuspendProcessDefinitionsForAllTenants() {
// given activated process definitions
engineRule.getRepositoryService()
.updateProcessDefinitionSuspensionState()
.byProcessDefinitionKey(PROCESS_DEFINITION_KEY)
.executionDate(tomorrow())
.suspend();
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
// when execute the job to suspend the process definitions
Job job = engineRule.getManagementService().createJobQuery().timers().singleResult();
assertThat(job, is(notNullValue()));
engineRule.getManagementService().executeJob(job.getId());
assertThat(query.active().count(), is(0L));
assertThat(query.suspended().count(), is(3L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:MultiTenancyProcessDefinitionSuspensionStateTest.java
示例11: testQueryWithGroupAuthorizationRevokedReadPermission
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
public void testQueryWithGroupAuthorizationRevokedReadPermission() {
// given
// given user gets all permissions on any process definition
Authorization authorization = createGrantAuthorization(PROCESS_DEFINITION, ANY);
authorization.setGroupId(groupId);
authorization.addPermission(ALL);
saveAuthorization(authorization);
authorization = createRevokeAuthorization(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY);
authorization.setGroupId(groupId);
authorization.removePermission(READ);
saveAuthorization(authorization);
// when
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
// then
verifyQueryResults(query, 1);
ProcessDefinition definition = query.singleResult();
assertNotNull(definition);
assertEquals(TWO_TASKS_PROCESS_KEY, definition.getKey());
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:ProcessDefinitionAuthorizationTest.java
示例12: suspendProcessDefinitionNoAuthenticatedTenants
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Test
public void suspendProcessDefinitionNoAuthenticatedTenants() {
// given activated process definitions
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
engineRule.getIdentityService().setAuthentication("user", null, null);
engineRule.getRepositoryService()
.updateProcessDefinitionSuspensionState()
.byProcessDefinitionKey(PROCESS_DEFINITION_KEY)
.suspend();
engineRule.getIdentityService().clearAuthentication();
assertThat(query.active().count(), is(2L));
assertThat(query.suspended().count(), is(1L));
assertThat(query.suspended().withoutTenantId().count(), is(1L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:MultiTenancyProcessDefinitionSuspensionStateTest.java
示例13: suspendProcessDefinitionWithAuthenticatedTenant
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Test
public void suspendProcessDefinitionWithAuthenticatedTenant() {
// given activated process definitions
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE));
engineRule.getRepositoryService()
.updateProcessDefinitionSuspensionState()
.byProcessDefinitionKey(PROCESS_DEFINITION_KEY)
.suspend();
engineRule.getIdentityService().clearAuthentication();
assertThat(query.active().count(), is(1L));
assertThat(query.suspended().count(), is(2L));
assertThat(query.active().tenantIdIn(TENANT_TWO).count(), is(1L));
assertThat(query.suspended().tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.suspended().withoutTenantId().count(), is(1L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:MultiTenancyProcessDefinitionSuspensionStateTest.java
示例14: testDeployProcessArchive
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Test
public void testDeployProcessArchive() {
assertNotNull(processEngine);
RepositoryService repositoryService = processEngine.getRepositoryService();
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
.processDefinitionKey("invoice-it");
assertEquals(1, processDefinitionQuery.count());
ProcessDefinition processDefinition = processDefinitionQuery.singleResult();
String deploymentId = repositoryService.createDeploymentQuery()
.deploymentId(processDefinition.getDeploymentId())
.singleResult()
.getId();
List<Resource> deploymentResources = repositoryService.getDeploymentResources(deploymentId);
assertEquals(3, deploymentResources.size());
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:TestAdditionalResourceSuffixes.java
示例15: testQueryByTenantIdsIncludeDefinitionsWithoutTenantId
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
public void testQueryByTenantIdsIncludeDefinitionsWithoutTenantId() {
ProcessDefinitionQuery query = repositoryService
.createProcessDefinitionQuery()
.tenantIdIn(TENANT_ONE)
.includeProcessDefinitionsWithoutTenantId();
assertThat(query.count(), is(2L));
query = repositoryService
.createProcessDefinitionQuery()
.tenantIdIn(TENANT_TWO)
.includeProcessDefinitionsWithoutTenantId();
assertThat(query.count(), is(2L));
query = repositoryService
.createProcessDefinitionQuery()
.tenantIdIn(TENANT_ONE, TENANT_TWO)
.includeProcessDefinitionsWithoutTenantId();
assertThat(query.count(), is(3L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:MultiTenancyProcessDefinitionQueryTest.java
示例16: testQueryByKey
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
public void testQueryByKey() {
ProcessDefinitionQuery query = repositoryService
.createProcessDefinitionQuery()
.processDefinitionKey(PROCESS_DEFINITION_KEY);
// one definition for each tenant
assertThat(query.count(), is(3L));
query = repositoryService
.createProcessDefinitionQuery()
.processDefinitionKey(PROCESS_DEFINITION_KEY)
.withoutTenantId();
// one definition without tenant id
assertThat(query.count(), is(1L));
query = repositoryService
.createProcessDefinitionQuery()
.processDefinitionKey(PROCESS_DEFINITION_KEY)
.tenantIdIn(TENANT_ONE);
// one definition for tenant one
assertThat(query.count(), is(1L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:MultiTenancyProcessDefinitionQueryTest.java
示例17: testQueryByLatestNoTenantIdSet
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
public void testQueryByLatestNoTenantIdSet() {
// deploy a second version for tenant one
deploymentForTenant(TENANT_ONE, emptyProcess);
ProcessDefinitionQuery query = repositoryService
.createProcessDefinitionQuery()
.processDefinitionKey(PROCESS_DEFINITION_KEY)
.latestVersion();
// one definition for each tenant
assertThat(query.count(), is(3L));
Map<String, ProcessDefinition> processDefinitionsForTenant = getProcessDefinitionsForTenant(query.list());
assertThat(processDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
assertThat(processDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
assertThat(processDefinitionsForTenant.get(null).getVersion(), is(1));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:MultiTenancyProcessDefinitionQueryTest.java
示例18: testQueryByLatestWithTenantIds
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
public void testQueryByLatestWithTenantIds() {
// deploy a second version for tenant one
deploymentForTenant(TENANT_ONE, emptyProcess);
ProcessDefinitionQuery query = repositoryService
.createProcessDefinitionQuery()
.processDefinitionKey(PROCESS_DEFINITION_KEY)
.latestVersion()
.tenantIdIn(TENANT_ONE, TENANT_TWO);
// one definition for each tenant
assertThat(query.count(), is(2L));
Map<String, ProcessDefinition> processDefinitionsForTenant = getProcessDefinitionsForTenant(query.list());
assertThat(processDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
assertThat(processDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:MultiTenancyProcessDefinitionQueryTest.java
示例19: testQueryByLatestWithTenantIdsIncludeDefinitionsWithoutTenantId
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
public void testQueryByLatestWithTenantIdsIncludeDefinitionsWithoutTenantId() {
// deploy a second version without tenant id
deployment(emptyProcess);
// deploy a third version for tenant one
deploymentForTenant(TENANT_ONE, emptyProcess);
deploymentForTenant(TENANT_ONE, emptyProcess);
ProcessDefinitionQuery query = repositoryService
.createProcessDefinitionQuery()
.processDefinitionKey(PROCESS_DEFINITION_KEY)
.latestVersion()
.tenantIdIn(TENANT_ONE, TENANT_TWO)
.includeProcessDefinitionsWithoutTenantId();
assertThat(query.count(), is(3L));
Map<String, ProcessDefinition> processDefinitionsForTenant = getProcessDefinitionsForTenant(query.list());
assertThat(processDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(3));
assertThat(processDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
assertThat(processDefinitionsForTenant.get(null).getVersion(), is(2));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:MultiTenancyProcessDefinitionQueryTest.java
示例20: testDeleteProcessDefinitionWithAuthenticatedTenant
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Test
public void testDeleteProcessDefinitionWithAuthenticatedTenant() {
//given deployment with two process definitions
Deployment deployment = testRule.deployForTenant(TENANT_ONE, "org/camunda/bpm/engine/test/repository/twoProcesses.bpmn20.xml");
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId());
List<ProcessDefinition> processDefinitions = processDefinitionQuery.list();
//and user with tenant authentication
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
//when delete process definition with authenticated user
repositoryService.deleteProcessDefinition(processDefinitions.get(0).getId());
//then process definition should be deleted
identityService.clearAuthentication();
assertThat(processDefinitionQuery.count(), is(1L));
assertThat(processDefinitionQuery.tenantIdIn(TENANT_ONE).count(), is(1L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:MultiTenancyProcessDefinitionCmdsTenantCheckTest.java
注:本文中的org.camunda.bpm.engine.repository.ProcessDefinitionQuery类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论