use of org.camunda.bpm.engine.impl.bpmn.behavior.ConditionalEventBehavior in project camunda-bpm-platform by camunda.
the class ConditionalEventHandler method handleEvent.
@Override
public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, String businessKey, CommandContext commandContext) {
VariableEvent variableEvent;
if (payload == null || payload instanceof VariableEvent) {
variableEvent = (VariableEvent) payload;
} else {
throw new ProcessEngineException("Payload have to be " + VariableEvent.class.getName() + ", to evaluate condition.");
}
ActivityImpl activity = eventSubscription.getActivity();
ActivityBehavior activityBehavior = activity.getActivityBehavior();
if (activityBehavior instanceof ConditionalEventBehavior) {
ConditionalEventBehavior conditionalBehavior = (ConditionalEventBehavior) activityBehavior;
conditionalBehavior.leaveOnSatisfiedCondition(eventSubscription, variableEvent);
} else {
throw new ProcessEngineException("Conditional Event has not correct behavior: " + activityBehavior);
}
}
use of org.camunda.bpm.engine.impl.bpmn.behavior.ConditionalEventBehavior in project camunda-bpm-platform by camunda.
the class DefaultMigrationInstructionGenerator method generateInstructionsForActivities.
protected List<ValidatingMigrationInstruction> generateInstructionsForActivities(Collection<ActivityImpl> sourceActivities, Collection<ActivityImpl> targetActivities, boolean updateEventTriggers, ValidatingMigrationInstructions existingInstructions) {
List<ValidatingMigrationInstruction> generatedInstructions = new ArrayList<ValidatingMigrationInstruction>();
for (ActivityImpl sourceActivity : sourceActivities) {
if (!existingInstructions.containsInstructionForSourceScope(sourceActivity)) {
for (ActivityImpl targetActivity : targetActivities) {
if (isValidActivity(sourceActivity) && isValidActivity(targetActivity) && migrationActivityMatcher.matchActivities(sourceActivity, targetActivity)) {
// for conditional events the update event trigger must be set
boolean updateEventTriggersForInstruction = sourceActivity.getActivityBehavior() instanceof ConditionalEventBehavior || updateEventTriggers && UpdateEventTriggersValidator.definesPersistentEventTrigger(sourceActivity);
ValidatingMigrationInstruction generatedInstruction = new ValidatingMigrationInstructionImpl(sourceActivity, targetActivity, updateEventTriggersForInstruction);
generatedInstructions.add(generatedInstruction);
}
}
}
}
return generatedInstructions;
}
Aggregations