本文整理汇总了Java中org.camunda.bpm.engine.repository.ProcessDefinition.getId方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessDefinition.getId方法的具体用法?Java ProcessDefinition.getId怎么用?Java ProcessDefinition.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.repository.ProcessDefinition
的用法示例。
在下文中一共展示了ProcessDefinition.getId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.camunda.bpm.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
private void execute(MigrationPlanContainer migrationPlanContainer) {
ProcessDefinition sourceDefinition = migrationPlanContainer.getSourceDefinition();
ProcessDefinition targetDefinition = migrationPlanContainer.getTargetDefinition();
MigrationPlanExecutionBuilder migrationPlanExecutionBuilder = migrationPlanContainer.getMigrationPlanExecutionBuilder();
LOG.info("\tMigrating all process instances from SOURCE process definition " + sourceDefinition.getId() + " to TARGET process definition " + targetDefinition.getId());
for (ProcessInstance processInstance : runtimeService.createProcessInstanceQuery().processDefinitionId(sourceDefinition.getId()).list()) {
LOG.info("\tMigrating process instance with id " + processInstance.getId());
}
try {
migrationPlanExecutionBuilder.execute();
// .executeAsync() for asynchronous execution in a batch (useful for large numbers of instances)
} catch (MigratingProcessInstanceValidationException e) {
throw new IllegalMigrationStateException("Validation error occurred during executing the migration from SOURCE process definition " + sourceDefinition.getId() + " to TARGET process definition " + targetDefinition.getId() + ": " + e.getValidationReport().toString(), e);
}
LOG.info("\tSuccessfully migrated all process instances from SOURCE process definition " + sourceDefinition.getId() + " to TARGET process definition " + targetDefinition.getId());
}
示例2: printProcessDefinition
import org.camunda.bpm.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public void printProcessDefinition(String deploymentId) {
String[] header = new String[]{"ID", "KEY", "NAME", "DEPLOYMENT", "CATEGORY"};
List<ProcessDefinition> processes = engine.getRepositoryService().createProcessDefinitionQuery().deploymentId(deploymentId).list();
String[][] data = new String[processes.size()][header.length];
int i = 0;
for (ProcessDefinition process : processes) {
data[i++] = new String[]{
process.getId(),
process.getKey(),
process.getName(),
process.getDeploymentId(),
process.getCategory()
};
}
ASCIITable.getInstance().printTable(header, data);
}
示例3: execute
import org.camunda.bpm.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
@Override
public Void execute(CommandContext commandContext) {
ensureNotNull("processDefinitionKey", processDefinitionKey);
List<ProcessDefinition> processDefinitions = commandContext.getProcessDefinitionManager()
.findDefinitionsByKeyAndTenantId(processDefinitionKey, tenantId, isTenantIdSet);
ensureNotEmpty(NotFoundException.class, "No process definition found with key '" + processDefinitionKey + "'",
"processDefinitions", processDefinitions);
for (ProcessDefinition processDefinition: processDefinitions) {
String processDefinitionId = processDefinition.getId();
deleteProcessDefinitionCmd(commandContext, processDefinitionId, cascade, skipCustomListeners);
}
return null;
}
示例4: execute
import org.camunda.bpm.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
@Override
public Void execute(CommandContext commandContext) {
ensureNotNull("processDefinitionIds", processDefinitionIds);
List<ProcessDefinition> processDefinitions = commandContext.getProcessDefinitionManager()
.findDefinitionsByIds(processDefinitionIds);
ensureNotEmpty(NotFoundException.class, "No process definition found",
"processDefinitions", processDefinitions);
for (ProcessDefinition processDefinition: processDefinitions) {
String processDefinitionId = processDefinition.getId();
deleteProcessDefinitionCmd(commandContext, processDefinitionId, cascade, skipCustomListeners);
}
return null;
}
示例5: testCompetingSuspension
import org.camunda.bpm.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
/**
* Ensures that suspending a process definition and its process instances will also increase the revision of the executions
* such that concurrent updates fail with an OptimisticLockingException.
*/
@Deployment
public void testCompetingSuspension() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("CompetingSuspensionProcess").singleResult();
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
Execution execution = runtimeService
.createExecutionQuery()
.processInstanceId(processInstance.getId())
.activityId("wait1")
.singleResult();
SuspendProcessDefinitionThread suspensionThread = new SuspendProcessDefinitionThread(processDefinition.getId());
suspensionThread.startAndWaitUntilControlIsReturned();
SignalThread signalExecutionThread = new SignalThread(execution.getId());
signalExecutionThread.startAndWaitUntilControlIsReturned();
suspensionThread.proceedAndWaitTillDone();
assertNull(suspensionThread.exception);
signalExecutionThread.proceedAndWaitTillDone();
assertNotNull(signalExecutionThread.exception);
}
示例6: fromProcessDefinition
import org.camunda.bpm.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public static ProcessDefinitionDto fromProcessDefinition(ProcessDefinition definition) {
ProcessDefinitionDto dto = new ProcessDefinitionDto();
dto.id = definition.getId();
dto.key = definition.getKey();
dto.category = definition.getCategory();
dto.description = definition.getDescription();
dto.name = definition.getName();
dto.version = definition.getVersion();
dto.resource = definition.getResourceName();
dto.deploymentId = definition.getDeploymentId();
dto.diagram = definition.getDiagramResourceName();
dto.suspended = definition.isSuspended();
dto.tenantId = definition.getTenantId();
dto.versionTag = definition.getVersionTag();
dto.historyTimeToLive = definition.getHistoryTimeToLive();
return dto;
}
示例7: fromProcessDefinition
import org.camunda.bpm.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public static HalProcessDefinition fromProcessDefinition(ProcessDefinition processDefinition, ProcessEngine processEngine) {
HalProcessDefinition halProcDef = new HalProcessDefinition();
halProcDef.id = processDefinition.getId();
halProcDef.key = processDefinition.getKey();
halProcDef.category = processDefinition.getCategory();
halProcDef.description = processDefinition.getDescription();
halProcDef.name = processDefinition.getName();
halProcDef.version = processDefinition.getVersion();
halProcDef.resource = processDefinition.getResourceName();
halProcDef.deploymentId = processDefinition.getDeploymentId();
halProcDef.diagram = processDefinition.getDiagramResourceName();
halProcDef.suspended = processDefinition.isSuspended();
halProcDef.contextPath = ApplicationContextPathUtil.getApplicationPathForDeployment(processEngine, processDefinition.getDeploymentId());
halProcDef.linker.createLink(REL_SELF, processDefinition.getId());
halProcDef.linker.createLink(REL_DEPLOYMENT, processDefinition.getDeploymentId());
halProcDef.linker.createLink(REL_DEPLOYMENT_RESOURCE, processDefinition.getDeploymentId(), processDefinition.getResourceName());
return halProcDef;
}
示例8: testTaskFormsWithVacationRequestProcess
import org.camunda.bpm.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
@Deployment(resources = {
"org/camunda/bpm/engine/test/api/form/util/VacationRequest_deprecated_forms.bpmn20.xml",
"org/camunda/bpm/engine/test/api/form/util/approve.form",
"org/camunda/bpm/engine/test/api/form/util/request.form",
"org/camunda/bpm/engine/test/api/form/util/adjustRequest.form" })
@Test
public void testTaskFormsWithVacationRequestProcess() {
// Get start form
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
Object startForm = formService.getRenderedStartForm(procDefId, "juel");
assertNotNull(startForm);
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
String processDefinitionId = processDefinition.getId();
assertEquals("org/camunda/bpm/engine/test/api/form/util/request.form", formService.getStartFormData(processDefinitionId).getFormKey());
// Define variables that would be filled in through the form
Map<String, String> formProperties = new HashMap<String, String>();
formProperties.put("employeeName", "kermit");
formProperties.put("numberOfDays", "4");
formProperties.put("vacationMotivation", "I'm tired");
formService.submitStartFormData(procDefId, formProperties);
// Management should now have a task assigned to them
Task task = taskService.createTaskQuery().taskCandidateGroup("management").singleResult();
assertEquals("Vacation request by kermit", task.getDescription());
Object taskForm = formService.getRenderedTaskForm(task.getId(), "juel");
assertNotNull(taskForm);
// Rejecting the task should put the process back to first task
taskService.complete(task.getId(), CollectionUtil.singletonMap("vacationApproved", "false"));
task = taskService.createTaskQuery().singleResult();
assertEquals("Adjust vacation request", task.getName());
}
示例9: testDeleteProcessDefinitionAndRefillDeploymentCache
import org.camunda.bpm.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
@Test
public void testDeleteProcessDefinitionAndRefillDeploymentCache() {
// given a deployment with two process definitions in one xml model file
deployment = repositoryService.createDeployment()
.addClasspathResource("org/camunda/bpm/engine/test/repository/twoProcesses.bpmn20.xml")
.deploy();
ProcessDefinition processDefinitionOne =
repositoryService.createProcessDefinitionQuery().processDefinitionKey("one").singleResult();
ProcessDefinition processDefinitionTwo =
repositoryService.createProcessDefinitionQuery().processDefinitionKey("two").singleResult();
String idOne = processDefinitionOne.getId();
//one is deleted from the deployment
repositoryService.deleteProcessDefinition(idOne);
//when clearing the deployment cache
processEngineConfiguration.getDeploymentCache().discardProcessDefinitionCache();
//then creating process instance from the existing process definition
ProcessInstanceWithVariables procInst = runtimeService.createProcessInstanceByKey("two").executeWithVariablesInReturn();
assertNotNull(procInst);
assertTrue(procInst.getProcessDefinitionId().contains("two"));
//should refill the cache
Cache cache = processEngineConfiguration.getDeploymentCache().getProcessDefinitionCache();
assertNotNull(cache.get(processDefinitionTwo.getId()));
//The deleted process definition should not be recreated after the cache is refilled
assertNull(cache.get(processDefinitionOne.getId()));
}
示例10: testMigrateEventSubscription
import org.camunda.bpm.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
@Test
public void testMigrateEventSubscription() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(MessageReceiveModels.MESSAGE_START_PROCESS);
String sourceProcessDefinitionId = sourceProcessDefinition.getId();
MigrationPlan migrationPlan = runtimeService
.createMigrationPlan(sourceProcessDefinitionId, sourceProcessDefinitionId)
.mapEqualActivities()
.build();
ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcessDefinitionId);
EventSubscription eventSubscription = runtimeService
.createEventSubscriptionQuery()
.activityId("startEvent")
.eventName(MessageReceiveModels.MESSAGE_NAME)
.singleResult();
// when
runtimeService.newMigration(migrationPlan).processInstanceIds(processInstance.getId()).execute();
// then
assertEventSubscriptionMigrated(eventSubscription, "startEvent", MessageReceiveModels.MESSAGE_NAME);
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(processInstance.getId());
}
示例11: createMigrationPlan
import org.camunda.bpm.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
private List<MigrationPlanContainer> createMigrationPlan(Migration migration) {
List<MigrationPlanContainer> result = new ArrayList<>();
MigrationPlan migrationPlan = migration.getMigrationPlan();
List<ProcessDefinition> sourceDefinitions = processDefinitionService.fetchProcessDefinitionsByKeyAndVersionTag(migrationPlan.getSourceProcessDefinitionKey(), migrationPlan.getSourceProcessVersionTag());
ProcessDefinition targetDefinition = processDefinitionService.fetchLatestProcessDefinitionByKeyAndVersionTag(migrationPlan.getTargetProcessDefinitionKey(), migrationPlan.getTargetProcessVersionTag());
for (ProcessDefinition sourceDefinition: sourceDefinitions) {
if (!validate(migration, sourceDefinition, targetDefinition)) {
continue;
}
LOG.info("\tCreating a migration plan from SOURCE process definition " + sourceDefinition.getId() + "(Version:" + sourceDefinition.getVersion() + ") " + " to TARGET process definition " + targetDefinition.getId());
org.camunda.bpm.engine.migration.MigrationPlan engineMigrationPlan;
try {
engineMigrationPlan = migrationPlanService.createMigrationPlan(sourceDefinition, targetDefinition, migrationPlan);
} catch (MigrationPlanValidationException e) {
throw new IllegalMigrationStateException("Validation error occurred during creating a plan for migration from SOURCE process definition " + sourceDefinition.getId() + " to TARGET process definition " + targetDefinition.getId() + ": " + e.getValidationReport().toString(), e);
}
org.camunda.bpm.engine.runtime.ProcessInstanceQuery migrationProcessInstanceQuery = runtimeService.createProcessInstanceQuery()
.processDefinitionId(sourceDefinition.getId());
if (!migration.getProcessInstanceQuery().getProcessActivityIds().isEmpty()) {
migrationProcessInstanceQuery.activityIdIn(migration.getProcessInstanceQuery().getProcessActivityIds().toArray(new String[0]));
}
MigrationPlanExecutionBuilder migrationPlanExecutionBuilder = runtimeService
.newMigration(engineMigrationPlan)
.processInstanceQuery(migrationProcessInstanceQuery);
if (migration.isSkipIoMappings()) {
migrationPlanExecutionBuilder.skipIoMappings();
}
if (migration.isSkipCustomListeners()) {
migrationPlanExecutionBuilder.skipCustomListeners();
}
result.add(new MigrationPlanContainer(migrationPlanExecutionBuilder, sourceDefinition, targetDefinition));
}
return result;
}