} else if (cancelEventDefinition != null) {
if (scope.getProperty("type")==null || !scope.getProperty("type").equals("transaction")) {
addError("end event with cancelEventDefinition only supported inside transaction subprocess", cancelEventDefinition);
} else {
activity.setProperty("type", "cancelEndEvent");
activity.setActivityBehavior(new CancelEndEventActivityBehavior());
}
} else if (terminateEventDefinition != null) {
activity.setProperty("type", "terminateEndEvent");
activity.setActivityBehavior(new TerminateEndEventActivityBehavior());
activity.setCancelScope(true);