-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
impl new DefaultBPMNSequenceFlowExtension
Issue #175
- Loading branch information
Showing
5 changed files
with
178 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,48 @@ | ||
<?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:xs="http://www.w3.org/2001/XMLSchema" id="Definitions_1" exporter="org.eclipse.bpmn2.modeler.core" exporterVersion="1.5.4.RC1-v20220528-0836-B1"> | ||
<bpmn2:process id="Process_1" name="Process 1" isExecutable="false"> | ||
<bpmn2:startEvent id="StartEvent_1" name="Start Event 1"> | ||
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> | ||
</bpmn2:startEvent> | ||
<bpmn2:endEvent id="EndEvent_1" name="End Event 1"> | ||
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> | ||
</bpmn2:endEvent> | ||
<bpmn2:sequenceFlow id="SequenceFlow_1" name="Flow-1" sourceRef="StartEvent_1" targetRef="EndEvent_1"/> | ||
</bpmn2:process> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="BPMNShape_StartEvent_1" bpmnElement="StartEvent_1"> | ||
<dc:Bounds height="36.0" width="36.0" x="62.0" y="32.0"/> | ||
<bpmndi:BPMNLabel id="BPMNLabel_8" labelStyle="BPMNLabelStyle_1"> | ||
<dc:Bounds height="14.0" width="69.0" x="46.0" y="68.0"/> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="BPMNShape_EndEvent_1" bpmnElement="EndEvent_1"> | ||
<dc:Bounds height="36.0" width="36.0" x="270.0" y="32.0"/> | ||
<bpmndi:BPMNLabel id="BPMNLabel_9" labelStyle="BPMNLabelStyle_1"> | ||
<dc:Bounds height="14.0" width="66.0" x="255.0" y="68.0"/> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="BPMNShape_StartEvent_1" targetElement="BPMNShape_EndEvent_1"> | ||
<di:waypoint xsi:type="dc:Point" x="98.0" y="50.0"/> | ||
<di:waypoint xsi:type="dc:Point" x="184.0" y="50.0"/> | ||
<di:waypoint xsi:type="dc:Point" x="270.0" y="50.0"/> | ||
<bpmndi:BPMNLabel id="BPMNLabel_10"> | ||
<dc:Bounds height="14.0" width="37.0" x="166.0" y="51.0"/> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNEdge> | ||
</bpmndi:BPMNPlane> | ||
<bpmndi:BPMNLabelStyle id="BPMNLabelStyle_1"> | ||
<dc:Font name="arial" size="9.0"/> | ||
</bpmndi:BPMNLabelStyle> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn2:definitions> | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<!-- origin at X=0.0 Y=0.0 --><bpmn2:definitions 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:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exporter="org.eclipse.bpmn2.modeler.core" exporterVersion="1.5.4.RC1-v20220528-0836-B1" id="Definitions_1"> | ||
<bpmn2:process id="Process_1" isExecutable="false" name="Process 1" processType="Public"> | ||
<bpmn2:startEvent id="StartEvent_1" name="Start Event 1"> | ||
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> | ||
<bpmn2:documentation id="documentation_QOLAnw"/> | ||
</bpmn2:startEvent> | ||
<bpmn2:endEvent id="EndEvent_1" name="End Event 1"> | ||
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> | ||
<bpmn2:documentation id="documentation_qWPl1w"/> | ||
</bpmn2:endEvent> | ||
<bpmn2:sequenceFlow id="SequenceFlow_1" name="Flow-1" sourceRef="StartEvent_1" targetRef="EndEvent_1"> | ||
<bpmn2:documentation id="documentation_hqnTsw"><![CDATA[as]]></bpmn2:documentation> | ||
<bpmn2:conditionExpression id="conditionExpression_tSguzw"><![CDATA[1==1]]></bpmn2:conditionExpression> | ||
</bpmn2:sequenceFlow> | ||
<bpmn2:documentation id="documentation_Swvz0Q"/> | ||
</bpmn2:process> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane bpmnElement="Process_1" id="BPMNPlane_1"> | ||
<bpmndi:BPMNShape bpmnElement="StartEvent_1" id="BPMNShape_StartEvent_1"> | ||
<dc:Bounds height="36.0" width="36.0" x="62.0" y="32.0"/> | ||
<bpmndi:BPMNLabel id="BPMNLabel_8" labelStyle="BPMNLabelStyle_1"> | ||
<dc:Bounds height="14.0" width="69.0" x="46.0" y="68.0"/> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape bpmnElement="EndEvent_1" id="BPMNShape_EndEvent_1"> | ||
<dc:Bounds height="36.0" width="36.0" x="270.0" y="32.0"/> | ||
<bpmndi:BPMNLabel id="BPMNLabel_9" labelStyle="BPMNLabelStyle_1"> | ||
<dc:Bounds height="14.0" width="66.0" x="255.0" y="68.0"/> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_1" id="BPMNEdge_SequenceFlow_1" sourceElement="BPMNShape_StartEvent_1" targetElement="BPMNShape_EndEvent_1"> | ||
<bpmndi:BPMNLabel id="BPMNLabel_10"> | ||
<dc:Bounds height="14.0" width="37.0" x="166.0" y="51.0"/> | ||
</bpmndi:BPMNLabel> | ||
|
||
|
||
|
||
<di:waypoint x="98.0" y="50.0"/> | ||
<di:waypoint x="184.0" y="50.0"/> | ||
<di:waypoint x="270.0" y="50.0"/> | ||
</bpmndi:BPMNEdge> | ||
</bpmndi:BPMNPlane> | ||
<bpmndi:BPMNLabelStyle id="BPMNLabelStyle_1"> | ||
<dc:Font name="arial" size="9.0"/> | ||
</bpmndi:BPMNLabelStyle> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn2:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
...mn.glsp-server/src/main/java/org/openbpmn/extension/DefaultBPMNSequenceFlowExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2022 Imixs Software Solutions GmbH and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
package org.openbpmn.extension; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import javax.json.JsonObject; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.eclipse.glsp.graph.GModelElement; | ||
import org.openbpmn.bpmn.BPMNTypes; | ||
import org.openbpmn.bpmn.elements.SequenceFlow; | ||
import org.openbpmn.bpmn.elements.core.BPMNElement; | ||
import org.openbpmn.glsp.jsonforms.DataBuilder; | ||
import org.openbpmn.glsp.jsonforms.SchemaBuilder; | ||
import org.openbpmn.glsp.jsonforms.UISchemaBuilder; | ||
import org.openbpmn.glsp.jsonforms.UISchemaBuilder.Layout; | ||
import org.openbpmn.glsp.model.BPMNGModelState; | ||
|
||
import com.google.inject.Inject; | ||
|
||
/** | ||
* The DefaultBPMNSequenceFlowExtension add an addional section for the | ||
* conditional SquenceFlows. | ||
* | ||
* @author rsoika | ||
* | ||
*/ | ||
public class DefaultBPMNSequenceFlowExtension extends AbstractBPMNElementExtension { | ||
|
||
@SuppressWarnings("unused") | ||
private static Logger logger = LogManager.getLogger(DefaultBPMNSequenceFlowExtension.class); | ||
|
||
@Inject | ||
protected BPMNGModelState modelState; | ||
|
||
public DefaultBPMNSequenceFlowExtension() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public int getPriority() { | ||
return 100; // below default settings from Edge element | ||
} | ||
|
||
/** | ||
* Returns if this Extension is of type SEQUENCE_FLOW | ||
*/ | ||
@Override | ||
public boolean handlesElementTypeId(final String elementTypeId) { | ||
return BPMNTypes.SEQUENCE_FLOW.equals(elementTypeId); | ||
} | ||
|
||
/** | ||
* This Extension is for SequenceFlow elements only | ||
*/ | ||
@Override | ||
public boolean handlesBPMNElement(final BPMNElement bpmnElement) { | ||
return (bpmnElement instanceof SequenceFlow); | ||
} | ||
|
||
/** | ||
* This Helper Method generates a JSON Object with the BPMNElement properties. | ||
* <p> | ||
* This json object is used on the GLSP Client to generate the EMF JsonForms | ||
*/ | ||
@Override | ||
public void buildPropertiesForm(final BPMNElement bpmnElement, final DataBuilder dataBuilder, | ||
final SchemaBuilder schemaBuilder, final UISchemaBuilder uiSchemaBuilder) { | ||
|
||
SequenceFlow sequenceFlow = (SequenceFlow) bpmnElement; | ||
dataBuilder // | ||
.addData("conditionExpression", sequenceFlow.getConditionExpression()) // | ||
.addData("Default", "test"); | ||
|
||
schemaBuilder. // | ||
addProperty("conditionExpression", "string", "add an optional conditional expression."). // | ||
addProperty("default", "boolean", null); | ||
|
||
Map<String, String> multilineOption = new HashMap<>(); | ||
multilineOption.put("multi", "true"); | ||
uiSchemaBuilder. // | ||
addCategory("Condition"). // | ||
addLayout(Layout.VERTICAL). // | ||
addElement("conditionExpression", "Expression", multilineOption); | ||
|
||
} | ||
|
||
@Override | ||
public void updatePropertiesData(final JsonObject json, final BPMNElement bpmnElement, | ||
final GModelElement gNodeElement) { | ||
|
||
SequenceFlow sequenceFlow = (SequenceFlow) bpmnElement; | ||
// check conditionExpression features | ||
Set<String> features = json.keySet(); | ||
for (String feature : features) { | ||
if ("conditionExpression".equals(feature)) { | ||
sequenceFlow.setConditionExpression(json.getString(feature)); | ||
continue; | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters