-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat: enrich links between edges and shapes in the internal model #2638
feat: enrich links between edges and shapes in the internal model #2638
Conversation
a11de26
to
6066c9f
Compare
♻️ PR Preview f2c963a has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
♻️ PR Preview f2c963a has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
f633cef
to
2da3801
Compare
- with incoming attribute, - with outgoing attribute, - with incoming sequence flow, - with outgoing sequence flow, - with incoming association, - with outgoing association, - with incoming message flow, - with outgoing message flow, - with incoming/outgoing attributes and incoming/outgoing flows
- with incoming attribute, - with outgoing attribute, - with incoming sequence flow, - with outgoing sequence flow, - with incoming association, - with outgoing association, - with incoming message flow, - with outgoing message flow, - with incoming/outgoing attributes and incoming/outgoing flows
- with incoming attribute, - with outgoing attribute, - with incoming sequence flow, - with outgoing sequence flow, - with incoming association, - with outgoing association, - with incoming message flow, - with outgoing message flow, - with incoming/outgoing attributes and incoming/outgoing flows
- with incoming attribute, - with outgoing attribute, - with incoming sequence flow, - with outgoing sequence flow, - with incoming association, - with outgoing association, - with incoming message flow, - with outgoing message flow, - with incoming/outgoing attributes and incoming/outgoing flows
- with incoming association, - with outgoing association, - with incoming/outgoing associations
- with incoming message flow, - with outgoing message flow, - with incoming/outgoing message flows
2da3801
to
263277e
Compare
…_in_the_internal_model_
@@ -87,6 +90,26 @@ export default class ProcessConverter { | |||
} | |||
} | |||
|
|||
private assignIncomingAndOutgoingIdsFromFlows(): void { | |||
const fillShapeBpmnElementAttribute = ( |
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.
question: why defining this function here and not as a private method of the class?
This is not consistent with the rest of the code (we always create private methods in this case).
It may be a good reason, in that case, I suggest to document it as this is unclear to me
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.
As this is a technical method, only used within this context and I wasn't sure where to put it, I preferred to leave it here. But I am open to any ideas. ^^
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.
OK fine. Let's keep it as it is.
private assignIncomingAndOutgoingIdsFromFlows(): void { | ||
const fillShapeBpmnElementAttribute = ( | ||
shapeBpmnElementId: string, | ||
shapeBpmnElementAttributeName: keyof Pick<ShapeBpmnElement, 'outgoingIds' | 'incomingIds'>, |
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.
thought: for simplicity, we may declare instead:
shapeBpmnElementAttributeName: 'outgoingIds' | 'incomingIds'
The 2 attributes won't be renamed (as they are part of the public API) so there is no risk of error.
Anyway, let's keep this as it is now.
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.
Hi @tbouffard,
I understand your suggestion to simplify the code by declaring the property names directly.
However, I personally prefer using keyof Pick
to avoid potential naming errors in the future, especially using replace
feature of IDE. This approach ensures that only the allowed property names are used, reducing the risk of introducing bugs or errors.
Thanks for sharing your thoughts though! 🙂
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.
Okay, that's fine.
} | ||
}; | ||
|
||
const flows = [...this.convertedElements.getMessageFlows(), ...this.convertedElements.getSequenceFlows(), ...this.convertedElements.getAssociationFlows()]; |
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.
question: I guess we didn't measure the impact of this new lookup on the parsing performance in particular on large diagram.
The lookup done with convertedElements.findXXX
involves retrieving elements from a Map, so it should be fast.
But having real figures would be better.
We could modify the parseBpmn
utils to make it display the processing time or create a dedicated new tool for this purpose.
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.
As we decided with @tbouffard, we will manage the perfomance tests in another issue.
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.
After discussions with @csouchet, we decided to create a dedicated issue for the "parser performance": #2665
We will quickly handle it.
We have never done specific parsing performance test, so we have to setup the whole infrastructure. Performance tests involved the whole diagram loading and/or navigation.
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.
✔️ the implementation is OK. We could/should check the performance impact of the new implementation.
✔️ the tests are checking all cases of the implementation
❌ the tests should be refactored to improve the understanding of the reader IHMO.
About the test refactoring
- I often mentioned that the usage of the
JsonBuilder
and highly parametrized tests inputs and checks make them hard to follow/understand. This is particularly true here. It took me more time that I expected to understand what they were doing. - As we are not going to change the way we write tests in this PR, I am pretty sure this could be improved here with a more accurate test names and some test signature simplification as I suggested.
@csouchet I let you read my comments, you can answer to them but I am pretty sure that we should discuss in direct to converge to something that is OK for both of us.
test/unit/component/parser/json/BpmnJsonParser.flowNode.test.ts
Outdated
Show resolved
Hide resolved
bpmnElement: `${bpmnKind}_id_0`, | ||
Bounds: { x: 10, y: 12, width: 40, height: 45 }, | ||
}, | ||
title | input | expectedAttribute |
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.
praise: much more readable 👍🏿
test/unit/component/parser/json/BpmnJsonParser.flowNode.test.ts
Outdated
Show resolved
Hide resolved
test/unit/component/parser/json/BpmnJsonParser.flowNode.test.ts
Outdated
Show resolved
Hide resolved
test/unit/component/parser/json/BpmnJsonParser.flowNode.test.ts
Outdated
Show resolved
Hide resolved
test/unit/component/parser/json/BpmnJsonParser.flowNode.test.ts
Outdated
Show resolved
Hide resolved
test/unit/component/parser/json/BpmnJsonParser.flowNode.test.ts
Outdated
Show resolved
Hide resolved
test/unit/component/parser/json/BpmnJsonParser.sub.process.test.ts
Outdated
Show resolved
Hide resolved
test/unit/component/parser/json/BpmnJsonParser.sub.process.test.ts
Outdated
Show resolved
Hide resolved
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.
LGTM, thanks for the discussions and the integration of my feedback.
Good job! 👍🏿
private assignIncomingAndOutgoingIdsFromFlows(): void { | ||
const fillShapeBpmnElementAttribute = ( | ||
shapeBpmnElementId: string, | ||
shapeBpmnElementAttributeName: keyof Pick<ShapeBpmnElement, 'outgoingIds' | 'incomingIds'>, |
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.
Okay, that's fine.
…etween_edges_and_shapes_in_the_internal_model_
…_in_the_internal_model_
Kudos, SonarCloud Quality Gate passed! |
After parsing all
process
, assignIncomingIds
andOutgoingIds
ofShapeBpmnElement
from the convertedFlow
.Add unit tests
Pool
Text annotation in process
Events
Tasks & Gateways
Sub-Process
Call Activity
Closes #2521