Search in sources :

Example 1 with ProcessInstanceStartContext

use of org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext in project camunda-bpm-platform by camunda.

the class ExecutionEntity method getProcessInstanceStartContext.

@Override
public ProcessInstanceStartContext getProcessInstanceStartContext() {
    if (isProcessInstanceExecution()) {
        if (startContext == null) {
            ActivityImpl activity = getActivity();
            startContext = new ProcessInstanceStartContext(activity);
        }
    }
    return super.getProcessInstanceStartContext();
}
Also used : ProcessInstanceStartContext(org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext) ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)

Example 2 with ProcessInstanceStartContext

use of org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext in project camunda-bpm-platform by camunda.

the class ExecutionEntity method startWithFormProperties.

public void startWithFormProperties(VariableMap properties) {
    provideTenantId(properties);
    if (isProcessInstanceExecution()) {
        ActivityImpl initial = processDefinition.getInitial();
        ProcessInstanceStartContext processInstanceStartContext = getProcessInstanceStartContext();
        if (processInstanceStartContext != null) {
            initial = processInstanceStartContext.getInitial();
        }
        FormPropertyStartContext formPropertyStartContext = new FormPropertyStartContext(initial);
        formPropertyStartContext.setFormProperties(properties);
        startContext = formPropertyStartContext;
        initialize();
        initializeTimerDeclarations();
        fireHistoricProcessStartEvent();
    }
    performOperation(PvmAtomicOperation.PROCESS_START);
}
Also used : ProcessInstanceStartContext(org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext) ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) FormPropertyStartContext(org.camunda.bpm.engine.impl.persistence.entity.util.FormPropertyStartContext)

Example 3 with ProcessInstanceStartContext

use of org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext in project camunda-bpm-platform by camunda.

the class SubmitStartFormCmd method execute.

@Override
public ProcessInstance execute(CommandContext commandContext) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
    ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
    ensureNotNull("No process definition found for id = '" + processDefinitionId + "'", "processDefinition", processDefinition);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkCreateProcessInstance(processDefinition);
    }
    ExecutionEntity processInstance = null;
    if (businessKey != null) {
        processInstance = processDefinition.createProcessInstance(businessKey);
    } else {
        processInstance = processDefinition.createProcessInstance();
    }
    // see CAM-2828
    if (processDefinition.getInitial().isAsyncBefore()) {
        // avoid firing history events
        processInstance.setStartContext(new ProcessInstanceStartContext(processInstance.getActivity()));
        FormPropertyHelper.initFormPropertiesOnScope(variables, processInstance);
        processInstance.start();
    } else {
        processInstance.startWithFormProperties(variables);
    }
    return processInstance;
}
Also used : ProcessInstanceStartContext(org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Aggregations

ProcessInstanceStartContext (org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext)3 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)2 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)1 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)1 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)1 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)1 FormPropertyStartContext (org.camunda.bpm.engine.impl.persistence.entity.util.FormPropertyStartContext)1