Java Code Examples for org.activiti.engine.runtime.ProcessInstanceBuilder#name()

The following examples show how to use org.activiti.engine.runtime.ProcessInstanceBuilder#name() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HistoricProcessInstanceTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Deployment(resources = { "org/activiti/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testHistoricProcessInstanceName() {
  String piName = "Customized Process Instance Name";
  ProcessInstanceBuilder builder = runtimeService.createProcessInstanceBuilder();
  builder.processDefinitionKey("oneTaskProcess");
  builder.name(piName);
  ProcessInstance processInstance1 = builder.start();

  HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance1.getProcessInstanceId()).singleResult();
  assertEquals(piName, historicProcessInstance.getName());
  assertEquals(1, historyService.createHistoricProcessInstanceQuery().processInstanceName(piName).list().size());
}
 
Example 2
Source File: HistoricProcessInstanceTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Deployment(resources = {"org/activiti5/engine/test/history/oneTaskProcess.bpmn20.xml"})
public void testHistoricProcessInstanceName() {
 String piName = "Customized Process Instance Name";
 ProcessInstanceBuilder builder = runtimeService.createProcessInstanceBuilder();
 builder.processDefinitionKey("oneTaskProcess");
 builder.name(piName);
 ProcessInstance processInstance1 = builder.start();
	
 HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance1.getProcessInstanceId()).singleResult();
 assertEquals(piName, historicProcessInstance.getName());
 assertEquals(1, historyService.createHistoricProcessInstanceQuery().processInstanceName(piName).list().size());
}
 
Example 3
Source File: DefaultFlowable5CompatibilityHandler.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
public ProcessInstance startProcessInstance(String processDefinitionKey, String processDefinitionId,
                                            Map<String, Object> variables, Map<String, Object> transientVariables, String businessKey, String tenantId, String processInstanceName) {

    org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(Authentication.getAuthenticatedUserId());

    try {

        ProcessInstanceBuilder processInstanceBuilder = getProcessEngine().getRuntimeService().createProcessInstanceBuilder();
        if (processDefinitionKey != null) {
            processInstanceBuilder.processDefinitionKey(processDefinitionKey);
        }
        if (processDefinitionId != null) {
            processInstanceBuilder.processDefinitionId(processDefinitionId);
        }
        if (variables != null) {
            processInstanceBuilder.variables(variables);
        }
        if (transientVariables != null) {
            processInstanceBuilder.transientVariables(transientVariables);
        }
        if (businessKey != null) {
            processInstanceBuilder.businessKey(businessKey);
        }
        if (tenantId != null) {
            processInstanceBuilder.tenantId(tenantId);
        }
        if (processInstanceName != null) {
            processInstanceBuilder.name(processInstanceName);
        }

        org.activiti.engine.runtime.ProcessInstance activiti5ProcessInstance = processInstanceBuilder.start();
        return new Flowable5ProcessInstanceWrapper(activiti5ProcessInstance);

    } catch (org.activiti.engine.ActivitiException e) {
        handleActivitiException(e);
        return null;
    }
}