-
Notifications
You must be signed in to change notification settings - Fork 19
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
refactor: use the new flow/flownode links from the bpmn semantic in the predictions demo #515
Merged
csouchet
merged 7 commits into
master
from
476-Use_the_new_flow/flownode_links_from_the_BPMN_Semantic_in_the__Predictions__demo
Jul 10, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f90c949
Build the paths from the shape ids
csouchet 0a77646
remove key word
csouchet 6e636bb
remove type
csouchet 3884708
fix different problem
csouchet 2eebd85
fix bad rebase
csouchet 32070ae
Merge branch 'master' into 476-Use_the_new_flow/flownode_links_from_t…
tbouffard 5a8f8ff
Merge branch 'master' into 476-Use_the_new_flow/flownode_links_from_t…
csouchet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/bpmn-visualization.min.js"></script> | ||
<script defer src="../../examples/static/js/diagram/bpmn-diagram-bpmn-spec-pizza.js"></script> | ||
<script defer src="../static/js/use-case.js"></script> | ||
<script defer src="./js/path.js"></script> | ||
<script defer src="./js/data.js"></script> | ||
<script defer src="./js/style.js"></script> | ||
<script defer src="./js/prediction-use-case.js"></script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// From Bonita Day 2023 Demo | ||
class PathResolver { | ||
_bpmnVisualization; | ||
|
||
constructor(bpmnVisualization) { | ||
this._bpmnVisualization = bpmnVisualization; | ||
} | ||
|
||
getVisitedEdges(shapeIds) { | ||
const edgeIds = new Set(); | ||
for (const shapeId of shapeIds) { | ||
const shapeElt = this._bpmnVisualization.bpmnElementsRegistry.getElementsByIds(shapeId)[0]; | ||
if (!shapeElt) { | ||
continue; | ||
} | ||
|
||
const bpmnSemantic = shapeElt.bpmnSemantic; | ||
const incomingEdges = bpmnSemantic.incomingIds; | ||
if (incomingEdges) { | ||
for (const edgeId of incomingEdges) { | ||
const edgeElement = this._bpmnVisualization.bpmnElementsRegistry.getElementsByIds(edgeId)[0]; | ||
const sourceRef = edgeElement.bpmnSemantic.sourceRefId; | ||
if (shapeIds.includes(sourceRef)) { | ||
edgeIds.add(edgeId); | ||
} | ||
} | ||
} | ||
|
||
const outgoingEdges = bpmnSemantic.outgoingIds; | ||
if (outgoingEdges) { | ||
for (const edgeId of outgoingEdges) { | ||
const edgeElement = this._bpmnVisualization.bpmnElementsRegistry.getElementsByIds(edgeId)[0]; | ||
const targetRef = edgeElement.bpmnSemantic.targetRefId; | ||
if (shapeIds.includes(targetRef)) { | ||
edgeIds.add(edgeId); | ||
} | ||
} | ||
} | ||
} | ||
|
||
return Array.from(edgeIds); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
issue: we cannot duplicate the code from the demo.
We already know it requires refactoring at least for process-analytics/bonita-day-demo-2023#52. There are also a lot of extra validation of the incoming/outgoing (verification that a related edge id exists in the model) whereas this should be guarantee by bpmn-visualization.
In addition, we plan to extract PathResolver from the bonita day demo process-analytics/bonita-day-demo-2023#36. If we duplicate the implementation here, we must track it and plan to use the shared code here. And this may not possible out of the box depending on the way we package the shared code. In particular, we are not sure to to provide an IIFE bundle for the shared lib.
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.
To replace in another PR. See #260