Search in sources :

Example 1 with SignallableActivityBehavior

use of org.camunda.bpm.engine.impl.pvm.delegate.SignallableActivityBehavior in project camunda-bpm-platform by camunda.

the class ServiceTaskDelegateExpressionActivityBehavior method doSignal.

public void doSignal(final ActivityExecution execution, final String signalName, final Object signalData) throws Exception {
    Object delegate = expression.getValue(execution);
    applyFieldDeclaration(fieldDeclarations, delegate);
    final ActivityBehavior activityBehaviorInstance = getActivityBehaviorInstance(execution, delegate);
    if (activityBehaviorInstance instanceof CustomActivityBehavior) {
        CustomActivityBehavior behavior = (CustomActivityBehavior) activityBehaviorInstance;
        ActivityBehavior delegateActivityBehavior = behavior.getDelegateActivityBehavior();
        if (!(delegateActivityBehavior instanceof SignallableActivityBehavior)) {
            // legacy behavior: do nothing when it is not a signallable activity behavior
            return;
        }
    }
    executeWithErrorPropagation(execution, new Callable<Void>() {

        @Override
        public Void call() throws Exception {
            ((SignallableActivityBehavior) activityBehaviorInstance).signal(execution, signalName, signalData);
            return null;
        }
    });
}
Also used : SignallableActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.SignallableActivityBehavior) SignallableActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.SignallableActivityBehavior) ActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)

Example 2 with SignallableActivityBehavior

use of org.camunda.bpm.engine.impl.pvm.delegate.SignallableActivityBehavior in project camunda-bpm-platform by camunda.

the class ClassDelegateActivityBehavior method doSignal.

protected void doSignal(final ActivityExecution execution, final String signalName, final Object signalData) throws Exception {
    final ActivityBehavior activityBehaviorInstance = getActivityBehaviorInstance(execution);
    if (activityBehaviorInstance instanceof CustomActivityBehavior) {
        CustomActivityBehavior behavior = (CustomActivityBehavior) activityBehaviorInstance;
        ActivityBehavior delegate = behavior.getDelegateActivityBehavior();
        if (!(delegate instanceof SignallableActivityBehavior)) {
            throw LOG.incorrectlyUsedSignalException(SignallableActivityBehavior.class.getName());
        }
    }
    executeWithErrorPropagation(execution, new Callable<Void>() {

        @Override
        public Void call() throws Exception {
            ((SignallableActivityBehavior) activityBehaviorInstance).signal(execution, signalName, signalData);
            return null;
        }
    });
}
Also used : SignallableActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.SignallableActivityBehavior) SignallableActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.SignallableActivityBehavior) ActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)

Aggregations

ActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)2 SignallableActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.SignallableActivityBehavior)2