This is an automated email from the ASF dual-hosted git repository.

thiagoelg pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new 4d968d8c605 kie-issues#2291: BPMN Editor: Unable to create completion 
conditions on Milestones (#3557)
4d968d8c605 is described below

commit 4d968d8c605bacbf4b572467282a30c77dfc4979
Author: Rajalakshmy S <[email protected]>
AuthorDate: Thu May 7 19:53:09 2026 +0530

    kie-issues#2291: BPMN Editor: Unable to create completion conditions on 
Milestones (#3557)
    
    Co-authored-by: Rajalakshmy S <[email protected]>
---
 .../src/customTasks/MilestoneTask.tsx              | 49 ++++++++++++++++++----
 packages/bpmn-marshaller/src/drools-extension.ts   | 11 +++++
 2 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/packages/bpmn-editor-envelope/src/customTasks/MilestoneTask.tsx 
b/packages/bpmn-editor-envelope/src/customTasks/MilestoneTask.tsx
index b89d118643e..879a97b2d3d 100644
--- a/packages/bpmn-editor-envelope/src/customTasks/MilestoneTask.tsx
+++ b/packages/bpmn-editor-envelope/src/customTasks/MilestoneTask.tsx
@@ -19,6 +19,10 @@
 
 import * as React from "react";
 import "@kie-tools/bpmn-marshaller/dist/drools-extension";
+import {
+  MILESTONE_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS,
+  MILESTONE_TASK_VALUES,
+} from "@kie-tools/bpmn-marshaller/dist/drools-extension";
 import { CustomTask } from "@kie-tools/bpmn-editor/dist/BpmnEditor";
 import { useBpmnEditorStoreApi, useBpmnEditorStore } from 
"@kie-tools/bpmn-editor/dist/store/StoreContext";
 import { PropertiesPanelHeaderFormSection } from 
"@kie-tools/bpmn-editor/dist/propertiesPanel/singleNodeProperties/_PropertiesPanelHeaderFormSection";
@@ -31,6 +35,8 @@ import { SlaDueDateInput } from 
"@kie-tools/bpmn-editor/dist/propertiesPanel/sla
 import { generateUuid } from 
"@kie-tools/xyflow-react-kie-diagram/dist/uuid/uuid";
 import { BpmnEditorEnvelopeI18n, bpmnEditorEnvelopeI18nDefaults, 
bpmnEditorEnvelopeI18nDictionaries } from "../i18n";
 import { I18n } from "@kie-tools-core/i18n/dist/core";
+import { DEFAULT_DATA_TYPES } from 
"@kie-tools/bpmn-editor/dist/mutations/addOrGetItemDefinitions";
+import { DataMapping, setInputAndOutputDataMapping } from 
"@kie-tools/bpmn-editor/dist/mutations/_dataMapping";
 
 export const MILESTONE_TASK_ICON = (
   <svg
@@ -85,14 +91,41 @@ export function getMilestoneTask(i18n: 
BpmnEditorEnvelopeI18n): CustomTask {
     displayDescription: "",
     iconSvgElement: MILESTONE_TASK_ICON,
     propertiesPanelComponent: MilestoneTaskProperties,
-    matches: (task) => task["@_drools:taskName"] === "Milestone",
-    produce: () => ({
-      __$$element: "task",
-      "@_id": generateUuid(),
-      "@_drools:taskName": "Milestone",
-      "@_name": i18n.milestone,
-    }),
-    dataInputReservedNames: [],
+    matches: (task) => task["@_drools:taskName"] === 
MILESTONE_TASK_VALUES.TASK_NAME_VALUE,
+    produce: () => {
+      return {
+        __$$element: "task",
+        "@_id": generateUuid(),
+        "@_drools:taskName": MILESTONE_TASK_VALUES.TASK_NAME_VALUE,
+        "@_name": i18n.milestone,
+      };
+    },
+    onAdded: (state, task) => {
+      const inputs: DataMapping[] = [
+        {
+          dtype: DEFAULT_DATA_TYPES.STRING,
+          name: 
MILESTONE_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS.CONDITION,
+          isExpression: false,
+          variableRef: undefined,
+        },
+        {
+          dtype: DEFAULT_DATA_TYPES.OBJECT,
+          name: 
MILESTONE_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS.TASK_NAME,
+          isExpression: true,
+          value: MILESTONE_TASK_VALUES.TASK_NAME_VALUE,
+        },
+      ];
+      const outputs: DataMapping[] = [];
+
+      const itemDefinitionIdByDataTypes = new Map(
+        state.bpmn.model.definitions.rootElement
+          ?.filter((r) => r.__$$element === "itemDefinition")
+          .map((i) => [i["@_structureRef"]!, i["@_id"]])
+      );
+
+      setInputAndOutputDataMapping(itemDefinitionIdByDataTypes, inputs, 
outputs, task);
+    },
+    dataInputReservedNames: 
[MILESTONE_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS.TASK_NAME],
     dataOutputReservedNames: [],
   };
 }
diff --git a/packages/bpmn-marshaller/src/drools-extension.ts 
b/packages/bpmn-marshaller/src/drools-extension.ts
index c26e61b0682..5de27d31983 100644
--- a/packages/bpmn-marshaller/src/drools-extension.ts
+++ b/packages/bpmn-marshaller/src/drools-extension.ts
@@ -64,6 +64,15 @@ export const 
USER_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS_FOR_DMN_BINDING =
   MULTI_INSTANCE_ITEM_TYPE: "multiInstanceItemType",
 };
 
+export const MILESTONE_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS = {
+  CONDITION: "Condition",
+  TASK_NAME: "TaskName",
+};
+
+export const MILESTONE_TASK_VALUES = {
+  TASK_NAME_VALUE: "Milestone",
+};
+
 export const DATA_INPUT_RESERVED_NAMES = new Set([
   
BUSINESS_RULE_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS_FOR_DMN_BINDING.FILE_PATH,
   
BUSINESS_RULE_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS_FOR_DMN_BINDING.NAMESPACE,
@@ -81,6 +90,8 @@ export const DATA_INPUT_RESERVED_NAMES = new Set([
   
USER_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS_FOR_DMN_BINDING.NOT_STARTED_NOTIFY,
   
USER_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS_FOR_DMN_BINDING.NOT_COMPLETELY_NOTIFY,
   
USER_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS_FOR_DMN_BINDING.MULTI_INSTANCE_ITEM_TYPE,
+  MILESTONE_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS.CONDITION,
+  MILESTONE_TASK_IO_SPECIFICATION_DATA_INPUTS_CONSTANTS.TASK_NAME,
 ]);
 
 export const SERVICE_TASK_IMPLEMENTATIONS = {


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

Reply via email to