Search in sources :

Example 1 with SubProcessActivityBehavior

use of org.activiti.engine.impl.pvm.delegate.SubProcessActivityBehavior in project Activiti by Activiti.

the class AtomicOperationProcessEnd method eventNotificationsCompleted.

@Override
protected void eventNotificationsCompleted(InterpretableExecution execution) {
    InterpretableExecution superExecution = execution.getSuperExecution();
    SubProcessActivityBehavior subProcessActivityBehavior = null;
    // copy variables before destroying the ended sub process instance
    if (superExecution != null) {
        ActivityImpl activity = (ActivityImpl) superExecution.getActivity();
        subProcessActivityBehavior = (SubProcessActivityBehavior) activity.getActivityBehavior();
        try {
            subProcessActivityBehavior.completing(superExecution, execution);
        } catch (RuntimeException e) {
            log.error("Error while completing sub process of execution {}", execution, e);
            throw e;
        } catch (Exception e) {
            log.error("Error while completing sub process of execution {}", execution, e);
            throw new ActivitiException("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.error("Error while completing sub process of execution {}", execution, e);
            throw e;
        } catch (Exception e) {
            log.error("Error while completing sub process of execution {}", execution, e);
            throw new ActivitiException("Error while completing sub process of execution " + execution, e);
        }
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) ActivitiException(org.activiti.engine.ActivitiException) SubProcessActivityBehavior(org.activiti.engine.impl.pvm.delegate.SubProcessActivityBehavior)

Aggregations

ActivitiException (org.activiti.engine.ActivitiException)1 SubProcessActivityBehavior (org.activiti.engine.impl.pvm.delegate.SubProcessActivityBehavior)1 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)1