bpmn-elements
bpmn-elements copied to clipboard
fix: executionId for activities
Hello!
Where is a headache to get parent's executionId by activity in some cases. For example if you will try something like:
const activity = execution.definitions[0].getActivityById('activityId');
console.log(activity.parent.executionId);
The result is undefined;
And activity gotten by subscription has a valid executionId:
listener.on('activity.start', activity => console.log(activity.content.parent.executionId));
I investigated few places where it could be hidden and fixed it. I am not sure if it's a correct but it did a job. Mainly i just distribute newly created executionId from ProcessExecution to starting activities and update already added children in ProcessExecution instance. What do think?
I think i was wrong because there could be many instances of the activity in case when we have a loop or multiple processes and they all share one id, right? But how does it work if getActivityById called by definition return just one value, which one? I think we need something like getActivityByExecutionId and getElementByExecutionId.