Search in sources :

Example 1 with StartProcessInstanceCmd

use of org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd in project camunda-bpm-platform by camunda.

the class ProcessInstantiationBuilderImpl method executeWithVariablesInReturn.

@Override
public ProcessInstanceWithVariables executeWithVariablesInReturn(boolean skipCustomListeners, boolean skipIoMappings) {
    ensureOnlyOneNotNull("either process definition id or key must be set", processDefinitionId, processDefinitionKey);
    if (isProcessDefinitionTenantIdSet && processDefinitionId != null) {
        throw LOG.exceptionStartProcessInstanceByIdAndTenantId();
    }
    Command<ProcessInstanceWithVariables> command;
    if (modificationBuilder.getModificationOperations().isEmpty()) {
        if (skipCustomListeners || skipIoMappings) {
            throw LOG.exceptionStartProcessInstanceAtStartActivityAndSkipListenersOrMapping();
        }
        // start at the default start activity
        command = new StartProcessInstanceCmd(this);
    } else {
        // start at any activity using the instructions
        modificationBuilder.setSkipCustomListeners(skipCustomListeners);
        modificationBuilder.setSkipIoMappings(skipIoMappings);
        command = new StartProcessInstanceAtActivitiesCmd(this);
    }
    return commandExecutor.execute(command);
}
Also used : StartProcessInstanceAtActivitiesCmd(org.camunda.bpm.engine.impl.cmd.StartProcessInstanceAtActivitiesCmd) ProcessInstanceWithVariables(org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables) StartProcessInstanceCmd(org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd)

Aggregations

StartProcessInstanceAtActivitiesCmd (org.camunda.bpm.engine.impl.cmd.StartProcessInstanceAtActivitiesCmd)1 StartProcessInstanceCmd (org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd)1 ProcessInstanceWithVariables (org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables)1