use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution 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.execution.CmmnExecution in project camunda-bpm-platform by camunda.
the class AtomicOperationCaseExecutionDeleteCascade method execute.
public void execute(CmmnExecution execution) {
CmmnExecution firstLeaf = findFirstLeaf(execution);
firstLeaf.remove();
CmmnExecution parent = firstLeaf.getParent();
if (parent != null) {
parent.deleteCascade();
}
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution in project camunda-bpm-platform by camunda.
the class CaseCallActivityTest method testSuspendSubCaseInstance.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testCallCaseAsConstant.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn" })
public void testSuspendSubCaseInstance() {
// given
String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY).getId();
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
// when
suspend(subCaseInstanceId);
// then
CmmnExecution subCaseInstance = (CmmnExecution) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
assertTrue(subCaseInstance.isSuspended());
Execution callActivity = queryExecutionByActivityId(CALL_ACTIVITY_ID);
assertNotNull(callActivity);
// complete ////////////////////////////////////////////////////////
close(subCaseInstanceId);
assertCaseEnded(subCaseInstanceId);
runtimeService.deleteProcessInstance(superProcessInstanceId, null);
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution in project camunda-bpm-platform by camunda.
the class CaseCallActivityTest method testTerminateSubCaseInstance.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testCallCaseAsConstant.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testTerminateSubCaseInstance() {
// given
String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY).getId();
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
// when
terminate(subCaseInstanceId);
// then
CmmnExecution subCaseInstance = (CmmnExecution) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
assertTrue(subCaseInstance.isTerminated());
Execution callActivity = queryExecutionByActivityId(CALL_ACTIVITY_ID);
assertNotNull(callActivity);
// complete ////////////////////////////////////////////////////////
close(subCaseInstanceId);
assertCaseEnded(subCaseInstanceId);
runtimeService.deleteProcessInstance(superProcessInstanceId, null);
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution 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);
}
}
Aggregations