本文整理汇总了Java中org.activiti.engine.delegate.BpmnError类的典型用法代码示例。如果您正苦于以下问题:Java BpmnError类的具体用法?Java BpmnError怎么用?Java BpmnError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BpmnError类属于org.activiti.engine.delegate包,在下文中一共展示了BpmnError类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: propagateError
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
public static void propagateError(String errorCode, ActivityExecution execution) {
while (execution != null) {
String eventHandlerId = findLocalErrorEventHandler(execution, errorCode);
if (eventHandlerId != null) {
executeCatch(eventHandlerId, execution, errorCode);
break;
}
if (execution.isProcessInstanceType()) {
// dispatch process completed event
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.PROCESS_COMPLETED_WITH_ERROR_END_EVENT, execution));
}
}
execution = getSuperExecution(execution);
}
if (execution == null) {
throw new BpmnError(errorCode, "No catching boundary event found for error with errorCode '"
+ errorCode + "', neither in same process nor in parent process");
}
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:ErrorPropagation.java
示例2: execute
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
ActivityExecution activityExecution = (ActivityExecution) execution;
if (getLocalLoopVariable(activityExecution, getCollectionElementIndexVariable()) == null) {
try {
createInstances(activityExecution);
} catch (BpmnError error) {
ErrorPropagation.propagateError(error, activityExecution);
}
if (resolveNrOfInstances(activityExecution) == 0) {
leave(activityExecution);
}
} else {
innerActivityBehavior.execute(execution);
}
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:18,代码来源:MultiInstanceActivityBehavior.java
示例3: handleException
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
/**
* Handles any exception thrown by an Activiti task.
*
* @param execution The execution which identifies the task.
* @param exception The exception that has been thrown
*
* @throws Exception Some exceptions may choose to bubble up the exception
*/
protected void handleException(DelegateExecution execution, Exception exception) throws Exception
{
// Set the error status and stack trace as workflow variables.
activitiRuntimeHelper.setTaskErrorInWorkflow(execution, exception.getMessage(), exception);
// Continue throwing the original exception and let workflow handle it with a Boundary event handler.
if (exception instanceof BpmnError)
{
throw exception;
}
// Log the error if the exception should be reported.
if (errorInformationExceptionHandler.isReportableError(exception))
{
LOGGER.error("{} Unexpected error occurred during task. activitiTaskName=\"{}\"", activitiHelper.getProcessIdentifyingInformation(execution),
getClass().getSimpleName(), exception);
}
}
开发者ID:FINRAOS,项目名称:herd,代码行数:27,代码来源:BaseJavaDelegate.java
示例4: executeImpl
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
@Override
@SuppressWarnings("all")
public void executeImpl(DelegateExecution execution) throws Exception
{
if (activitiHelper.getExpressionVariableAsString(exceptionToThrow, execution) != null)
{
if (activitiHelper.getExpressionVariableAsString(exceptionToThrow, execution).equals(EXCEPTION_BPMN_ERROR))
{
throw new BpmnError(EXCEPTION_BPMN_ERROR);
}
else if (activitiHelper.getExpressionVariableAsString(exceptionToThrow, execution).equals(EXCEPTION_RUNTIME))
{
throw new RuntimeException(EXCEPTION_RUNTIME);
}
}
}
开发者ID:FINRAOS,项目名称:herd,代码行数:17,代码来源:MockJavaDelegate.java
示例5: leave
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
/**
* Called when the wrapped {@link ActivityBehavior} calls the
* {@link AbstractBpmnActivityBehavior#leave(ActivityExecution)} method.
* Handles the completion of one instance, and executes the logic for the sequential behavior.
*/
public void leave(ActivityExecution execution) {
callActivityEndListeners(execution);
int loopCounter = getLoopVariable(execution, LOOP_COUNTER) + 1;
int nrOfInstances = getLoopVariable(execution, NUMBER_OF_INSTANCES);
int nrOfCompletedInstances = getLoopVariable(execution, NUMBER_OF_COMPLETED_INSTANCES) + 1;
int nrOfActiveInstances = getLoopVariable(execution, NUMBER_OF_ACTIVE_INSTANCES);
setLoopVariable(execution, LOOP_COUNTER, loopCounter);
setLoopVariable(execution, NUMBER_OF_COMPLETED_INSTANCES, nrOfCompletedInstances);
logLoopDetails(execution, "instance completed", loopCounter, nrOfCompletedInstances, nrOfActiveInstances, nrOfInstances);
if (loopCounter == nrOfInstances || completionConditionSatisfied(execution)) {
super.leave(execution);
} else {
try {
executeOriginalBehavior(execution, loopCounter);
} catch (BpmnError error) {
// re-throw business fault so that it can be caught by an Error Intermediate Event or Error Event Sub-Process in the process
throw error;
} catch (Exception e) {
throw new ActivitiException("Could not execute inner activity behavior of multi instance behavior", e);
}
}
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:31,代码来源:SequentialMultiInstanceBehavior.java
示例6: testUncaughtError
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources = {
"org/activiti/engine/test/bpmn/event/error/BoundaryErrorEventTest.subprocess.bpmn20.xml"
})
public void testUncaughtError() {
runtimeService.startProcessInstanceByKey("simpleSubProcess");
Task task = taskService.createTaskQuery().singleResult();
assertEquals("Task in subprocess", task.getName());
try {
// Completing the task will reach the end error event,
// which is never caught in the process
taskService.complete(task.getId());
} catch (BpmnError e) {
assertTextPresent("No catching boundary event found for error with errorCode 'myError', neither in same process nor in parent process", e.getMessage());
}
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:17,代码来源:BoundaryErrorEventTest.java
示例7: testUncaughtErrorOnCallActivity
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources = {
"org/activiti/engine/test/bpmn/event/error/BoundaryErrorEventTest.testUncaughtErrorOnCallActivity-parent.bpmn20.xml",
"org/activiti/engine/test/bpmn/event/error/BoundaryErrorEventTest.subprocess.bpmn20.xml"
})
public void testUncaughtErrorOnCallActivity() {
runtimeService.startProcessInstanceByKey("uncaughtErrorOnCallActivity");
Task task = taskService.createTaskQuery().singleResult();
assertEquals("Task in subprocess", task.getName());
try {
// Completing the task will reach the end error event,
// which is never caught in the process
taskService.complete(task.getId());
} catch (BpmnError e) {
assertTextPresent("No catching boundary event found for error with errorCode 'myError', neither in same process nor in parent process", e.getMessage());
}
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:18,代码来源:BoundaryErrorEventTest.java
示例8: execute
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
public void execute(DelegateExecution execution) {
Integer executionsBeforeError = (Integer) execution.getVariable("executionsBeforeError");
Integer executions = (Integer) execution.getVariable("executions");
if (executions == null) {
executions = 0;
}
executions++;
if (executionsBeforeError == null || executionsBeforeError < executions) {
throw new BpmnError("23", "This is a business fault, which can be caught by a BPMN Error Event.");
} else {
execution.setVariable("executions", executions);
}
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:14,代码来源:ThrowBpmnErrorDelegate.java
示例9: execute
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
ActivityExecution activityExecution = (ActivityExecution) execution;
if (Context.getProcessEngineConfiguration().isEnableProcessDefinitionInfoCache()) {
ObjectNode taskElementProperties = Context.getBpmnOverrideElementProperties(serviceTaskId, execution.getProcessDefinitionId());
if (taskElementProperties != null && taskElementProperties.has(DynamicBpmnConstants.SERVICE_TASK_CLASS_NAME)) {
String overrideClassName = taskElementProperties.get(DynamicBpmnConstants.SERVICE_TASK_CLASS_NAME).asText();
if (StringUtils.isNotEmpty(overrideClassName) && !overrideClassName.equals(className)) {
className = overrideClassName;
activityBehaviorInstance = null;
}
}
}
if (activityBehaviorInstance == null) {
activityBehaviorInstance = getActivityBehaviorInstance(activityExecution);
}
try {
activityBehaviorInstance.execute(execution);
} catch (BpmnError error) {
ErrorPropagation.propagateError(error, activityExecution);
} catch (RuntimeException e) {
if (!ErrorPropagation.mapException(e, activityExecution, mapExceptions))
throw e;
}
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:29,代码来源:ClassDelegate.java
示例10: execute
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
ActivityExecution activityExecution = (ActivityExecution) execution;
ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
if (Context.getProcessEngineConfiguration().isEnableProcessDefinitionInfoCache()) {
ObjectNode taskElementProperties = Context.getBpmnOverrideElementProperties(scriptTaskId, execution.getProcessDefinitionId());
if (taskElementProperties != null && taskElementProperties.has(DynamicBpmnConstants.SCRIPT_TASK_SCRIPT)) {
String overrideScript = taskElementProperties.get(DynamicBpmnConstants.SCRIPT_TASK_SCRIPT).asText();
if (StringUtils.isNotEmpty(overrideScript) && !overrideScript.equals(script)) {
script = overrideScript;
}
}
}
boolean noErrors = true;
try {
Object result = scriptingEngines.evaluate(script, language, execution, storeScriptVariables);
if (resultVariable != null) {
execution.setVariable(resultVariable, result);
}
} catch (ActivitiException e) {
LOGGER.warn("Exception while executing {} : {}", activityExecution.getActivity().getId(), e.getMessage());
noErrors = false;
Throwable rootCause = ExceptionUtils.getRootCause(e);
if (rootCause instanceof BpmnError) {
ErrorPropagation.propagateError((BpmnError) rootCause, activityExecution);
} else {
throw e;
}
}
if (noErrors) {
leave(activityExecution);
}
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:40,代码来源:ScriptTaskActivityBehavior.java
示例11: leave
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
/**
* Called when the wrapped {@link ActivityBehavior} calls the {@link AbstractBpmnActivityBehavior#leave(ActivityExecution)} method. Handles the completion of one instance, and executes the logic
* for the sequential behavior.
*/
@Override
public void leave(ActivityExecution execution) {
int loopCounter = getLoopVariable(execution, getCollectionElementIndexVariable()) + 1;
int nrOfInstances = getLoopVariable(execution, NUMBER_OF_INSTANCES);
int nrOfCompletedInstances = getLoopVariable(execution, NUMBER_OF_COMPLETED_INSTANCES) + 1;
int nrOfActiveInstances = getLoopVariable(execution, NUMBER_OF_ACTIVE_INSTANCES);
if (loopCounter != nrOfInstances && !completionConditionSatisfied(execution)) {
callActivityEndListeners(execution);
}
setLoopVariable(execution, getCollectionElementIndexVariable(), loopCounter);
setLoopVariable(execution, NUMBER_OF_COMPLETED_INSTANCES, nrOfCompletedInstances);
logLoopDetails(execution, "instance completed", loopCounter, nrOfCompletedInstances, nrOfActiveInstances, nrOfInstances);
if (loopCounter >= nrOfInstances || completionConditionSatisfied(execution)) {
super.leave(execution);
} else {
try {
executeOriginalBehavior(execution, loopCounter);
} catch (BpmnError error) {
// re-throw business fault so that it can be caught by an Error Intermediate Event or Error Event Sub-Process in the process
throw error;
} catch (Exception e) {
throw new ActivitiException("Could not execute inner activity behavior of multi instance behavior", e);
}
}
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:33,代码来源:SequentialMultiInstanceBehavior.java
示例12: execute
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
public void execute(DelegateExecution execution) throws Exception {
boolean result = (Boolean)execution.getVariable("result");
if (result) {
System.out.println("转账成功");
} else {
System.out.println("转账失败,抛出错误");
throw new BpmnError("transferError");
}
}
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:10,代码来源:ValidateTransferDelegate.java
示例13: executeCatchInSuperProcess
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
private static void executeCatchInSuperProcess(String errorCode, ActivityExecution superExecution) {
String errorHandlerId = findLocalErrorEventHandler(superExecution, errorCode);
if (errorHandlerId != null) {
executeCatch(errorHandlerId, superExecution);
} else { // no matching catch found, going one level up in process hierarchy
ActivityExecution superSuperExecution = getSuperExecution(superExecution);
if (superSuperExecution != null) {
executeCatchInSuperProcess(errorCode, superSuperExecution);
} else {
throw new BpmnError(errorCode, "No catching boundary event found for error with errorCode '"
+ errorCode + "', neither in same process nor in parent process");
}
}
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:15,代码来源:ErrorPropagation.java
示例14: execute
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
if (activityBehaviorInstance == null) {
activityBehaviorInstance = getActivityBehaviorInstance(execution);
}
try {
activityBehaviorInstance.execute(execution);
} catch (BpmnError error) {
ErrorPropagation.propagateError(error, execution);
}
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:11,代码来源:ClassDelegate.java
示例15: execute
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
if (getLoopVariable(execution, LOOP_COUNTER) == null) {
try {
createInstances(execution);
} catch (BpmnError error) {
ErrorPropagation.propagateError(error, execution);
}
} else {
innerActivityBehavior.execute(execution);
}
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:12,代码来源:MultiInstanceActivityBehavior.java
示例16: execute
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
ScriptingEngines scriptingEngines = Context
.getProcessEngineConfiguration()
.getScriptingEngines();
boolean noErrors = true;
try {
Object result = scriptingEngines.evaluate(script, language, execution);
if (resultVariable != null) {
execution.setVariable(resultVariable, result);
}
String resultString = "";
if (result != null)
resultString = result.toString();
setDataObjectValues(execution, resultString);
} catch (ActivitiException e) {
noErrors = false;
if (e.getCause() instanceof ScriptException
&& e.getCause().getCause() instanceof ScriptException
&& e.getCause().getCause().getCause() instanceof BpmnError) {
ErrorPropagation.propagateError((BpmnError) e.getCause().getCause().getCause(), execution);
} else {
throw e;
}
}
if (noErrors) {
leave(execution);
}
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:34,代码来源:ScriptTaskActivityBehavior.java
示例17: testUncaughtErrorThrownByJavaDelegateOnServiceTask
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources = {
"org/activiti/engine/test/bpmn/event/error/BoundaryErrorEventTest.testCatchErrorThrownByJavaDelegateOnCallActivity-child.bpmn20.xml"
})
public void testUncaughtErrorThrownByJavaDelegateOnServiceTask() {
try {
runtimeService.startProcessInstanceByKey("catchErrorThrownByJavaDelegateOnCallActivity-child");
} catch (BpmnError e) {
assertTextPresent("No catching boundary event found for error with errorCode '23', neither in same process nor in parent process", e.getMessage());
}
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:11,代码来源:BoundaryErrorEventTest.java
示例18: testUncaughtErrorThrownByJavaDelegateOnCallActivity
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources = {
"org/activiti/engine/test/bpmn/event/error/BoundaryErrorEventTest.testUncaughtErrorThrownByJavaDelegateOnCallActivity-parent.bpmn20.xml",
"org/activiti/engine/test/bpmn/event/error/BoundaryErrorEventTest.testCatchErrorThrownByJavaDelegateOnCallActivity-child.bpmn20.xml"
})
public void testUncaughtErrorThrownByJavaDelegateOnCallActivity() {
try {
runtimeService.startProcessInstanceByKey("uncaughtErrorThrownByJavaDelegateOnCallActivity-parent");
} catch (BpmnError e) {
assertTextPresent("No catching boundary event found for error with errorCode '23', neither in same process nor in parent process", e.getMessage());
}
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:12,代码来源:BoundaryErrorEventTest.java
示例19: execute
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
public void execute(DelegateExecution execution) throws Exception {
Integer executionsBeforeError = (Integer) execution.getVariable("executionsBeforeError");
Integer executions = (Integer) execution.getVariable("executions");
if (executions == null) {
executions = 0;
}
executions++;
if (executionsBeforeError == null || executionsBeforeError < executions) {
throw new BpmnError("23", "This is a business fault, which can be caught by a BPMN Error Event.");
} else {
execution.setVariable("executions", executions);
}
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:14,代码来源:ThrowBpmnErrorDelegate.java
示例20: execute
import org.activiti.engine.delegate.BpmnError; //导入依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
if (getLocalLoopVariable(execution, LOOP_COUNTER) == null) {
try {
createInstances(execution);
} catch (BpmnError error) {
ErrorPropagation.propagateError(error, execution);
}
} else {
innerActivityBehavior.execute(execution);
}
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:12,代码来源:MultiInstanceActivityBehavior.java
注:本文中的org.activiti.engine.delegate.BpmnError类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论