当前位置: 首页>>代码示例>>Java>>正文


Java ProcessInstance.getProcessDefinitionId方法代码示例

本文整理汇总了Java中org.camunda.bpm.engine.runtime.ProcessInstance.getProcessDefinitionId方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessInstance.getProcessDefinitionId方法的具体用法?Java ProcessInstance.getProcessDefinitionId怎么用?Java ProcessInstance.getProcessDefinitionId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.camunda.bpm.engine.runtime.ProcessInstance的用法示例。


在下文中一共展示了ProcessInstance.getProcessDefinitionId方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSuspendProcessInstanceByProcessDefinitionIdWithUpdatePermissionOnProcessInstance

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public void testSuspendProcessInstanceByProcessDefinitionIdWithUpdatePermissionOnProcessInstance() {
  // given
  ProcessInstance instance = startProcessInstanceByKey(PROCESS_KEY);
  String processInstanceId = instance.getId();
  String processDefinitionId = instance.getProcessDefinitionId();
  createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, UPDATE);

  try {
    // when
    runtimeService.suspendProcessInstanceByProcessDefinitionId(processDefinitionId);
    fail("Exception expected: It should not be posssible to suspend a process instance.");
  } catch (AuthorizationException e) {

    // then
    String message = e.getMessage();
    assertTextPresent(userId, message);
    assertTextPresent(UPDATE_INSTANCE.getName(), message);
    assertTextPresent(PROCESS_KEY, message);
    assertTextPresent(PROCESS_DEFINITION.resourceName(), message);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:ProcessInstanceAuthorizationTest.java

示例2: testSuspendProcessInstanceByProcessDefinitionId

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public void testSuspendProcessInstanceByProcessDefinitionId() {
  // given
  ProcessInstance instance = startProcessInstanceByKey(PROCESS_KEY);
  String processInstanceId = instance.getId();
  String processDefinitionId = instance.getProcessDefinitionId();

  createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, UPDATE);
  createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, UPDATE_INSTANCE);

  // when
  runtimeService.suspendProcessInstanceByProcessDefinitionId(processDefinitionId);

  // then
  instance = selectSingleProcessInstance();
  assertTrue(instance.isSuspended());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:ProcessInstanceAuthorizationTest.java

示例3: testActivateProcessInstanceByProcessDefinitionIdWithoutAuthorization

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public void testActivateProcessInstanceByProcessDefinitionIdWithoutAuthorization() {
  // given
  ProcessInstance instance = startProcessInstanceByKey(PROCESS_KEY);
  String processInstanceId = instance.getId();
  String processDefinitionId = instance.getProcessDefinitionId();
  suspendProcessInstanceById(processInstanceId);

  try {
    // when
    runtimeService.activateProcessInstanceByProcessDefinitionId(processDefinitionId);
    fail("Exception expected: It should not be posssible to suspend a process instance.");
  } catch (AuthorizationException e) {

    // then
    String message = e.getMessage();
    assertTextPresent(userId, message);
    assertTextPresent(UPDATE_INSTANCE.getName(), message);
    assertTextPresent(PROCESS_KEY, message);
    assertTextPresent(PROCESS_DEFINITION.resourceName(), message);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:ProcessInstanceAuthorizationTest.java

示例4: testActivateProcessInstanceByProcessDefinitionIdWithUpdatePermissionOnProcessInstance

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public void testActivateProcessInstanceByProcessDefinitionIdWithUpdatePermissionOnProcessInstance() {
  // given
  ProcessInstance instance = startProcessInstanceByKey(PROCESS_KEY);
  String processInstanceId = instance.getId();
  String processDefinitionId = instance.getProcessDefinitionId();
  suspendProcessInstanceById(processInstanceId);

  createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, UPDATE);

  try {
    // when
    runtimeService.activateProcessInstanceByProcessDefinitionId(processDefinitionId);
    fail("Exception expected: It should not be posssible to suspend a process instance.");
  } catch (AuthorizationException e) {

    // then
    String message = e.getMessage();
    assertTextPresent(userId, message);
    assertTextPresent(UPDATE_INSTANCE.getName(), message);
    assertTextPresent(PROCESS_KEY, message);
    assertTextPresent(PROCESS_DEFINITION.resourceName(), message);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:ProcessInstanceAuthorizationTest.java

示例5: testActivateProcessInstanceByProcessDefinitionIdWithUpdatePermissionOnAnyProcessInstance

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public void testActivateProcessInstanceByProcessDefinitionIdWithUpdatePermissionOnAnyProcessInstance() {
  // given
  ProcessInstance instance = startProcessInstanceByKey(PROCESS_KEY);
  String processInstanceId = instance.getId();
  String processDefinitionId = instance.getProcessDefinitionId();
  suspendProcessInstanceById(processInstanceId);

  createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, UPDATE);

  // when
  runtimeService.activateProcessInstanceByProcessDefinitionId(processDefinitionId);

  // then
  instance = selectSingleProcessInstance();
  assertFalse(instance.isSuspended());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:ProcessInstanceAuthorizationTest.java

示例6: testActivateProcessInstanceByProcessDefinitionIdWithUpdateInstancesPermissionOnProcessDefinition

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public void testActivateProcessInstanceByProcessDefinitionIdWithUpdateInstancesPermissionOnProcessDefinition() {
  // given
  ProcessInstance instance = startProcessInstanceByKey(PROCESS_KEY);
  String processInstanceId = instance.getId();
  String processDefinitionId = instance.getProcessDefinitionId();
  suspendProcessInstanceById(processInstanceId);

  createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, UPDATE_INSTANCE);

  // when
  runtimeService.activateProcessInstanceByProcessDefinitionId(processDefinitionId);

  // then
  instance = selectSingleProcessInstance();
  assertFalse(instance.isSuspended());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:ProcessInstanceAuthorizationTest.java

示例7: testActivateProcessInstanceByProcessDefinitionId

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public void testActivateProcessInstanceByProcessDefinitionId() {
  // given
  ProcessInstance instance = startProcessInstanceByKey(PROCESS_KEY);
  String processInstanceId = instance.getId();
  String processDefinitionId = instance.getProcessDefinitionId();
  suspendProcessInstanceById(processInstanceId);

  createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, UPDATE);
  createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, UPDATE_INSTANCE);

  // when
  runtimeService.activateProcessInstanceByProcessDefinitionId(processDefinitionId);

  // then
  instance = selectSingleProcessInstance();
  assertFalse(instance.isSuspended());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:ProcessInstanceAuthorizationTest.java

示例8: createDistributionForElement

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
protected StatisticalDistribution createDistributionForElement(ProcessInstance pi, String id) {
  try {
    BaseElement taskElement = engine.getRepositoryService().getBpmnModelInstance(pi.getProcessDefinitionId()).getModelElementById(id);

    // Default = 10 minutes each
    double durationMean = DemoModelInstrumentator.readCamundaProperty(taskElement, "durationMean").flatMap(this::parseTime).orElse(600.0);
    double durationStandardDeviation = DemoModelInstrumentator.readCamundaProperty(taskElement, "durationSd").flatMap(this::parseTime).orElse(0.0);

    StatisticalDistribution distribution = new StatisticalDistribution(durationMean, durationStandardDeviation);
    return distribution;
  } catch (Exception ex) {
    throw new RuntimeException("Could not read distribution for element '" + id + "' of process definition '" + pi.getProcessDefinitionId() + "'", ex);
  }
}
 
开发者ID:camunda-consulting,项目名称:camunda-util-demo-data-generator,代码行数:15,代码来源:TimeAwareDemoGenerator.java

示例9: testSuspendProcessInstanceByProcessDefinitionIdWithUpdatePermissionOnAnyProcessInstance

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public void testSuspendProcessInstanceByProcessDefinitionIdWithUpdatePermissionOnAnyProcessInstance() {
  // given
  ProcessInstance instance = startProcessInstanceByKey(PROCESS_KEY);
  String processDefinitionId = instance.getProcessDefinitionId();
  createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, UPDATE);

  // when
  runtimeService.suspendProcessInstanceByProcessDefinitionId(processDefinitionId);

  // then
  instance = selectSingleProcessInstance();
  assertTrue(instance.isSuspended());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:14,代码来源:ProcessInstanceAuthorizationTest.java

示例10: testSuspendProcessInstanceByProcessDefinitionIdWithUpdateInstancesPermissionOnProcessDefinition

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public void testSuspendProcessInstanceByProcessDefinitionIdWithUpdateInstancesPermissionOnProcessDefinition() {
  // given
  ProcessInstance instance = startProcessInstanceByKey(PROCESS_KEY);
  String processDefinitionId = instance.getProcessDefinitionId();
  createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, UPDATE_INSTANCE);

  // when
  runtimeService.suspendProcessInstanceByProcessDefinitionId(processDefinitionId);

  // then
  instance = selectSingleProcessInstance();
  assertTrue(instance.isSuspended());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:14,代码来源:ProcessInstanceAuthorizationTest.java

示例11: ProcessInstanceDto

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public ProcessInstanceDto(ProcessInstance instance) {
  this.id = instance.getId();
  this.definitionId = instance.getProcessDefinitionId();
  this.businessKey = instance.getBusinessKey();
  this.caseInstanceId = instance.getCaseInstanceId();
  this.ended = instance.isEnded();
  this.suspended = instance.isSuspended();
  this.tenantId = instance.getTenantId();
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:10,代码来源:ProcessInstanceDto.java

示例12: migrateProcessInstance

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@POST
@Path("{id}")
public void migrateProcessInstance(@PathParam("id") final String processInstanceId, VersionDto versionDto) {
  log.fine("process instance id" + processInstanceId + ", payload: " + versionDto);
  if (versionDto==null) {
    throw new IllegalArgumentException("version to migrate to must be given");
  }
  final int newVersion = versionDto.getVersion();
 
  log.fine("new version: " + newVersion);
  
  SetProcessDefinitionVersionCmd command = new SetProcessDefinitionVersionCmd(processInstanceId, newVersion);
  ProcessEngineImpl processEngineImpl = (ProcessEngineImpl) ProcessEngines.getProcessEngine(engineName);
  processEngineImpl.getProcessEngineConfiguration().getCommandExecutorTxRequired().execute(command);

  log.info("setProcessDefinitionVersionCmd finished");
  
  // get the new process definition id from the migrated process instance.
  // This is the easiest and works because the above transaction is already completed
  ProcessInstance pi = getProcessEngine().getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
  final String processDefinitionId = pi.getProcessDefinitionId();
  
  // now do a SQL update via MyBatis
  getCommandExecutor().executeCommand(new Command<Void>() {
    
    @Override
    public Void execute(CommandContext commandContext) {
      log.info("Now tweaking histor of " + processInstanceId);
      
      HistoricProcessInstanceEntity processInstanceDto = new HistoricProcessInstanceEntity();
      processInstanceDto.setProcessInstanceId(processInstanceId);
      processInstanceDto.setProcessDefinitionId(processDefinitionId);
      
      try {       
        // execute the update from the migrate-historic-processinstance-update.xml
        commandContext.getDbSqlSession().getSqlSession().update("cockpit.version-migration.updateHistoricProcessInstance", processInstanceDto);
        
        log.info("History tweaked successfully");
      }
      catch (Throwable ex) {
        log.log(Level.INFO, "Could not tweak history due to exception. Did you properly install the plugin? If you see a ClassNotFoundException please refer to https://github.com/camunda/camunda-cockpit-plugins/tree/master/cockpit-plugin-version-migration/#how-to-use-it.", ex);
        // Classloading problems!
        // caused by: java.lang.NoClassDefFoundError: org/apache/ibatis/session/SqlSession
        // at com.camunda.consulting.cockpitPluginVersionMigration.resources.ProcessInstanceMigrationResource$1.execute(ProcessInstanceMigrationResource.java:63) [cockpit-plugin-version-migration.jar:]
      }
      return null;
    }
  });
  getQueryService();
  
}
 
开发者ID:camunda,项目名称:camunda-cockpit-plugins,代码行数:52,代码来源:ProcessInstanceMigrationResource.java

示例13: ProcessInstanceSnapshotBuilder

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public ProcessInstanceSnapshotBuilder(ProcessInstance processInstance, ProcessEngine processEngine) {
  this.processEngine = processEngine;
  this.processInstanceId = processInstance.getId();
  this.snapshot = new ProcessInstanceSnapshot(processInstance.getId(), processInstance.getProcessDefinitionId());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:6,代码来源:ProcessInstanceSnapshotBuilder.java

示例14: testQueryJobDefinitionOperationWithDelayedJobDefinition

import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Deployment(resources = {ONE_TASK_PROCESS})
public void testQueryJobDefinitionOperationWithDelayedJobDefinition() {
  // given
  // a running process instance
  ProcessInstance process = runtimeService.startProcessInstanceByKey("oneTaskProcess");

  // with a process definition id
  String processDefinitionId = process.getProcessDefinitionId();

  // ...which will be suspended with the corresponding jobs
  managementService.suspendJobDefinitionByProcessDefinitionId(processDefinitionId, true);

  // one week from now
  ClockUtil.setCurrentTime(today);
  long oneWeekFromStartTime = today.getTime() + (7 * 24 * 60 * 60 * 1000);

  // when
  // activate the job definition
  managementService.activateJobDefinitionByProcessDefinitionId(processDefinitionId, false, new Date(oneWeekFromStartTime));

  // then
  // there is a user log entry for the activation
  Long jobDefinitionEntryCount = query()
    .entityType(JOB_DEFINITION)
    .operationType(UserOperationLogEntry.OPERATION_TYPE_ACTIVATE_JOB_DEFINITION)
    .processDefinitionId(processDefinitionId)
    .count();

  assertEquals(1, jobDefinitionEntryCount.longValue());

  // there exists a job for the delayed activation execution
  JobQuery jobQuery = managementService.createJobQuery();

  Job delayedActivationJob = jobQuery.timers().active().singleResult();
  assertNotNull(delayedActivationJob);

  // execute job
  managementService.executeJob(delayedActivationJob.getId());

  jobDefinitionEntryCount = query()
    .entityType(JOB_DEFINITION)
    .operationType(UserOperationLogEntry.OPERATION_TYPE_ACTIVATE_JOB_DEFINITION)
    .processDefinitionId(processDefinitionId)
    .count();

  assertEquals(1, jobDefinitionEntryCount.longValue());

  // Clean up db
  CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
  commandExecutor.execute(new Command<Object>() {
    public Object execute(CommandContext commandContext) {
      commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerActivateJobDefinitionHandler.TYPE);
      return null;
    }
  });
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:57,代码来源:UserOperationLogQueryTest.java


注:本文中的org.camunda.bpm.engine.runtime.ProcessInstance.getProcessDefinitionId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。