apache / incubator-kie-tools

Tools for KIE
Apache License 2.0
243 stars 171 forks source link

How can I add support to a custom task? #310

Closed einverne closed 3 years ago

einverne commented 3 years ago

I export some bpmn files from KIE workbench, then I found there is a bpmn2:task tag in bpmn file which this kogito-tooling is not currently supported. I tried to build and run the project. But I cannot found a way to modify it. Are there any instructions to show how to add support to this kind of task node?

    <bpmn2:task id="_7FB7AFF4-C7FC-4CB8-BA91-1C2643106FAF" drools:taskName="CommonWorkItem" name="Name">
      <bpmn2:extensionElements>
        <drools:metaData name="elementname">
          <drools:metaValue><![CDATA[Name]]></drools:metaValue>
        </drools:metaData>
        <drools:onEntry-script scriptFormat="http://www.java.com/java">
          <drools:script><![CDATA[v.execute("some");]]></drools:script>
        </drools:onEntry-script>
      </bpmn2:extensionElements>
      <bpmn2:incoming>_8DFEDB4E-2DB3-48D2-955F-F8DDB4DF6902</bpmn2:incoming>
      <bpmn2:outgoing>_D5950703-3DF3-46FA-BBC9-ABDC197CA831</bpmn2:outgoing>
      <bpmn2:ioSpecification id="_LmiULhjNEeuldeHdBwNIyA">
        <bpmn2:dataInput id="_7FB7AFF4-C7FC-4CB8-BA91-1C2643106FAF_vInputX" drools:dtype="com.xiaomi.mifi.policy.model.ProcessVariable" itemSubjectRef="__7FB7AFF4-C7FC-4CB8-BA91-1C2643106FAF_vInputXItem" name="v"/>
        <bpmn2:dataInput id="_7FB7AFF4-C7FC-4CB8-BA91-1C2643106FAF_TaskNameInputX" drools:dtype="Object" name="TaskName"/>
        <bpmn2:inputSet id="_LmiULxjNEeuldeHdBwNIyA">
          <bpmn2:dataInputRefs>_7FB7AFF4-C7FC-4CB8-BA91-1C2643106FAF_vInputX</bpmn2:dataInputRefs>
          <bpmn2:dataInputRefs>_7FB7AFF4-C7FC-4CB8-BA91-1C2643106FAF_TaskNameInputX</bpmn2:dataInputRefs>
        </bpmn2:inputSet>
        <bpmn2:outputSet id="_LmiUMBjNEeuldeHdBwNIyA"/>
      </bpmn2:ioSpecification>
      <bpmn2:dataInputAssociation id="_LmiUMRjNEeuldeHdBwNIyA">
        <bpmn2:sourceRef>v</bpmn2:sourceRef>
        <bpmn2:targetRef>_7FB7AFF4-C7FC-4CB8-BA91-1C2643106FAF_vInputX</bpmn2:targetRef>
      </bpmn2:dataInputAssociation>
      <bpmn2:dataInputAssociation id="_LmiUMhjNEeuldeHdBwNIyA">
        <bpmn2:targetRef>_7FB7AFF4-C7FC-4CB8-BA91-1C2643106FAF_TaskNameInputX</bpmn2:targetRef>
        <bpmn2:assignment id="_LmiUMxjNEeuldeHdBwNIyA">
          <bpmn2:from xsi:type="bpmn2:tFormalExpression" id="_LmiUNBjNEeuldeHdBwNIyA"><![CDATA[CommonWorkItem]]></bpmn2:from>
          <bpmn2:to xsi:type="bpmn2:tFormalExpression" id="_LmiUNRjNEeuldeHdBwNIyA">_7FB7AFF4-C7FC-4CB8-BA91-1C2643106FAF_TaskNameInputX</bpmn2:to>
        </bpmn2:assignment>
      </bpmn2:dataInputAssociation>
    </bpmn2:task>
einverne commented 3 years ago

Related https://issues.redhat.com/browse/KOGITO-3529

quyuanbo commented 3 years ago

similarly, i wonder how to remove or hide some types of node in the kie palette area.

ederign commented 3 years ago

Hi @einverne and @quyuanbo first of all thanks for trying kogito tooling! :)

@romartin can give you clarifications about support for bpmn2:task on BPMN editor?

@quyuanbo currently we don't support removing/hiding our default nodes from our default palette. Could you please give more details of what is exactly your use case?

rasa-app commented 3 years ago

I have same problem. I created a bpmn file in workbench that works fine but after opening and saving with BPMN Editor in vscode it modifies bpmn2:task like I show in blow:

Original(created with KIE workbench):

<bpmn2:task id="_94993EC9-59EF-4B0B-B96E-1A9617507BD0" drools:taskName="NotApproved" name="Not Approved">
      <bpmn2:extensionElements>
        <drools:metaData name="elementname">
          <drools:metaValue><![CDATA[Not Approved]]></drools:metaValue>
        </drools:metaData>
      </bpmn2:extensionElements>
      <bpmn2:incoming>_8186DE62-8A72-47FD-A473-F6EFF0D24DAE</bpmn2:incoming>
      <bpmn2:outgoing>_B2EBCD97-CEE1-40C2-8600-70C1011509D3</bpmn2:outgoing>
      <bpmn2:ioSpecification id="_ZrD4PLLaEequkNNz4uhWhQ">
        <bpmn2:dataInput id="_94993EC9-59EF-4B0B-B96E-1A9617507BD0_FromInputX" drools:dtype="String" itemSubjectRef="__94993EC9-59EF-4B0B-B96E-1A9617507BD0_FromInputXItem" name="From"/>
        <bpmn2:dataInput id="_94993EC9-59EF-4B0B-B96E-1A9617507BD0_TaskNameInputX" drools:dtype="Object" name="TaskName"/>
        <bpmn2:inputSet id="_ZrD4PbLaEequkNNz4uhWhQ">
          <bpmn2:dataInputRefs>_94993EC9-59EF-4B0B-B96E-1A9617507BD0_FromInputX</bpmn2:dataInputRefs>
          <bpmn2:dataInputRefs>_94993EC9-59EF-4B0B-B96E-1A9617507BD0_TaskNameInputX</bpmn2:dataInputRefs>
        </bpmn2:inputSet>
        <bpmn2:outputSet id="_ZrD4PrLaEequkNNz4uhWhQ"/>
      </bpmn2:ioSpecification>
      <bpmn2:dataInputAssociation id="_ZrD4P7LaEequkNNz4uhWhQ">
        <bpmn2:targetRef>_94993EC9-59EF-4B0B-B96E-1A9617507BD0_TaskNameInputX</bpmn2:targetRef>
        <bpmn2:assignment id="_ZrD4QLLaEequkNNz4uhWhQ">
          <bpmn2:from xsi:type="bpmn2:tFormalExpression" id="_ZrD4QbLaEequkNNz4uhWhQ"><![CDATA[NotApproved]]></bpmn2:from>
          <bpmn2:to xsi:type="bpmn2:tFormalExpression" id="_ZrD4QrLaEequkNNz4uhWhQ">_94993EC9-59EF-4B0B-B96E-1A9617507BD0_TaskNameInputX</bpmn2:to>
        </bpmn2:assignment>
      </bpmn2:dataInputAssociation>
    </bpmn2:task>

After open and save with BPMN Editor in vscode:

<bpmn2:task id="_94993EC9-59EF-4B0B-B96E-1A9617507BD0" name="Not Approved">
      <bpmn2:extensionElements>
        <drools:metaData name="elementname">
          <drools:metaValue><![CDATA[Not Approved]]></drools:metaValue>
        </drools:metaData>
      </bpmn2:extensionElements>
      <bpmn2:incoming>_8186DE62-8A72-47FD-A473-F6EFF0D24DAE</bpmn2:incoming>
      <bpmn2:outgoing>_B2EBCD97-CEE1-40C2-8600-70C1011509D3</bpmn2:outgoing>
</bpmn2:task>
ederign commented 3 years ago

Hi @einverne and @rasa-app!

Looks like both your issues are related to custom work item definition support and custom tasks.

We kind have initial support for WID, it's just a matter of placing the wid file in the same directory of your bpmn file on VS Code.

But keep in mind the following limitations:

On your case @rasa-app , looks like your are experiencing this bug: https://issues.redhat.com/browse/KOGITO-3528

romartin commented 3 years ago

thanks @ederign for your response, I also think there is no bug. In case the custom tasks are not declared for kogito (so they don't appear on the left-hand palette as well), the marshaller generates just a regular task node. Anyway, please @einverne try to create the right .wid file in same directory as your process is placed, and let us know if then the export is successful. Thanks!

ederign commented 3 years ago

@einverne we did some improvements on this area on Kogito tooling 0.9.0. Could you please verify if it fixed your issue?

ederign commented 3 years ago

@einverne I'm closing this one due to inactivity. If you need any further help or find any other issue, please let us know! Thanks.