You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "elguardian (via GitHub)" <gi...@apache.org> on 2024/04/30 10:41:02 UTC
[PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
elguardian opened a new pull request, #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490
Closes: https://github.com/apache/incubator-kie-issues/issues/1136
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "pefernan (via GitHub)" <gi...@apache.org>.
pefernan commented on code in PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#discussion_r1587411369
##########
jbpm/jbpm-flow/src/main/java/org/jbpm/ruleflow/core/factory/NodeFactory.java:
##########
@@ -71,4 +78,29 @@ public Mappable getMappableNode() {
return (Mappable) node;
}
+ public T onEntryAction(String dialect, String action) {
+ return onActionScript(ExtendedNodeImpl.EVENT_NODE_ENTER, dialect, action, null);
+ }
+
+ public T onExitAction(String dialect, String action) {
+ return onActionScript(ExtendedNodeImpl.EVENT_NODE_EXIT, dialect, action, null);
+ }
+
+ public T onActionScript(String type, String dialect, String script, Action compiledScript) {
+ DroolsConsequenceAction action = new DroolsConsequenceAction(dialect, script);
+ if (compiledScript != null) {
+ action.setMetaData("Action", compiledScript);
+ }
+ if (getExtendedNode().getActions(type) == null) {
+ List<DroolsAction> actions = new ArrayList<>();
+ actions.add(action);
+ getExtendedNode().setActions(type, actions);
+ }
+ getExtendedNode().getActions(type).add(action);
Review Comment:
+1 efectivelly with the current code scripts are executed twice
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "elguardian (via GitHub)" <gi...@apache.org>.
elguardian merged PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "kie-ci3 (via GitHub)" <gi...@apache.org>.
kie-ci3 commented on PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#issuecomment-2085478275
**PR job** `#2` was: **UNSTABLE**
Possible explanation: This should be test failures
<details>
<summary><b>Reproducer</b></summary>
build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-runtimes -u https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490 --skipParallelCheckout
NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution
</details>
Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/2/display/redirect
**Test results:**
- PASSED: 2316
- FAILED: 8
Those are the test failures:
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/2/testReport/org.jbpm.ruleflow.core.validation/RuleFlowProcessValidatorTest/testOnEntryOnExitValidation/">org.jbpm.ruleflow.core.validation.RuleFlowProcessValidatorTest.testOnEntryOnExitValidation</a></summary>
[Extracted: message] <br/>Expecting ArrayList:<br/> ["Node 'name' [jbpm-197f923f-b67a-4c06-8810-88fb1dda9432] Milestone has no incoming connection.",<br/> "Node 'name' [jbpm-197f923f-b67a-4c06-8810-88fb1dda9432] Milestone has no outgoing connection."]<br/>to contain:<br/> ["Node 'name' [jbpm-197f923f-b67a-4c06-8810-88fb1dda9432] On Entry Action is not yet supported in Kogito",<br/> "Node 'name' [jbpm-197f923f-b67a-4c06-8810-88fb1dda9432] On Exit Action is not yet supported in Kogito"]<br/>but could not find the following element(s):<br/> ["Node 'name' [jbpm-197f923f-b67a-4c06-8810-88fb1dda9432] On Entry Action is not yet supported in Kogito",<br/> "Node 'name' [jbpm-197f923f-b67a-4c06-8810-88fb1dda9432] On Exit Action is not yet supported in Kogito"]<br/>
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/2/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[7]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[7]</a></summary>
[BoundaryEventNode] nodes with name [BoundaryEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/2/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[10]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[10]</a></summary>
[BoundaryEventNode] nodes with name [BoundaryEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/2/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[43]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[43]</a></summary>
[BoundaryEventNode] nodes with name [Boundary event] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/2/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[52]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[52]</a></summary>
[BoundaryEventNode] nodes with name [TimerEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/2/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[55]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[55]</a></summary>
[BoundaryEventNode] nodes with name [TimerEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/2/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[56]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[56]</a></summary>
[BoundaryEventNode] nodes with name [TimerEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/2/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[99]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[99]</a></summary>
[BoundaryEventNode] nodes with name [] are not equal
</details>
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "martinweiler (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "pefernan (via GitHub)" <gi...@apache.org>.
pefernan commented on code in PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#discussion_r1587410570
##########
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:
+1 I verified that this makes the `onExit` scripts being executed `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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "elguardian (via GitHub)" <gi...@apache.org>.
elguardian commented on code in PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#discussion_r1587583261
##########
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:
changed
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "elguardian (via GitHub)" <gi...@apache.org>.
elguardian commented on code in PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#discussion_r1590653317
##########
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(actionType),
+ new StringLiteralExpr(script.getDialect()),
+ new StringLiteralExpr(sanitizeString(script.getConsequence())),
+ buildDroolsConsequenceAction(extendedNodeImpl, script.getDialect(), script.getConsequence())));
+ ;
+ }
+ }
+
+ private Expression buildDroolsConsequenceAction(ExtendedNodeImpl extendedNodeImpl, String dialect, String script) {
+ BlockStmt newDroolsConsequenceActionExpression = new BlockStmt();
+ if (script != null) {
+ if (dialect.contains("java")) {
Review Comment:
changed
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "pefernan (via GitHub)" <gi...@apache.org>.
pefernan commented on code in PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#discussion_r1587411369
##########
jbpm/jbpm-flow/src/main/java/org/jbpm/ruleflow/core/factory/NodeFactory.java:
##########
@@ -71,4 +78,29 @@ public Mappable getMappableNode() {
return (Mappable) node;
}
+ public T onEntryAction(String dialect, String action) {
+ return onActionScript(ExtendedNodeImpl.EVENT_NODE_ENTER, dialect, action, null);
+ }
+
+ public T onExitAction(String dialect, String action) {
+ return onActionScript(ExtendedNodeImpl.EVENT_NODE_EXIT, dialect, action, null);
+ }
+
+ public T onActionScript(String type, String dialect, String script, Action compiledScript) {
+ DroolsConsequenceAction action = new DroolsConsequenceAction(dialect, script);
+ if (compiledScript != null) {
+ action.setMetaData("Action", compiledScript);
+ }
+ if (getExtendedNode().getActions(type) == null) {
+ List<DroolsAction> actions = new ArrayList<>();
+ actions.add(action);
+ getExtendedNode().setActions(type, actions);
+ }
+ getExtendedNode().getActions(type).add(action);
Review Comment:
+1 efectivelly with this scripts are executed twice
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "kie-ci3 (via GitHub)" <gi...@apache.org>.
kie-ci3 commented on PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#issuecomment-2085259804
**PR job** `#1` was: **UNSTABLE**
Possible explanation: This should be test failures
<details>
<summary><b>Reproducer</b></summary>
build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-runtimes -u https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490 --skipParallelCheckout
NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution
</details>
Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/1/display/redirect
**Test results:**
- PASSED: 3173
- FAILED: 8
Those are the test failures:
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/1/testReport/org.jbpm.ruleflow.core.validation/RuleFlowProcessValidatorTest/testOnEntryOnExitValidation/">org.jbpm.ruleflow.core.validation.RuleFlowProcessValidatorTest.testOnEntryOnExitValidation</a></summary>
[Extracted: message] <br/>Expecting ArrayList:<br/> ["Node 'name' [jbpm-26fb4859-a5bc-4244-b233-2817c2c68865] Milestone has no incoming connection.",<br/> "Node 'name' [jbpm-26fb4859-a5bc-4244-b233-2817c2c68865] Milestone has no outgoing connection."]<br/>to contain:<br/> ["Node 'name' [jbpm-26fb4859-a5bc-4244-b233-2817c2c68865] On Entry Action is not yet supported in Kogito",<br/> "Node 'name' [jbpm-26fb4859-a5bc-4244-b233-2817c2c68865] On Exit Action is not yet supported in Kogito"]<br/>but could not find the following element(s):<br/> ["Node 'name' [jbpm-26fb4859-a5bc-4244-b233-2817c2c68865] On Entry Action is not yet supported in Kogito",<br/> "Node 'name' [jbpm-26fb4859-a5bc-4244-b233-2817c2c68865] On Exit Action is not yet supported in Kogito"]<br/>
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/1/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[7]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[7]</a></summary>
[BoundaryEventNode] nodes with name [BoundaryEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/1/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[10]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[10]</a></summary>
[BoundaryEventNode] nodes with name [BoundaryEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/1/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[43]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[43]</a></summary>
[BoundaryEventNode] nodes with name [Boundary event] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/1/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[52]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[52]</a></summary>
[BoundaryEventNode] nodes with name [TimerEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/1/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[55]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[55]</a></summary>
[BoundaryEventNode] nodes with name [TimerEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/1/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[56]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[56]</a></summary>
[BoundaryEventNode] nodes with name [TimerEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/1/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[99]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[99]</a></summary>
[BoundaryEventNode] nodes with name [] are not equal
</details>
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "martinweiler (via GitHub)" <gi...@apache.org>.
martinweiler commented on code in PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#discussion_r1586801871
##########
jbpm/jbpm-flow/src/main/java/org/jbpm/ruleflow/core/factory/NodeFactory.java:
##########
@@ -71,4 +78,29 @@ public Mappable getMappableNode() {
return (Mappable) node;
}
+ public T onEntryAction(String dialect, String action) {
+ return onActionScript(ExtendedNodeImpl.EVENT_NODE_ENTER, dialect, action, null);
+ }
+
+ public T onExitAction(String dialect, String action) {
+ return onActionScript(ExtendedNodeImpl.EVENT_NODE_EXIT, dialect, action, null);
+ }
+
+ public T onActionScript(String type, String dialect, String script, Action compiledScript) {
+ DroolsConsequenceAction action = new DroolsConsequenceAction(dialect, script);
+ if (compiledScript != null) {
+ action.setMetaData("Action", compiledScript);
+ }
+ if (getExtendedNode().getActions(type) == null) {
+ List<DroolsAction> actions = new ArrayList<>();
+ actions.add(action);
+ getExtendedNode().setActions(type, actions);
+ }
+ getExtendedNode().getActions(type).add(action);
Review Comment:
```
} else {
getExtendedNode().getActions(type).add(action);
}
```
to avoid scripts getting executed twice
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "kie-ci3 (via GitHub)" <gi...@apache.org>.
kie-ci3 commented on PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#issuecomment-2088404476
**PR job** `#4` was: **UNSTABLE**
Possible explanation: This should be test failures
<details>
<summary><b>Reproducer</b></summary>
build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-runtimes -u https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490 --skipParallelCheckout
NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution
</details>
Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/4/display/redirect
**Test results:**
- PASSED: 3254
- FAILED: 7
Those are the test failures:
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/4/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[7]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[7]</a></summary>
[BoundaryEventNode] nodes with name [BoundaryEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/4/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[10]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[10]</a></summary>
[BoundaryEventNode] nodes with name [BoundaryEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/4/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[43]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[43]</a></summary>
[BoundaryEventNode] nodes with name [Boundary event] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/4/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[52]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[52]</a></summary>
[BoundaryEventNode] nodes with name [TimerEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/4/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[55]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[55]</a></summary>
[BoundaryEventNode] nodes with name [TimerEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/4/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[56]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[56]</a></summary>
[BoundaryEventNode] nodes with name [TimerEvent] are not equal
</details>
<details>
<summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3490/4/testReport/org.kie.kogito.codegen.process/ProcessGenerationIT/testProcessGeneration(String)[99]/">org.kie.kogito.codegen.process.ProcessGenerationIT.testProcessGeneration(String)[99]</a></summary>
[BoundaryEventNode] nodes with name [] are not equal
</details>
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "porcelli (via GitHub)" <gi...@apache.org>.
porcelli commented on code in PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#discussion_r1588789406
##########
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(actionType),
+ new StringLiteralExpr(script.getDialect()),
+ new StringLiteralExpr(sanitizeString(script.getConsequence())),
+ buildDroolsConsequenceAction(extendedNodeImpl, script.getDialect(), script.getConsequence())));
+ ;
+ }
+ }
+
+ private Expression buildDroolsConsequenceAction(ExtendedNodeImpl extendedNodeImpl, String dialect, String script) {
+ BlockStmt newDroolsConsequenceActionExpression = new BlockStmt();
+ if (script != null) {
+ if (dialect.contains("java")) {
Review Comment:
maybe add a log error message for not supported dialect
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-issues-1136] Add script onEntry, on Exit for java [incubator-kie-kogito-runtimes]
Posted by "elguardian (via GitHub)" <gi...@apache.org>.
elguardian commented on code in PR #3490:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3490#discussion_r1587585051
##########
jbpm/jbpm-flow/src/main/java/org/jbpm/ruleflow/core/factory/NodeFactory.java:
##########
@@ -71,4 +78,29 @@ public Mappable getMappableNode() {
return (Mappable) node;
}
+ public T onEntryAction(String dialect, String action) {
+ return onActionScript(ExtendedNodeImpl.EVENT_NODE_ENTER, dialect, action, null);
+ }
+
+ public T onExitAction(String dialect, String action) {
+ return onActionScript(ExtendedNodeImpl.EVENT_NODE_EXIT, dialect, action, null);
+ }
+
+ public T onActionScript(String type, String dialect, String script, Action compiledScript) {
+ DroolsConsequenceAction action = new DroolsConsequenceAction(dialect, script);
+ if (compiledScript != null) {
+ action.setMetaData("Action", compiledScript);
+ }
+ if (getExtendedNode().getActions(type) == null) {
+ List<DroolsAction> actions = new ArrayList<>();
+ actions.add(action);
+ getExtendedNode().setActions(type, actions);
+ }
+ getExtendedNode().getActions(type).add(action);
Review Comment:
changed
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org