use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class GatewayMappingValidator method validateParentScopeMigrates.
protected void validateParentScopeMigrates(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report) {
ActivityImpl sourceActivity = instruction.getSourceActivity();
ScopeImpl flowScope = sourceActivity.getFlowScope();
if (flowScope != flowScope.getProcessDefinition()) {
if (instructions.getInstructionsBySourceScope(flowScope).isEmpty()) {
report.addFailure("The gateway's flow scope '" + flowScope.getId() + "' must be mapped");
}
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class LegacyBehavior method removeLegacySubscriptionOnParent.
/**
* <p>Required for migrating active sequential MI receive tasks. These activities were formerly not scope,
* but are now. This has the following implications:
*
* <p>Before migration:
* <ul><li> the event subscription is attached to the miBody scope execution</ul>
*
* <p>After migration:
* <ul><li> a new subscription is created for every instance
* <li> the new subscription is attached to a dedicated scope execution as a child of the miBody scope
* execution</ul>
*
* <p>Thus, this method removes the subscription on the miBody scope
*/
public static void removeLegacySubscriptionOnParent(ExecutionEntity execution, EventSubscriptionEntity eventSubscription) {
ActivityImpl activity = execution.getActivity();
if (activity == null) {
return;
}
ActivityBehavior behavior = activity.getActivityBehavior();
ActivityBehavior parentBehavior = (ActivityBehavior) (activity.getFlowScope() != null ? activity.getFlowScope().getActivityBehavior() : null);
if (behavior instanceof ReceiveTaskActivityBehavior && parentBehavior instanceof MultiInstanceActivityBehavior) {
List<EventSubscriptionEntity> parentSubscriptions = execution.getParent().getEventSubscriptions();
for (EventSubscriptionEntity subscription : parentSubscriptions) {
// distinguish a boundary event on the mi body with the same message name from the receive task subscription
if (areEqualEventSubscriptions(subscription, eventSubscription)) {
subscription.delete();
}
}
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class PvmAtomicOperationActivityLeave method execute.
public void execute(PvmExecutionImpl execution) {
execution.activityInstanceDone();
ActivityBehavior activityBehavior = getActivityBehavior(execution);
if (activityBehavior instanceof FlowNodeActivityBehavior) {
FlowNodeActivityBehavior behavior = (FlowNodeActivityBehavior) activityBehavior;
ActivityImpl activity = execution.getActivity();
String activityInstanceId = execution.getActivityInstanceId();
if (activityInstanceId != null) {
LOG.debugLeavesActivityInstance(execution, activityInstanceId);
}
try {
behavior.doLeave(execution);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new PvmException("couldn't leave activity <" + activity.getProperty("type") + " id=\"" + activity.getId() + "\" ...>: " + e.getMessage(), e);
}
} else {
throw new PvmException("Behavior of current activity is not an instance of " + FlowNodeActivityBehavior.class.getSimpleName() + ". Execution " + execution);
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class DefaultConditionHandler method evaluateConditionStartByEventSubscription.
protected List<ConditionHandlerResult> evaluateConditionStartByEventSubscription(CommandContext commandContext, ConditionSet conditionSet) {
List<EventSubscriptionEntity> subscriptions = findConditionalStartEventSubscriptions(commandContext, conditionSet);
if (subscriptions.isEmpty()) {
throw LOG.exceptionWhenEvaluatingConditionalStartEvent();
}
List<ConditionHandlerResult> results = new ArrayList<ConditionHandlerResult>();
for (EventSubscriptionEntity subscription : subscriptions) {
ProcessDefinitionEntity processDefinition = subscription.getProcessDefinition();
if (!processDefinition.isSuspended()) {
ActivityImpl activity = subscription.getActivity();
if (evaluateCondition(conditionSet, activity)) {
results.add(new ConditionHandlerResult(processDefinition, activity));
}
}
}
return results;
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class TimerStartEventSubprocessJobHandler method execute.
public void execute(TimerJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
String activityId = configuration.getTimerElementKey();
ActivityImpl eventSubprocessActivity = execution.getProcessDefinition().findActivity(activityId);
if (eventSubprocessActivity != null) {
execution.executeEventHandlerActivity(eventSubprocessActivity);
} else {
throw new ProcessEngineException("Error while triggering event subprocess using timer start event: cannot find activity with id '" + configuration + "'.");
}
}
Aggregations