use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution 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();
}
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution in project camunda-bpm-platform by camunda.
the class PlanItemDefinitionActivityBehavior method repeat.
// repetition ///////////////////////////////////////////////////////////////
public void repeat(CmmnActivityExecution execution, String standardEvent) {
CmmnActivity activity = execution.getActivity();
boolean repeat = false;
if (activity.getEntryCriteria().isEmpty()) {
List<String> events = activity.getProperties().get(CmmnProperties.REPEAT_ON_STANDARD_EVENTS);
if (events != null && events.contains(standardEvent)) {
repeat = evaluateRepetitionRule(execution);
}
} else {
if (ENABLE.equals(standardEvent) || START.equals(standardEvent) || OCCUR.equals(standardEvent)) {
repeat = evaluateRepetitionRule(execution);
}
}
if (repeat) {
CmmnActivityExecution parent = execution.getParent();
// instantiate a new instance of given activity
List<CmmnExecution> children = parent.createChildExecutions(Arrays.asList(activity));
// start the lifecycle of the new instance
parent.triggerChildExecutionsLifecycle(children);
}
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution in project camunda-bpm-platform by camunda.
the class StageOrTaskActivityBehavior method onResume.
// resume /////////////////////////////////////////////////////////////////
public void onResume(CmmnActivityExecution execution) {
ensureNotCaseInstance(execution, "resume");
ensureTransitionAllowed(execution, SUSPENDED, ACTIVE, "resume");
CmmnActivityExecution parent = execution.getParent();
if (parent != null) {
if (!parent.isActive()) {
String id = execution.getId();
throw LOG.resumeInactiveCaseException("resume", id);
}
}
resuming(execution);
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution in project camunda-bpm-platform by camunda.
the class StageOrTaskActivityBehavior method onParentResume.
public void onParentResume(CmmnActivityExecution execution) {
ensureNotCaseInstance(execution, "parentResume");
String id = execution.getId();
if (!execution.isSuspended()) {
throw LOG.wrongCaseStateException("parentResume", id, "resume", "suspended", execution.getCurrentState().toString());
}
CmmnActivityExecution parent = execution.getParent();
if (parent != null) {
if (!parent.isActive()) {
throw LOG.resumeInactiveCaseException("parentResume", id);
}
}
resuming(execution);
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution in project camunda-bpm-platform by camunda.
the class EventListenerOrMilestoneActivityBehavior method onResume.
// resume ////////////////////////////////////////////////////////////////
public void onResume(CmmnActivityExecution execution) {
ensureTransitionAllowed(execution, SUSPENDED, AVAILABLE, "resume");
CmmnActivityExecution parent = execution.getParent();
if (parent != null) {
if (!parent.isActive()) {
String id = execution.getId();
throw LOG.resumeInactiveCaseException("resume", id);
}
}
resuming(execution);
}
Aggregations