use of org.camunda.bpm.engine.impl.cmmn.behavior.TransferVariablesActivityBehavior 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);
}
}
}
use of org.camunda.bpm.engine.impl.cmmn.behavior.TransferVariablesActivityBehavior 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();
}
}
Aggregations