jomarko commented on code in PR #2546:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2546#discussion_r1775282093


##########
packages/dmn-editor/src/store/computed/computeDiagramData.ts:
##########
@@ -402,8 +410,13 @@ function ackRequirementEdges(
     if (dmnObject.__$$element === "decision") {
       (dmnObject.informationRequirement ?? []).forEach((ir, index) => {
         const irHref = parseXmlHref((ir.requiredDecision ?? 
ir.requiredInput)!["@_href"]);
+        // Search for definitions[`@_xmlns:included${includedIndex}`] that 
holds proper namespace
+        // and store the proper prefix: `included${includedIndex}` value
+        const namespaceIncludedPrefix = Object.entries(definitions)
+          .find(([key, val]) => val === namespace)?.[0]
+          ?.replace("@_xmlns:", "");
         ackEdge({
-          id: ir["@_id"]!,
+          id: (namespaceIncludedPrefix ? `${namespaceIncludedPrefix}:` : "") + 
ir["@_id"]!,

Review Comment:
   @tiagobento thank you for this topic. actually, nodes/shapes, currently uses 
`prefix:id` , not `namespace#id`, that is why implemented that way for edges.
   
   Applying your suggestion produces xml like attached:
   ```
    <dmndi:DMNDI>
       <dmndi:DMNDiagram id="_B90C2A89-A2E3-4610-AC66-A6DC0F9C1CEF" 
name="Default DRD" useAlternativeInputDataShape="false">
         <di:extension>
           <kie:ComponentsWidthsExtension>
           </kie:ComponentsWidthsExtension>
         </di:extension>
         <dmndi:DMNEdge id="_D763F5B1-FAF0-4790-A905-A5B1D63F0D2C" 
dmnElementRef="included2:_90FB4683-E1A0-4149-A1B8-444DEE06E749" 
sourceElement="_A9428417-FA8E-47B7-9F4A-10921FEA34BA" 
targetElement="_CAFE156E-4FB5-4285-9079-E3165FB92DDE">
           <di:waypoint x="1300" y="260" />
           <di:waypoint x="900" y="240" />
           <di:waypoint x="600" y="400" />
         </dmndi:DMNEdge>
         <dmndi:DMNShape id="_CD133A74-86D5-4DA7-81BF-F122A69A7927" 
dmnElementRef="included0:_2081EEE3-7B1B-48B3-B3B9-944F0A013CF1">
           <dc:Bounds x="960" y="160" width="160" height="80" />
         </dmndi:DMNShape>
         <dmndi:DMNShape id="_AA2DC9CB-C337-4E8F-8258-ECA14E0CDB10" 
dmnElementRef="included0:_92040BB1-AB7A-46D1-A4DE-A4FD1448ADF5">
           <dc:Bounds x="700" y="220" width="160" height="80" />
         </dmndi:DMNShape>
         <dmndi:DMNEdge id="_68653841-7F18-46EB-B3F0-37082CC0A3E8" 
dmnElementRef="https://kie.org/dmn/_AE5E9361-3580-4587-AE13-53A36057853B#_0A18CF15-F3E5-4B87-82A1-2851A246FDF4";
 sourceElement="_AA2DC9CB-C337-4E8F-8258-ECA14E0CDB10" 
targetElement="_CD133A74-86D5-4DA7-81BF-F122A69A7927">
           <di:waypoint x="780" y="260" />
           <di:waypoint x="940" y="260" />
           <di:waypoint x="860" y="200" />
           <di:waypoint x="1040" y="200" />
         </dmndi:DMNEdge>
       </dmndi:DMNDiagram>
     </dmndi:DMNDI>
     ```
     
     from this discussion my understanding is, I should update the code to use 
`namespace#id` also for nodes/shapes? Is that correct?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to