martinweiler commented on code in PR #3490:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#discussion_r1586793244
##########
jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/AbstractNodeVisitor.java:
##########
@@ -79,6 +88,64 @@ public void visitNode(T node, BlockStmt body, VariableScope
variableScope, Proce
if (isAdHocNode(node) && !(node instanceof HumanTaskNode)) {
metadata.addSignal(node.getName(), null);
}
+ if (isExtendedNode(node)) {
+ ExtendedNodeImpl extendedNodeImpl = (ExtendedNodeImpl) node;
+ addScript(extendedNodeImpl, body, ON_ACTION_SCRIPT_METHOD,
ExtendedNodeImpl.EVENT_NODE_ENTER);
+ addScript(extendedNodeImpl, body, ON_ACTION_SCRIPT_METHOD,
ExtendedNodeImpl.EVENT_NODE_EXIT);
+ }
+ }
+
+ private void addScript(ExtendedNodeImpl extendedNodeImpl, BlockStmt body,
String factoryMethod, String actionType) {
+ if (!extendedNodeImpl.hasActions(actionType)) {
+ return;
+ }
+ List<DroolsConsequenceAction> scripts =
extendedNodeImpl.getActions(actionType).stream()
+ .filter(Predicate.not(Objects::isNull))
+ .filter(DroolsConsequenceAction.class::isInstance)
+ .map(DroolsConsequenceAction.class::cast)
+ .filter(e -> e.getConsequence() != null &&
!e.getConsequence().isBlank())
+ .toList();
+
+ for (DroolsConsequenceAction script : scripts) {
+ body.addStatement(getFactoryMethod(getNodeId((T)
extendedNodeImpl), factoryMethod,
+ new StringLiteralExpr(ExtendedNodeImpl.EVENT_NODE_ENTER),
Review Comment:
Should be replaced with
```
new StringLiteralExpr(actionType),
```
otherwise all scripts will be onEntry
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]