Search in sources :

Example 1 with PvmException

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

the class AbstractEventAtomicOperation method execute.

public void execute(T execution) {
    CoreModelElement scope = getScope(execution);
    List<DelegateListener<? extends BaseDelegateExecution>> listeners = getListeners(scope, execution);
    int listenerIndex = execution.getListenerIndex();
    if (listenerIndex == 0) {
        execution = eventNotificationsStarted(execution);
    }
    if (!isSkipNotifyListeners(execution)) {
        if (listeners.size() > listenerIndex) {
            execution.setEventName(getEventName());
            execution.setEventSource(scope);
            DelegateListener<? extends BaseDelegateExecution> listener = listeners.get(listenerIndex);
            try {
                execution.setListenerIndex(listenerIndex + 1);
                execution.invokeListener(listener);
            } catch (RuntimeException e) {
                throw e;
            } catch (Exception e) {
                throw new PvmException("couldn't execute event listener : " + e.getMessage(), e);
            }
            execution.performOperationSync(this);
        } else {
            execution.setListenerIndex(0);
            execution.setEventName(null);
            execution.setEventSource(null);
            eventNotificationsCompleted(execution);
        }
    } else {
        eventNotificationsCompleted(execution);
    }
}
Also used : BaseDelegateExecution(org.camunda.bpm.engine.delegate.BaseDelegateExecution) DelegateListener(org.camunda.bpm.engine.delegate.DelegateListener) CoreModelElement(org.camunda.bpm.engine.impl.core.model.CoreModelElement) PvmException(org.camunda.bpm.engine.impl.pvm.PvmException) PvmException(org.camunda.bpm.engine.impl.pvm.PvmException)

Example 2 with PvmException

use of org.camunda.bpm.engine.impl.pvm.PvmException 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);
    }
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) FlowNodeActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.FlowNodeActivityBehavior) ActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior) ActivityBehaviorUtil.getActivityBehavior(org.camunda.bpm.engine.impl.util.ActivityBehaviorUtil.getActivityBehavior) FlowNodeActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.FlowNodeActivityBehavior) PvmException(org.camunda.bpm.engine.impl.pvm.PvmException) PvmException(org.camunda.bpm.engine.impl.pvm.PvmException)

Example 3 with PvmException

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

the class LogUtil method readJavaUtilLoggingConfigFromClasspath.

public static void readJavaUtilLoggingConfigFromClasspath() {
    InputStream inputStream = ReflectUtil.getResourceAsStream("logging.properties");
    try {
        if (inputStream != null) {
            LogManager.getLogManager().readConfiguration(inputStream);
            String redirectCommons = LogManager.getLogManager().getProperty("redirect.commons.logging");
            if ((redirectCommons != null) && (!redirectCommons.equalsIgnoreCase("false"))) {
                System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");
            }
        }
    } catch (Exception e) {
        throw new PvmException("couldn't initialize logging properly", e);
    } finally {
        IoUtil.closeSilently(inputStream);
    }
}
Also used : InputStream(java.io.InputStream) PvmException(org.camunda.bpm.engine.impl.pvm.PvmException) PvmException(org.camunda.bpm.engine.impl.pvm.PvmException)

Example 4 with PvmException

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

the class FoxAtomicOperationDeleteCascadeFireActivityEnd method execute.

@Override
public void execute(PvmExecutionImpl execution) {
    ScopeImpl scope = getScope(execution);
    int executionListenerIndex = execution.getListenerIndex();
    List<DelegateListener<? extends BaseDelegateExecution>> executionListeners = scope.getListeners(getEventName());
    for (DelegateListener<? extends BaseDelegateExecution> listener : executionListeners) {
        execution.setEventName(getEventName());
        execution.setEventSource(scope);
        try {
            execution.invokeListener(listener);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new PvmException("couldn't execute event listener : " + e.getMessage(), e);
        }
        executionListenerIndex += 1;
        execution.setListenerIndex(executionListenerIndex);
    }
    execution.setListenerIndex(0);
    execution.setEventName(null);
    execution.setEventSource(null);
    eventNotificationsCompleted(execution);
}
Also used : BaseDelegateExecution(org.camunda.bpm.engine.delegate.BaseDelegateExecution) DelegateListener(org.camunda.bpm.engine.delegate.DelegateListener) ScopeImpl(org.camunda.bpm.engine.impl.pvm.process.ScopeImpl) PvmException(org.camunda.bpm.engine.impl.pvm.PvmException) PvmException(org.camunda.bpm.engine.impl.pvm.PvmException)

Aggregations

PvmException (org.camunda.bpm.engine.impl.pvm.PvmException)4 BaseDelegateExecution (org.camunda.bpm.engine.delegate.BaseDelegateExecution)2 DelegateListener (org.camunda.bpm.engine.delegate.DelegateListener)2 InputStream (java.io.InputStream)1 FlowNodeActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.FlowNodeActivityBehavior)1 CoreModelElement (org.camunda.bpm.engine.impl.core.model.CoreModelElement)1 ActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)1 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)1 ScopeImpl (org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)1 ActivityBehaviorUtil.getActivityBehavior (org.camunda.bpm.engine.impl.util.ActivityBehaviorUtil.getActivityBehavior)1