New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JBPM-7549 - Allow the use of stage-name to trigger adhoc fragment #1293
Conversation
Jenkins retest this |
Jenkins retest this |
1 similar comment
Jenkins retest this |
@@ -57,11 +62,19 @@ public Void execute(Context context) { | |||
ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId); | |||
|
|||
DynamicNodeInstance dynamicContext = (DynamicNodeInstance) ((WorkflowProcessInstanceImpl) processInstance).getNodeInstances(true).stream() | |||
.filter(ni -> (ni instanceof DynamicNodeInstance) && stageId.equals(ni.getNode().getMetaData().get("UniqueId"))) | |||
.filter(ni -> (ni instanceof DynamicNodeInstance) && stage.equals(ni.getNode().getMetaData().get("UniqueId")) || stage.equals(ni.getNodeName())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably missing parentheses? What happens if NodeInstance is not a dynamic one and its nodeName is the one I am looking for? I guess there will be a ClassCastException.
Shouldn't there be
(ni instanceof DynamicNodeInstance) && (stage.equals(ni.getNode().getMetaData().get("UniqueId")) || stage.equals(ni.getNodeName()))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, fixed
|
||
Map<String, Object> data = new HashMap<>(); | ||
data.put("type", "basic"); | ||
caseService.triggerAdHocFragment(caseId, "Stage #{type}", data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question on how this work. So if we don't have NodeInstance created yet, we have to call it as if directly from case definition, i.e. without variables resolved. Once the instance of the stage is created, variables are resolved, right? Just thinking if it makes sense/is possible to do variable resolution even when triggering adHoc fragment, although I see that it can cause troubles since once it would be Stage basic, once Stage advanced, but it would still be the same Stage being invoked. So just an idea...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in general the stage needs to be created based on the definition - adhoc subprocess and if that has the name with expression it needs to be used as the way to created it but at the time it's created it will resolve the variable to make sure that stage instance has the correct name instead of expression.
Jenkins retest this |
@DuncanDoyle if you find some time have a look