Skip to content
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

Merged
merged 1 commit into from Aug 9, 2018

Conversation

mswiderski
Copy link
Contributor

@DuncanDoyle if you find some time have a look

@mswiderski
Copy link
Contributor Author

Jenkins retest this

@mswiderski
Copy link
Contributor Author

Jenkins retest this

1 similar comment
@mswiderski
Copy link
Contributor Author

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()))
Copy link
Member

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()))

Copy link
Contributor Author

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);
Copy link
Member

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...

Copy link
Contributor Author

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.

@mswiderski
Copy link
Contributor Author

Jenkins retest this

@mswiderski mswiderski merged commit 6058739 into kiegroup:master Aug 9, 2018
@mswiderski mswiderski deleted the JBPM-7549 branch August 9, 2018 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants