Search in sources :

Example 1 with SubProcessActivityBehavior

use of org.camunda.bpm.engine.impl.pvm.delegate.SubProcessActivityBehavior in project camunda-bpm-platform by camunda.

the class AbstractAtomicOperationCaseExecutionComplete method postTransitionNotification.

protected void postTransitionNotification(CmmnExecution execution) {
    if (!execution.isCaseInstanceExecution()) {
        execution.remove();
    } else {
        CmmnExecution superCaseExecution = execution.getSuperCaseExecution();
        PvmExecutionImpl superExecution = execution.getSuperExecution();
        if (superCaseExecution != null) {
            TransferVariablesActivityBehavior behavior = (TransferVariablesActivityBehavior) getActivityBehavior(superCaseExecution);
            behavior.transferVariables(execution, superCaseExecution);
            superCaseExecution.complete();
        } else if (superExecution != null) {
            SubProcessActivityBehavior behavior = (SubProcessActivityBehavior) getActivityBehavior(superExecution);
            try {
                behavior.passOutputVariables(superExecution, execution);
            } catch (RuntimeException e) {
                LOG.completingSubCaseError(execution, e);
                throw e;
            } catch (Exception e) {
                LOG.completingSubCaseError(execution, e);
                throw LOG.completingSubCaseErrorException(execution, e);
            }
            // set sub case instance to null
            superExecution.setSubCaseInstance(null);
            try {
                behavior.completed(superExecution);
            } catch (RuntimeException e) {
                LOG.completingSubCaseError(execution, e);
                throw e;
            } catch (Exception e) {
                LOG.completingSubCaseError(execution, e);
                throw LOG.completingSubCaseErrorException(execution, e);
            }
        }
        execution.setSuperCaseExecution(null);
        execution.setSuperExecution(null);
    }
    CmmnExecution parent = execution.getParent();
    if (parent != null) {
        CmmnActivityBehavior behavior = getActivityBehavior(parent);
        if (behavior instanceof CmmnCompositeActivityBehavior) {
            CmmnCompositeActivityBehavior compositeBehavior = (CmmnCompositeActivityBehavior) behavior;
            compositeBehavior.handleChildCompletion(parent, execution);
        }
    }
}
Also used : CmmnCompositeActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CmmnCompositeActivityBehavior) TransferVariablesActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.TransferVariablesActivityBehavior) CmmnActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) CmmnExecution(org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution) SubProcessActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.SubProcessActivityBehavior)

Example 2 with SubProcessActivityBehavior

use of org.camunda.bpm.engine.impl.pvm.delegate.SubProcessActivityBehavior in project camunda-bpm-platform by camunda.

the class PvmAtomicOperationProcessEnd method eventNotificationsCompleted.

@Override
protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
    execution.leaveActivityInstance();
    PvmExecutionImpl superExecution = execution.getSuperExecution();
    CmmnActivityExecution superCaseExecution = execution.getSuperCaseExecution();
    SubProcessActivityBehavior subProcessActivityBehavior = null;
    TransferVariablesActivityBehavior transferVariablesBehavior = null;
    // copy variables before destroying the ended sub process instance
    if (superExecution != null) {
        PvmActivity activity = superExecution.getActivity();
        subProcessActivityBehavior = (SubProcessActivityBehavior) activity.getActivityBehavior();
        try {
            subProcessActivityBehavior.passOutputVariables(superExecution, execution);
        } catch (RuntimeException e) {
            LOG.exceptionWhileCompletingSupProcess(execution, e);
            throw e;
        } catch (Exception e) {
            LOG.exceptionWhileCompletingSupProcess(execution, e);
            throw new ProcessEngineException("Error while completing sub process of execution " + execution, e);
        }
    } else if (superCaseExecution != null) {
        CmmnActivity activity = superCaseExecution.getActivity();
        transferVariablesBehavior = (TransferVariablesActivityBehavior) activity.getActivityBehavior();
        try {
            transferVariablesBehavior.transferVariables(execution, superCaseExecution);
        } catch (RuntimeException e) {
            LOG.exceptionWhileCompletingSupProcess(execution, e);
            throw e;
        } catch (Exception e) {
            LOG.exceptionWhileCompletingSupProcess(execution, e);
            throw new ProcessEngineException("Error while completing sub process of execution " + execution, e);
        }
    }
    execution.destroy();
    execution.remove();
    // and trigger execution afterwards
    if (superExecution != null) {
        superExecution.setSubProcessInstance(null);
        try {
            subProcessActivityBehavior.completed(superExecution);
        } catch (RuntimeException e) {
            LOG.exceptionWhileCompletingSupProcess(execution, e);
            throw e;
        } catch (Exception e) {
            LOG.exceptionWhileCompletingSupProcess(execution, e);
            throw new ProcessEngineException("Error while completing sub process of execution " + execution, e);
        }
    } else if (superCaseExecution != null) {
        superCaseExecution.complete();
    }
}
Also used : CmmnActivityExecution(org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution) TransferVariablesActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.TransferVariablesActivityBehavior) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) SubProcessActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.SubProcessActivityBehavior)

Example 3 with SubProcessActivityBehavior

use of org.camunda.bpm.engine.impl.pvm.delegate.SubProcessActivityBehavior in project camunda-bpm-platform by camunda.

the class OutputVariablesPropagator method visit.

@Override
public void visit(ActivityExecution execution) {
    if (isProcessInstanceOfSubprocess(execution)) {
        PvmExecutionImpl superExecution = (PvmExecutionImpl) execution.getSuperExecution();
        ActivityImpl activity = superExecution.getActivity();
        SubProcessActivityBehavior subProcessActivityBehavior = (SubProcessActivityBehavior) activity.getActivityBehavior();
        subProcessActivityBehavior.passOutputVariables(superExecution, execution);
    }
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) SubProcessActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.SubProcessActivityBehavior)

Aggregations

SubProcessActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.SubProcessActivityBehavior)3 PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)3 TransferVariablesActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.TransferVariablesActivityBehavior)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 CmmnActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior)1 CmmnCompositeActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.CmmnCompositeActivityBehavior)1 CmmnActivityExecution (org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution)1 CmmnExecution (org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution)1 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)1 PvmActivity (org.camunda.bpm.engine.impl.pvm.PvmActivity)1 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)1