Search in sources :

Example 1 with ProcessInstanceModificationInstructionDto

use of org.camunda.bpm.engine.rest.dto.runtime.modification.ProcessInstanceModificationInstructionDto in project camunda-bpm-platform by camunda.

the class ProcessDefinitionResourceImpl method startProcessInstanceAtActivities.

protected ProcessInstanceWithVariables startProcessInstanceAtActivities(StartProcessInstanceDto dto) {
    Map<String, Object> processInstanceVariables = VariableValueDto.toMap(dto.getVariables(), engine, objectMapper);
    String businessKey = dto.getBusinessKey();
    String caseInstanceId = dto.getCaseInstanceId();
    ProcessInstantiationBuilder instantiationBuilder = engine.getRuntimeService().createProcessInstanceById(processDefinitionId).businessKey(businessKey).caseInstanceId(caseInstanceId).setVariables(processInstanceVariables);
    if (dto.getStartInstructions() != null && !dto.getStartInstructions().isEmpty()) {
        for (ProcessInstanceModificationInstructionDto instruction : dto.getStartInstructions()) {
            instruction.applyTo(instantiationBuilder, engine, objectMapper);
        }
    }
    return instantiationBuilder.executeWithVariablesInReturn(dto.isSkipCustomListeners(), dto.isSkipIoMappings());
}
Also used : ProcessInstanceModificationInstructionDto(org.camunda.bpm.engine.rest.dto.runtime.modification.ProcessInstanceModificationInstructionDto) ProcessInstantiationBuilder(org.camunda.bpm.engine.runtime.ProcessInstantiationBuilder)

Aggregations

ProcessInstanceModificationInstructionDto (org.camunda.bpm.engine.rest.dto.runtime.modification.ProcessInstanceModificationInstructionDto)1 ProcessInstantiationBuilder (org.camunda.bpm.engine.runtime.ProcessInstantiationBuilder)1