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: add more data in the internal model for the link events #2924

Conversation

csouchet
Copy link
Member

@csouchet csouchet commented Oct 12, 2023

Add sourceIds & targetId properties in the internal model for the link events.

ℹ️ In the BPMN specification, the link event definition can refer to another link event definition as either a source or a target.

Since the user of the library doesn't have this information, we internally calculate the ID of the event associated with this other link event definition to set as either source or target in ShapeBpmnSemantic.

Covers #2855

@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 Oct 12, 2023
@github-actions
Copy link

github-actions bot commented Oct 12, 2023

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

🤖 By surge-preview

@github-actions
Copy link

github-actions bot commented Oct 12, 2023

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

🤖 By surge-preview

['event with eventDefinitionRef attribute', EventDefinitionOn.DEFINITIONS],
['event with eventDefinition object', EventDefinitionOn.EVENT],
] as [string, EventDefinitionOn][])(`%s`, (titleSuffix: string, eventDefinitionOn: EventDefinitionOn) => {
it(`should convert with one source and one target, ${titleSuffix}`, () => {
Copy link
Member Author

@csouchet csouchet Oct 12, 2023

Choose a reason for hiding this comment

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

On definitions

{
  "definitions": {
    "targetNamespace": "",
    "collaboration": {
      "id": "collaboration_id_0"
    },
    "process": {
      "id": "0",
      "intermediateThrowEvent": {
        "id": "source_id",
        "eventDefinitionRef": "link_source_id"
      },
      "intermediateCatchEvent": {
        "id": "target_id",
        "eventDefinitionRef": "link_target_id"
      }
    },
    "BPMNDiagram": {
      "name": "process 0",
      "BPMNPlane": {
        "BPMNShape": [
          {
            "id": "shape_source_id",
            "bpmnElement": "source_id",
            "Bounds": {
              "x": 362,
              "y": 232,
              "width": 36,
              "height": 45
            }
          },
          {
            "id": "shape_target_id",
            "bpmnElement": "target_id",
            "Bounds": {
              "x": 362,
              "y": 232,
              "width": 36,
              "height": 45
            }
          }
        ]
      }
    },
    "linkEventDefinition": [
      {
        "id": "link_source_id",
        "target": "link_target_id"
      },
      {
        "id": "link_target_id",
        "source": "link_source_id"
      }
    ]
  }
}

On event

{
  "definitions": {
    "targetNamespace": "",
    "collaboration": {
      "id": "collaboration_id_0"
    },
    "process": {
      "id": "0",
      "intermediateThrowEvent": {
        "id": "source_id",
        "linkEventDefinition": {
          "id": "link_source_id",
          "target": "link_target_id"
        }
      },
      "intermediateCatchEvent": {
        "id": "target_id",
        "linkEventDefinition": {
          "id": "link_target_id",
          "source": "link_source_id"
        }
      }
    },
    "BPMNDiagram": {
      "name": "process 0",
      "BPMNPlane": {
        "BPMNShape": [
          {
            "id": "shape_source_id",
            "bpmnElement": "source_id",
            "Bounds": {
              "x": 362,
              "y": 232,
              "width": 36,
              "height": 45
            }
          },
          {
            "id": "shape_target_id",
            "bpmnElement": "target_id",
            "Bounds": {
              "x": 362,
              "y": 232,
              "width": 36,
              "height": 45
            }
          }
        ]
      }
    }
  }
}

});
});

it(`should convert with several sources, ${titleSuffix}`, () => {
Copy link
Member Author

@csouchet csouchet Oct 12, 2023

Choose a reason for hiding this comment

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

On definitions

{
  "definitions": {
    "targetNamespace": "",
    "collaboration": {
      "id": "collaboration_id_0"
    },
    "process": {
      "id": "0",
      "intermediateThrowEvent": [
        {
          "id": "source_1_id",
          "eventDefinitionRef": "link_source_1_id"
        },
        {
          "id": "source_2_id",
          "eventDefinitionRef": "link_source_2_id"
        }
      ],
      "intermediateCatchEvent": {
        "id": "target_id",
        "eventDefinitionRef": "link_target_id"
      }
    },
    "BPMNDiagram": {
      "name": "process 0",
      "BPMNPlane": {
        "BPMNShape": [
          {
            "id": "shape_source_1_id",
            "bpmnElement": "source_1_id",
            "Bounds": {
              "x": 362,
              "y": 232,
              "width": 36,
              "height": 45
            }
          },
          {
            "id": "shape_source_2_id",
            "bpmnElement": "source_2_id",
            "Bounds": {
              "x": 362,
              "y": 232,
              "width": 36,
              "height": 45
            }
          },
          {
            "id": "shape_target_id",
            "bpmnElement": "target_id",
            "Bounds": {
              "x": 362,
              "y": 232,
              "width": 36,
              "height": 45
            }
          }
        ]
      }
    },
    "linkEventDefinition": [
      {
        "id": "link_source_1_id",
        "target": "link_target_id"
      },
      {
        "id": "link_source_2_id",
        "target": "link_target_id"
      },
      {
        "id": "link_target_id",
        "source": [
          "link_source_1_id",
          "link_source_2_id"
        ]
      }
    ]
  }
}

On event

{
  "definitions": {
    "targetNamespace": "",
    "collaboration": {
      "id": "collaboration_id_0"
    },
    "process": {
      "id": "0",
      "intermediateThrowEvent": [
        {
          "id": "source_1_id",
          "linkEventDefinition": {
            "id": "link_source_1_id",
            "target": "link_target_id"
          }
        },
        {
          "id": "source_2_id",
          "linkEventDefinition": {
            "id": "link_source_2_id",
            "target": "link_target_id"
          }
        }
      ],
      "intermediateCatchEvent": {
        "id": "target_id",
        "linkEventDefinition": {
          "id": "link_target_id",
          "source": [
            "link_source_1_id",
            "link_source_2_id"
          ]
        }
      }
    },
    "BPMNDiagram": {
      "name": "process 0",
      "BPMNPlane": {
        "BPMNShape": [
          {
            "id": "shape_source_1_id",
            "bpmnElement": "source_1_id",
            "Bounds": {
              "x": 362,
              "y": 232,
              "width": 36,
              "height": 45
            }
          },
          {
            "id": "shape_source_2_id",
            "bpmnElement": "source_2_id",
            "Bounds": {
              "x": 362,
              "y": 232,
              "width": 36,
              "height": 45
            }
          },
          {
            "id": "shape_target_id",
            "bpmnElement": "target_id",
            "Bounds": {
              "x": 362,
              "y": 232,
              "width": 36,
              "height": 45
            }
          }
        ]
      }
    }
  }
}

@tbouffard tbouffard changed the title feat(internal model): add more data in the internal model for the link events feat: add more data in the internal model for the link events Oct 12, 2023
@tbouffard tbouffard force-pushed the 2855-add_sourceIds_&_targetId_properties_on_internal_model_for_Link_events branch from 55a6864 to 5c42362 Compare October 13, 2023 06:13
@tbouffard tbouffard removed the depends on another PR ⚠️ Pull request depending on another one. The depending must be merged first label Oct 13, 2023
@sonarcloud
Copy link

sonarcloud bot commented Oct 13, 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

@tbouffard tbouffard marked this pull request as ready for review October 13, 2023 06:21
@tbouffard tbouffard merged commit 85c8b20 into master Oct 13, 2023
25 checks passed
@tbouffard tbouffard deleted the 2855-add_sourceIds_&_targetId_properties_on_internal_model_for_Link_events branch October 13, 2023 06:23
@tbouffard tbouffard added the BPMN diagram usability Something about the way we can interact with BPMN diagrams label Oct 13, 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.

2 participants