From 3dc084404617d9506d47413a66bcb35c5e646bd5 Mon Sep 17 00:00:00 2001 From: Enrique Gonzalez Martinez Date: Thu, 6 Jun 2024 09:32:06 +0200 Subject: [PATCH] moving transformations --- .../java/org/jbpm/bpmn2/xml/AbstractNodeHandler.java | 9 ++++++++- .../process/instance/impl/XPATHReturnValueEvaluator.java | 2 +- ...-ServiceProcessWithMvelCollectionTransformation.bpmn2 | 2 +- .../BPMN2-ServiceProcessWithMvelJaxbTransformation.bpmn2 | 2 +- .../BPMN2-ServiceProcessWithMvelTransformation.bpmn2 | 2 +- .../start}/BPMN2-SignalStartWithTransformation.bpmn2 | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) rename jbpm/jbpm-tests/src/test/{resources => bpmn/org/jbpm/bpmn2/service}/BPMN2-ServiceProcessWithMvelCollectionTransformation.bpmn2 (97%) rename jbpm/jbpm-tests/src/test/{resources => bpmn/org/jbpm/bpmn2/service}/BPMN2-ServiceProcessWithMvelJaxbTransformation.bpmn2 (97%) rename jbpm/jbpm-tests/src/test/{resources => bpmn/org/jbpm/bpmn2/service}/BPMN2-ServiceProcessWithMvelTransformation.bpmn2 (97%) rename jbpm/jbpm-tests/src/test/{resources => bpmn/org/jbpm/bpmn2/start}/BPMN2-SignalStartWithTransformation.bpmn2 (95%) diff --git a/jbpm/jbpm-bpmn2/src/main/java/org/jbpm/bpmn2/xml/AbstractNodeHandler.java b/jbpm/jbpm-bpmn2/src/main/java/org/jbpm/bpmn2/xml/AbstractNodeHandler.java index 9ccdd9f0c04..cfbd83e0fba 100755 --- a/jbpm/jbpm-bpmn2/src/main/java/org/jbpm/bpmn2/xml/AbstractNodeHandler.java +++ b/jbpm/jbpm-bpmn2/src/main/java/org/jbpm/bpmn2/xml/AbstractNodeHandler.java @@ -39,6 +39,7 @@ import org.jbpm.bpmn2.core.Lane; import org.jbpm.bpmn2.core.SequenceFlow; import org.jbpm.bpmn2.core.Signal; +import org.jbpm.compiler.canonical.builtin.ReturnValueEvaluatorBuilderService; import org.jbpm.compiler.xml.Handler; import org.jbpm.compiler.xml.Parser; import org.jbpm.compiler.xml.ProcessBuildData; @@ -49,6 +50,8 @@ import org.jbpm.process.core.context.variable.Variable; import org.jbpm.process.core.context.variable.VariableScope; import org.jbpm.process.core.datatype.DataTypeResolver; +import org.jbpm.process.instance.impl.MVELInterpretedReturnValueEvaluator; +import org.jbpm.process.instance.impl.ReturnValueEvaluator; import org.jbpm.ruleflow.core.RuleFlowProcess; import org.jbpm.ruleflow.core.WorkflowElementIdentifierFactory; import org.jbpm.util.PatternConstants; @@ -572,7 +575,11 @@ private Transformation readTransformation(Element parent) { String lang = element.get().getAttribute("language"); String expression = element.get().getTextContent(); - return new Transformation(lang, expression); + ReturnValueEvaluator evaluator = null; + if (lang.toLowerCase().contains("mvel")) { + evaluator = new MVELInterpretedReturnValueEvaluator(expression); + } + return new Transformation(lang, expression, evaluator); } protected List readSources(org.w3c.dom.Node parent, Function variableResolver) { diff --git a/jbpm/jbpm-flow/src/main/java/org/jbpm/process/instance/impl/XPATHReturnValueEvaluator.java b/jbpm/jbpm-flow/src/main/java/org/jbpm/process/instance/impl/XPATHReturnValueEvaluator.java index 3c9fa372d66..8abd66e6265 100755 --- a/jbpm/jbpm-flow/src/main/java/org/jbpm/process/instance/impl/XPATHReturnValueEvaluator.java +++ b/jbpm/jbpm-flow/src/main/java/org/jbpm/process/instance/impl/XPATHReturnValueEvaluator.java @@ -42,7 +42,7 @@ public XPATHReturnValueEvaluator() { super("XPath", "true()"); } - public XPATHReturnValueEvaluator(final String expression) { + public XPATHReturnValueEvaluator(String expression) { super("XPath", expression); } diff --git a/jbpm/jbpm-tests/src/test/resources/BPMN2-ServiceProcessWithMvelCollectionTransformation.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/service/BPMN2-ServiceProcessWithMvelCollectionTransformation.bpmn2 similarity index 97% rename from jbpm/jbpm-tests/src/test/resources/BPMN2-ServiceProcessWithMvelCollectionTransformation.bpmn2 rename to jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/service/BPMN2-ServiceProcessWithMvelCollectionTransformation.bpmn2 index 69cbf479adf..ac0471bd5f3 100755 --- a/jbpm/jbpm-tests/src/test/resources/BPMN2-ServiceProcessWithMvelCollectionTransformation.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/service/BPMN2-ServiceProcessWithMvelCollectionTransformation.bpmn2 @@ -41,7 +41,7 @@ - + diff --git a/jbpm/jbpm-tests/src/test/resources/BPMN2-ServiceProcessWithMvelJaxbTransformation.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/service/BPMN2-ServiceProcessWithMvelJaxbTransformation.bpmn2 similarity index 97% rename from jbpm/jbpm-tests/src/test/resources/BPMN2-ServiceProcessWithMvelJaxbTransformation.bpmn2 rename to jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/service/BPMN2-ServiceProcessWithMvelJaxbTransformation.bpmn2 index 35c7edd85cc..774c3daabd8 100755 --- a/jbpm/jbpm-tests/src/test/resources/BPMN2-ServiceProcessWithMvelJaxbTransformation.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/service/BPMN2-ServiceProcessWithMvelJaxbTransformation.bpmn2 @@ -40,7 +40,7 @@ - + diff --git a/jbpm/jbpm-tests/src/test/resources/BPMN2-ServiceProcessWithMvelTransformation.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/service/BPMN2-ServiceProcessWithMvelTransformation.bpmn2 similarity index 97% rename from jbpm/jbpm-tests/src/test/resources/BPMN2-ServiceProcessWithMvelTransformation.bpmn2 rename to jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/service/BPMN2-ServiceProcessWithMvelTransformation.bpmn2 index 2b1a8c1ca66..217d34edbfc 100755 --- a/jbpm/jbpm-tests/src/test/resources/BPMN2-ServiceProcessWithMvelTransformation.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/service/BPMN2-ServiceProcessWithMvelTransformation.bpmn2 @@ -40,7 +40,7 @@ - + diff --git a/jbpm/jbpm-tests/src/test/resources/BPMN2-SignalStartWithTransformation.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/start/BPMN2-SignalStartWithTransformation.bpmn2 similarity index 95% rename from jbpm/jbpm-tests/src/test/resources/BPMN2-SignalStartWithTransformation.bpmn2 rename to jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/start/BPMN2-SignalStartWithTransformation.bpmn2 index 73f8ff10dd3..92060fb056d 100644 --- a/jbpm/jbpm-tests/src/test/resources/BPMN2-SignalStartWithTransformation.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/start/BPMN2-SignalStartWithTransformation.bpmn2 @@ -32,7 +32,7 @@ - +