本文整理汇总了Java中org.camunda.bpm.engine.delegate.BpmnError类的典型用法代码示例。如果您正苦于以下问题:Java BpmnError类的具体用法?Java BpmnError怎么用?Java BpmnError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BpmnError类属于org.camunda.bpm.engine.delegate包,在下文中一共展示了BpmnError类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: execute
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
public void execute(DelegateExecution ctx) throws Exception {
CreateChargeRequest request = new CreateChargeRequest();
request.amount = (int) ctx.getVariable("remainingAmount");
CreateChargeResponse response = rest.postForObject( //
stripeChargeUrl, //
request, //
CreateChargeResponse.class);
// TODO Add error scenarios to StripeFake and then raise "Error_CreditCardError" here
if (response.errorCode!=null) {
ctx.setVariable("errorCode", response.errorCode);
throw new BpmnError("Error_PaymentError");
}
ctx.setVariable("paymentTransactionId", response.transactionId);
}
开发者ID:flowing,项目名称:flowing-retail,代码行数:18,代码来源:ChargeCreditCardAdapter.java
示例2: testConnectorBpmnErrorThrownInScriptResourceNoAsyncAfterJobIsCreated
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources="org/camunda/connect/plugin/ConnectProcessEnginePluginTest.testConnectorBpmnErrorThrownInScriptResourceNoAsyncAfterJobIsCreated.bpmn")
public void testConnectorBpmnErrorThrownInScriptResourceNoAsyncAfterJobIsCreated() {
// given
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("throwInMapping", "in");
variables.put("exception", new BpmnError("error"));
// when
runtimeService.startProcessInstanceByKey("testProcess", variables);
// then
// we will only reach the user task if the BPMNError from the script was handled by the boundary event
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
// no job is created
assertThat(Long.valueOf(managementService.createJobQuery().count()), is(0l));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:ConnectProcessEnginePluginTest.java
示例3: evaluate
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Override
public Object evaluate(ScriptEngine engine, VariableScope variableScope, Bindings bindings) {
if (shouldBeCompiled) {
compileScript(engine);
}
if (getCompiledScript() != null) {
return super.evaluate(engine, variableScope, bindings);
}
else {
try {
return evaluateScript(engine, bindings);
} catch (ScriptException e) {
if (e.getCause() instanceof BpmnError) {
throw (BpmnError) e.getCause();
}
String activityIdMessage = getActivityIdExceptionMessage(variableScope);
throw new ScriptEvaluationException("Unable to evaluate script" + activityIdMessage + ":" + e.getMessage(), e);
}
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:SourceExecutableScript.java
示例4: testUncaughtError
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources = {
"org/camunda/bpm/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:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:BoundaryErrorEventTest.java
示例5: testUncaughtErrorOnCallActivity
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources = {
"org/camunda/bpm/engine/test/bpmn/event/error/BoundaryErrorEventTest.testUncaughtErrorOnCallActivity-parent.bpmn20.xml",
"org/camunda/bpm/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:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:BoundaryErrorEventTest.java
示例6: execute
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
public void execute(DelegateExecution execution) throws Exception {
Integer executionsBeforeError = (Integer) execution.getVariable("executionsBeforeError");
Integer executions = (Integer) execution.getVariable("executions");
Boolean exceptionType = (Boolean) execution.getVariable("exceptionType");
if (executions == null) {
executions = 0;
}
executions++;
if (executionsBeforeError == null || executionsBeforeError < executions) {
if (exceptionType != null && exceptionType) {
throw new MyBusinessException("This is a business exception, which can be caught by a BPMN Error Event.");
} else {
throw new BpmnError("23", "This is a business fault, which can be caught by a BPMN Error Event.");
}
} else {
execution.setVariable("executions", executions);
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:ThrowBpmnErrorDelegate.java
示例7: execute
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Override
public void execute(final DelegateExecution execution) throws Exception {
final String type = Variable.TYPE.getValue(execution);
log.info("\n-----\n determineDmnTable\ntable={}\n-----\n", type);
if (repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(type).latestVersion().singleResult() == null) {
log.error("no decisionTable found for key: {}", type);
throw new BpmnError("NoDmnTableFound");
} else {
TaskAssignmentProcess.VARIABLES.DMN_TABLE.setValue(execution, type);
}
}
开发者ID:holisticon,项目名称:holunda,代码行数:15,代码来源:DetermineDmnTableDelegate.java
示例8: raises_bpmnError
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Test
public void raises_bpmnError() throws Exception {
eventBus.get().on(Selectors.matchAll(), new Consumer<Event<String>>() {
@Override
public void accept(Event<String> event) {
throw new BpmnError("error");
}
});
thrown.expect(BpmnError.class);
eventBus.get().notify(Selectors.$("any"), Event.wrap("event"));
}
开发者ID:camunda,项目名称:camunda-bpm-reactor,代码行数:15,代码来源:CamundaEventBusTest.java
示例9: onExecutionThrowBpmnError
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Override
public void onExecutionThrowBpmnError(final BpmnError bpmnError) {
doAnswer(new JavaDelegate() {
@Override
public void execute(final DelegateExecution execution) throws Exception {
throw bpmnError;
}
});
}
开发者ID:camunda,项目名称:camunda-bpm-mockito,代码行数:11,代码来源:FluentJavaDelegateMock.java
示例10: onExecutionThrowBpmnError
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Override
public void onExecutionThrowBpmnError(final BpmnError bpmnError) {
doAnswer(new ExecutionListener() {
@Override
public void notify(final DelegateExecution execution) throws Exception {
throw bpmnError;
}
});
}
开发者ID:camunda,项目名称:camunda-bpm-mockito,代码行数:11,代码来源:FluentExecutionListenerMock.java
示例11: onExecutionThrowBpmnError
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Override
public void onExecutionThrowBpmnError(final BpmnError bpmnError) {
doAnswer(new TaskListener() {
@Override
public void notify(final DelegateTask delegateTask) {
throw bpmnError;
}
});
}
开发者ID:camunda,项目名称:camunda-bpm-mockito,代码行数:11,代码来源:FluentTaskListenerMock.java
示例12: processingAutomatically
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Given("the contract processing $verb")
public void processingAutomatically(final String verb) {
final boolean withErrors = parseStatement("succeeds", verb, false);
if (withErrors) {
doThrow(new BpmnError(Events.ERROR_PROCESS_AUTOMATICALLY_FAILED)).when(simpleProcessAdapter).processContract();
}
}
开发者ID:camunda,项目名称:camunda-bpm-jbehave,代码行数:8,代码来源:SimpleProcessSteps.java
示例13: testConnectorBpmnErrorThrownInScriptInputMappingIsHandledByBoundaryEvent
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources="org/camunda/connect/plugin/ConnectProcessEnginePluginTest.testConnectorWithThrownExceptionInScriptInputOutputMapping.bpmn")
public void testConnectorBpmnErrorThrownInScriptInputMappingIsHandledByBoundaryEvent() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("throwInMapping", "in");
variables.put("exception", new BpmnError("error"));
runtimeService.startProcessInstanceByKey("testProcess", variables);
//we will only reach the user task if the BPMNError from the script was handled by the boundary event
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:11,代码来源:ConnectProcessEnginePluginTest.java
示例14: testConnectorBpmnErrorThrownInScriptOutputMappingIsHandledByBoundaryEvent
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources="org/camunda/connect/plugin/ConnectProcessEnginePluginTest.testConnectorWithThrownExceptionInScriptInputOutputMapping.bpmn")
public void testConnectorBpmnErrorThrownInScriptOutputMappingIsHandledByBoundaryEvent() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("throwInMapping", "out");
variables.put("exception", new BpmnError("error"));
runtimeService.startProcessInstanceByKey("testProcess", variables);
//we will only reach the user task if the BPMNError from the script was handled by the boundary event
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:11,代码来源:ConnectProcessEnginePluginTest.java
示例15: testConnectorBpmnErrorThrownInScriptResourceOutputMappingIsHandledByBoundaryEvent
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources="org/camunda/connect/plugin/ConnectProcessEnginePluginTest.testConnectorWithThrownExceptionInScriptResourceInputOutputMapping.bpmn")
public void testConnectorBpmnErrorThrownInScriptResourceOutputMappingIsHandledByBoundaryEvent() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("throwInMapping", "out");
variables.put("exception", new BpmnError("error"));
runtimeService.startProcessInstanceByKey("testProcess", variables);
//we will only reach the user task if the BPMNError from the script was handled by the boundary event
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:11,代码来源:ConnectProcessEnginePluginTest.java
示例16: evaluate
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
public Object evaluate(ScriptEngine scriptEngine, VariableScope variableScope, Bindings bindings) {
try {
LOG.debugEvaluatingCompiledScript(language);
return getCompiledScript().eval(bindings);
} catch (ScriptException e) {
if (e.getCause() instanceof BpmnError) {
throw (BpmnError) e.getCause();
}
String activityIdMessage = getActivityIdExceptionMessage(variableScope);
throw new ScriptEvaluationException("Unable to evaluate script" + activityIdMessage +": " + e.getMessage(), e);
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:13,代码来源:CompiledExecutableScript.java
示例17: propagateException
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
/**
* Decides how to propagate the exception properly, e.g. as bpmn error or "normal" error.
* @param execution the current execution
* @param ex the exception to propagate
* @throws Exception if no error handler could be found
*/
protected void propagateException(ActivityExecution execution, Exception ex) throws Exception {
BpmnError bpmnError = checkIfCauseOfExceptionIsBpmnError(ex);
if (bpmnError != null) {
propagateBpmnError(bpmnError, execution);
} else {
propagateExceptionAsError(ex, execution);
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:AbstractBpmnActivityBehavior.java
示例18: FAILING_testBpmnErrorInScriptInputMapping
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/iomapping/InputOutputTest.testThrowErrorInScriptInputOutputMapping.bpmn")
public void FAILING_testBpmnErrorInScriptInputMapping() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("throwInMapping", "in");
variables.put("exception", new BpmnError("error"));
runtimeService.startProcessInstanceByKey("testProcess", variables);
//we will only reach the user task if the BPMNError from the script was handled by the boundary event
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:11,代码来源:InputOutputTest.java
示例19: FAILING_testBpmnErrorInScriptOutputMapping
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/iomapping/InputOutputTest.testThrowErrorInScriptInputOutputMapping.bpmn")
public void FAILING_testBpmnErrorInScriptOutputMapping() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("throwInMapping", "out");
variables.put("exception", new BpmnError("error"));
runtimeService.startProcessInstanceByKey("testProcess", variables);
//we will only reach the user task if the BPMNError from the script was handled by the boundary event
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:11,代码来源:InputOutputTest.java
示例20: handle
import org.camunda.bpm.engine.delegate.BpmnError; //导入依赖的package包/类
protected void handle(ActivityExecution execution, String action) throws Exception {
execution.setVariable(action, true);
String type = (String) execution.getVariable("type");
if ("error".equalsIgnoreCase(type)) {
throw new BpmnError("MyError");
}
else if ("exception".equalsIgnoreCase(type)) {
throw new MyBusinessException("MyException");
}
else if ("leave".equalsIgnoreCase(type)) {
execution.setVariable("type", null);
leave(execution);
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:ThrowErrorDelegate.java
注:本文中的org.camunda.bpm.engine.delegate.BpmnError类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论