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

feat: enrich links between edges and shapes in the internal model #2638

Conversation

csouchet
Copy link
Member

@csouchet csouchet commented Apr 20, 2023

After parsing all process, assign IncomingIds and OutgoingIds of ShapeBpmnElement from the converted Flow.

Add unit tests

Pool

  • with incoming message flow,
  • with outgoing message flow,
  • with incoming/outgoing message flows

Text annotation in process

  • with incoming association,
  • with outgoing association,
  • with incoming/outgoing associations

Events

  • 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

Tasks & Gateways

  • 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

Sub-Process

  • 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

Call Activity

  • 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

Closes #2521

@csouchet csouchet added enhancement New feature or request depends on another PR ⚠️ Pull request depending on another one. The depending must be merged first labels Apr 20, 2023
@csouchet csouchet force-pushed the 2521-Enrich_links_between_edges_and_shapes_in_the_internal_model_ branch 2 times, most recently from a11de26 to 6066c9f Compare April 21, 2023 16:48
@github-actions
Copy link

github-actions bot commented Apr 21, 2023

♻️ PR Preview f2c963a has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@github-actions
Copy link

github-actions bot commented Apr 21, 2023

♻️ PR Preview f2c963a has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@csouchet csouchet added the WIP 🚧 Pull request in progress and/or not ready for review. Used in addition to marking it as draft label Apr 21, 2023
@csouchet csouchet force-pushed the 2521-Enrich_links_between_edges_and_shapes_in_the_internal_model_ branch from f633cef to 2da3801 Compare April 24, 2023 08:52
@csouchet csouchet removed the WIP 🚧 Pull request in progress and/or not ready for review. Used in addition to marking it as draft label Apr 24, 2023
- 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
@csouchet csouchet force-pushed the 2521-Enrich_links_between_edges_and_shapes_in_the_internal_model_ branch from 2da3801 to 263277e Compare April 25, 2023 12:19
@csouchet csouchet removed the depends on another PR ⚠️ Pull request depending on another one. The depending must be merged first label Apr 25, 2023
@csouchet csouchet marked this pull request as ready for review April 25, 2023 12:47
@csouchet csouchet requested a review from tbouffard April 25, 2023 12:47
@@ -87,6 +90,26 @@ export default class ProcessConverter {
}
}

private assignIncomingAndOutgoingIdsFromFlows(): void {
const fillShapeBpmnElementAttribute = (
Copy link
Member

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

Copy link
Member Author

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

Copy link
Member

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'>,
Copy link
Member

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.

Copy link
Member Author

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! 🙂

Copy link
Member

@tbouffard tbouffard May 3, 2023

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

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member

@tbouffard tbouffard left a 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.

bpmnElement: `${bpmnKind}_id_0`,
Bounds: { x: 10, y: 12, width: 40, height: 45 },
},
title | input | expectedAttribute
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: much more readable 👍🏿

@csouchet csouchet requested a review from tbouffard May 3, 2023 13:46
Copy link
Member

@tbouffard tbouffard left a 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'>,
Copy link
Member

@tbouffard tbouffard May 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that's fine.

@sonarcloud
Copy link

sonarcloud bot commented May 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@csouchet csouchet merged commit e39e50d into master May 3, 2023
@csouchet csouchet deleted the 2521-Enrich_links_between_edges_and_shapes_in_the_internal_model_ branch May 3, 2023 15:12
@tbouffard tbouffard added the BPMN diagram usability Something about the way we can interact with BPMN diagrams label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BPMN diagram usability Something about the way we can interact with BPMN diagrams enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] Enrich links between edges and shapes in the internal model
2 participants