Search in sources :

Example 1 with SignallableActivityBehavior

use of org.activiti.engine.impl.pvm.delegate.SignallableActivityBehavior in project Activiti by Activiti.

the class ExecutionEntity method signal.

// methods that translate to operations /////////////////////////////////////
public void signal(String signalName, Object signalData) {
    ensureActivityInitialized();
    SignallableActivityBehavior activityBehavior = (SignallableActivityBehavior) activity.getActivityBehavior();
    try {
        String signalledActivityId = activity.getId();
        activityBehavior.signal(this, signalName, signalData);
        // If needed, dispatch an event indicating an activity was signalled
        boolean isUserTask = (activityBehavior instanceof UserTaskActivityBehavior) || ((activityBehavior instanceof MultiInstanceActivityBehavior) && ((MultiInstanceActivityBehavior) activityBehavior).getInnerActivityBehavior() instanceof UserTaskActivityBehavior);
        if (!isUserTask && Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
            Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createSignalEvent(ActivitiEventType.ACTIVITY_SIGNALED, signalledActivityId, signalName, signalData, this.id, this.processInstanceId, this.processDefinitionId));
        }
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new PvmException("couldn't process signal '" + signalName + "' on activity '" + activity.getId() + "': " + e.getMessage(), e);
    }
}
Also used : UserTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior) SignallableActivityBehavior(org.activiti.engine.impl.pvm.delegate.SignallableActivityBehavior) PvmException(org.activiti.engine.impl.pvm.PvmException) ActivitiException(org.activiti.engine.ActivitiException) PvmException(org.activiti.engine.impl.pvm.PvmException) MultiInstanceActivityBehavior(org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior)

Example 2 with SignallableActivityBehavior

use of org.activiti.engine.impl.pvm.delegate.SignallableActivityBehavior in project Activiti by Activiti.

the class ExecutionImpl method signal.

// methods that translate to operations /////////////////////////////////////
public void signal(String signalName, Object signalData) {
    ensureActivityInitialized();
    SignallableActivityBehavior activityBehavior = (SignallableActivityBehavior) activity.getActivityBehavior();
    try {
        activityBehavior.signal(this, signalName, signalData);
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new PvmException("couldn't process signal '" + signalName + "' on activity '" + activity.getId() + "': " + e.getMessage(), e);
    }
}
Also used : SignallableActivityBehavior(org.activiti.engine.impl.pvm.delegate.SignallableActivityBehavior) PvmException(org.activiti.engine.impl.pvm.PvmException) PvmException(org.activiti.engine.impl.pvm.PvmException)

Aggregations

PvmException (org.activiti.engine.impl.pvm.PvmException)2 SignallableActivityBehavior (org.activiti.engine.impl.pvm.delegate.SignallableActivityBehavior)2 ActivitiException (org.activiti.engine.ActivitiException)1 MultiInstanceActivityBehavior (org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior)1 UserTaskActivityBehavior (org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior)1