|
28 | 28 | import org.imixs.workflow.bpmn.BPMNUtil; |
29 | 29 | import org.imixs.workflow.exceptions.ModelException; |
30 | 30 | import org.imixs.workflow.exceptions.PluginException; |
| 31 | +import org.imixs.workflow.exceptions.ProcessingErrorException; |
31 | 32 | import org.openbpmn.bpmn.BPMNModel; |
32 | 33 | import org.openbpmn.bpmn.BPMNNS; |
33 | 34 | import org.openbpmn.bpmn.elements.Activity; |
@@ -293,7 +294,16 @@ public ItemCollection nextModelElement(BPMNModel model, ItemCollection event, It |
293 | 294 | node -> ((BPMNUtil.isImixsTaskElement(node)) |
294 | 295 | || (BPMNUtil.isImixsEventElement(node)) |
295 | 296 | || (BPMNUtil.isParallelGatewayElement(node))), |
296 | | - condition -> evaluateCondition(condition, workitem)); |
| 297 | + condition -> { |
| 298 | + try { |
| 299 | + return evaluateCondition(condition, workitem); |
| 300 | + } catch (ModelException e) { |
| 301 | + // catch Model Exception and translate it into a Runtime Exception because of |
| 302 | + // the Lambda expression used here |
| 303 | + throw new ProcessingErrorException(e.getErrorContext(), e.getErrorCode(), e.getMessage(), |
| 304 | + e); |
| 305 | + } |
| 306 | + }); |
297 | 307 |
|
298 | 308 | while (elementNavigator.hasNext()) { |
299 | 309 | BPMNElementNode nextElement = elementNavigator.next(); |
@@ -689,18 +699,16 @@ public String findDataObject(ItemCollection bpmnElement, String name) { |
689 | 699 | * @param workitem the workflow item providing context data for condition |
690 | 700 | * evaluation |
691 | 701 | * @return true if the condition evaluates to true, false otherwise |
| 702 | + * @throws ModelException |
692 | 703 | */ |
693 | | - public boolean evaluateCondition(String expression, ItemCollection workitem) { |
694 | | - |
| 704 | + public boolean evaluateCondition(String expression, ItemCollection workitem) throws ModelException { |
695 | 705 | // delegate expression to the runtime |
696 | 706 | String finalExpression = this.workflowContext.evalConditionalExpression(expression, workitem); |
697 | 707 | try { |
698 | 708 | return getRuleEngine().evaluateBooleanExpression(finalExpression, workitem); |
699 | 709 | } catch (PluginException e) { |
700 | | - e.printStackTrace(); |
701 | | - logger.severe("Failed to evaluate Condition: " + e.getMessage()); |
| 710 | + throw new ModelException(e.getErrorCode(), e.getMessage(), e); |
702 | 711 | } |
703 | | - return false; |
704 | 712 | } |
705 | 713 |
|
706 | 714 | /** |
|
0 commit comments