Add specific tag to the XML representation


#1

Hello everyone ,

I’m working now on the properties-panel example , I want to make Service Task more specific like jbpm ,
I want to add a specific tag into the Definitions TAG like

 <bpmn2:itemDefinition>
<bpmn2:error>
<?xml version="1.0" encoding="UTF-8"?>
<!-- origin at X=0.0 Y=0.0 -->
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:ext="http://org.eclipse.bpmn2/ext" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.omg.org/spec/DD/20100524/DI http://www.omg.org/spec/DD/20100524/DI-XMI http://www.omg.org/spec/DD/20100524/DC http://www.omg.org/spec/DD/20100524/DC-XMI http://www.omg.org/spec/BPMN/20100524/DI http://www.omg.org/spec/BPMN/20100524/DI-XMI" id="sample-diagram" exporter="org.eclipse.bpmn2.modeler.core" exporterVersion="1.5.0.Final-v20180515-1642-B1" targetNamespace="http://bpmn.io/schema/bpmn">
  <bpmn2:itemDefinition id="ItemDefinition_325" isCollection="false" structureRef="xs:byte"/>
  <bpmn2:itemDefinition id="ItemDefinition_350" isCollection="false" structureRef="xs:decimal"/>
  <bpmn2:itemDefinition id="ItemDefinition_373" isCollection="false" structureRef="xs:integer"/>
  <bpmn2:error id="Error_2" errorCode="dsd" name="Error 2" structureRef="ItemDefinition_373"/>
  <bpmn2:error id="Error_3" errorCode="404" name="Error 3" structureRef="ItemDefinition_350"/>
  <bpmn2:message id="Message_3" itemRef="ItemDefinition_325" name="Message 3">
    <bpmn2:extensionElements>
      <ext:style/>
    </bpmn2:extensionElements>
  </bpmn2:message>
  <bpmn2:message id="Message_4" itemRef="ItemDefinition_350" name="Message 4">
    <bpmn2:extensionElements>
      <ext:style/>
    </bpmn2:extensionElements>
  </bpmn2:message>
  <bpmn2:message id="Message_5" name="MessageName">
    <bpmn2:extensionElements>
      <ext:style/>
    </bpmn2:extensionElements>
  </bpmn2:message>
  <bpmn2:message id="Message_6" name="MessageOutPutName">
    <bpmn2:extensionElements>
      <ext:style/>
    </bpmn2:extensionElements>
  </bpmn2:message>
  <bpmn2:interface id="Interface_3" implementationRef="InterfaceImplementation" name="InterfaceName">
    <bpmn2:operation id="Operation_2" name="Operation 2">
      <bpmn2:inMessageRef>Message_3</bpmn2:inMessageRef>
      <bpmn2:outMessageRef>Message_4</bpmn2:outMessageRef>
      <bpmn2:errorRef>Error_2</bpmn2:errorRef>
    </bpmn2:operation>
    <bpmn2:operation id="Operation_3" implementationRef="OperationImplementation" name="Operation 3">
      <bpmn2:inMessageRef>Message_5</bpmn2:inMessageRef>
      <bpmn2:outMessageRef>Message_6</bpmn2:outMessageRef>
      <bpmn2:errorRef>Error_3</bpmn2:errorRef>
    </bpmn2:operation>
  </bpmn2:interface>
  <bpmn2:process id="Process_1" isExecutable="false">
    <bpmn2:serviceTask id="ServiceTask_2" name="Service Task 2" implementation="##WebService" operationRef="Operation_3">
      <bpmn2:ioSpecification id="InputOutputSpecification_10">
        <bpmn2:dataInput id="DataInput_2" itemSubjectRef="ItemDefinition_325" name="input1"/>
        <bpmn2:dataOutput id="DataOutput_2" itemSubjectRef="ItemDefinition_350" name="output1"/>
        <bpmn2:inputSet id="InputSet_10" name="Input Set 10">
          <bpmn2:dataInputRefs>DataInput_2</bpmn2:dataInputRefs>
        </bpmn2:inputSet>
        <bpmn2:outputSet id="OutputSet_10" name="Output Set 10">
          <bpmn2:dataOutputRefs>DataOutput_2</bpmn2:dataOutputRefs>
        </bpmn2:outputSet>
      </bpmn2:ioSpecification>
    </bpmn2:serviceTask>
  </bpmn2:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNShape id="BPMNShape_ServiceTask_2" bpmnElement="ServiceTask_2" isExpanded="true">
        <dc:Bounds height="50.0" width="110.0" x="225.0" y="275.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_2" labelStyle="BPMNLabelStyle_1">
          <dc:Bounds height="15.0" width="80.0" x="240.0" y="292.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
    <bpmndi:BPMNLabelStyle id="BPMNLabelStyle_1">
      <dc:Font name="arial" size="9.0"/>
    </bpmndi:BPMNLabelStyle>
  </bpmndi:BPMNDiagram>
</bpmn2:definitions>

any proposition ?


#2

What did you try? What did not work?


#3

I’m trying to add specific tags to the definitions tag like item definition , operation , message …
I didn’t find the function where to add this kind of properties , I tried with the forms example it implements the tag into the name of the element clicked and with * Extension Element * tag


#4

I have tried this function but in vain

elementHelper.createElement('bpmn:ItemDefinition', { values: [] }, bo, bpmnFactory);

This is my the meta-model extension for the itemDefinition for example

 {
      "name": "bpmn:ItemDefinition",
      "superClass": [
        "RootElement"
      ],
      "properties": [
       
        {
          "name": "structureRef",
          "type": "String",
          "isAttr": true
        },
        {
          "name": "isCollection",
          "default": false,
          "isAttr": true,
          "type": "Boolean"
        },
        {
          "name": "import",
          "type": "Import",
          "isAttr": true,
          "isReference": true
        }
      ]
    }

#5

There’s no need for an extension. ItemDefinition is already implemented.
It’s matter of creating and adding these elements.