Skip to content

Commit

Permalink
impl
Browse files Browse the repository at this point in the history
issue #359
  • Loading branch information
rsoika committed Nov 8, 2024
1 parent 4585d11 commit 50739e7
Show file tree
Hide file tree
Showing 52 changed files with 4,618 additions and 3,337 deletions.
19 changes: 19 additions & 0 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: open-bpmn.server;singleton:=true
Automatic-Module-Name: open-bpmn.server
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-17
Export-Package: org.eclipse.glsp.graph,
org.eclipse.glsp.graph.impl,
org.eclipse.glsp.graph.util,
org.openbpmn.glsp.bpmn,
org.openbpmn.glsp.bpmn.impl,
org.openbpmn.glsp.bpmn.util
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport
Bundle-ActivationPolicy: lazy
10 changes: 10 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#

bin.includes = .,\
model/,\
META-INF/,\
plugin.xml,\
plugin.properties
jars.compile.order = .
source.. = open-bpmn.glsp-server/src/main/java-gen/
output.. = bin/
9 changes: 9 additions & 0 deletions open-bpmn.glsp-client/open-bpmn-glsp/css/diagram.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@
fill: #82848a;
}

.dataStoreReference>.sprotty-node {
opacity: 80%;
fill: transparent;
}

.dataStoreReference>.sprotty-icon {
stroke-width: 2;
}

.message>.sprotty-node {
opacity: 80%;
stroke: var(--theia-focusBorder);
Expand Down
46 changes: 46 additions & 0 deletions open-bpmn.glsp-client/open-bpmn-glsp/src/bpmn-element-views.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ export class IconView extends ShapeView {
icon =
// eslint-disable-next-line max-len
'M1 3.5l.5-.5h13l.5.5v9l-.5.5h-13l-.5-.5v-9zm1 1.035V12h12V4.536L8.31 8.9H7.7L2 4.535zM13.03 4H2.97L8 7.869 13.03 4z';
} else if (eventNode.kind === 'cancelEventDefinition') {
// https://github.com/microsoft/vscode-codicons/blob/main/src/icons/close.svg?short_path=a63b1e0
icon =
// eslint-disable-next-line max-len
'M8 8.707l3.646 3.647.708-.707L8.707 8l3.647-3.646-.707-.708L8 7.293 4.354 3.646l-.707.708L7.293 8l-3.646 3.646.707.708L8 8.707z';
} else if (eventNode.kind === 'conditionalEventDefinition') {
// https://github.com/microsoft/vscode-codicons/blob/main/src/icons/checklist.svg?short_path=e850b9d
icon =
Expand All @@ -174,6 +179,12 @@ export class IconView extends ShapeView {
icon =
// eslint-disable-next-line max-len
'M13.5 2H12v12h1.5V2zm-4.936.39L9.75 3v10l-1.186.61-7-5V7.39l7-5zM3.29 8l4.96 3.543V4.457L3.29 8z';
} else if (eventNode.kind === 'escalationEventDefinition') {
// From codicons:
// https://github.com/microsoft/vscode-codicons/blob/main/src/icons/fold-up.svg?short_path=a63b1e0
icon =
// eslint-disable-next-line max-len
'M1 7.4l.7.7 6-6 6 6 .7-.7L8.1 1h-.7L1 7.4zm0 6l.7.7 6-6 6 6 .7-.7L8.1 7h-.7L1 13.4z';
} else if (eventNode.kind === 'timerEventDefinition') {
// From codicons: https://github.com/microsoft/vscode-codicons/blob/main/src/icons/history.svg?short_path=53d41f7
icon =
Expand Down Expand Up @@ -322,6 +333,41 @@ export class DataObjectNodeView extends ShapeView {
}
}

/*
* Render a BPMN DataStore
* A TextAnnotation contains a text attribute which is displayed using the ForeignObjectView
*
* See: https://www.eclipse.org/glsp/documentation/rendering/#default-views
*/
@injectable()
export class DataStoreNodeView extends ShapeView {
render(node: Readonly<GShapeElement & Hoverable & Selectable>, context: RenderingContext, args?: IViewArgs): VNode | undefined {
if (!this.isVisible(node, context)) {
return undefined;
}
return <g>
<rect class-sprotty-node={node instanceof GNode}
class-sprotty-port={node instanceof GPort}
class-mouseover={node.hoverFeedback}
class-selected={node.selected}
x="0"
y="0"
width={Math.max(node.size.width, 0)}
height={Math.max(node.size.height, 0)}></rect>
{/* Database symbol starting at (5,5) */}
<g class-sprotty-icon={'icon'} transform="translate(0,10)">
<path d="M0 0 L0 30" stroke="currentColor" stroke-width="1.5" fill="none" />
<path d="M50 0 L50 30" stroke="currentColor" stroke-width="1.5" fill="none" />
<path d="M0 30 A25 8.5 0 0 0 50 30" fill="none" stroke="currentColor" stroke-width="1.5" />
<path d="M0 15 A25 8.5 0 0 0 50 15" fill="none" stroke="currentColor" stroke-width="1.5" />
<ellipse cx="25" cy="0" rx="25" ry="8.5" fill="none" stroke="currentColor" stroke-width="1.5" />
</g>

{context.renderChildren(node)}
</g>;
}
}

@injectable()
export class MessageNodeView extends ShapeView {
render(node: Readonly<GShapeElement & Hoverable & Selectable>, context: RenderingContext, args?: IViewArgs): VNode | undefined {
Expand Down
4 changes: 4 additions & 0 deletions open-bpmn.glsp-client/open-bpmn-glsp/src/di.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
import {
BPMNEdge,
DataObjectNode,
DataStoreNode,
EventNode,
GatewayNode,
Icon, LabelNode,
Expand All @@ -65,6 +66,7 @@ import '../css/diagram.css';
import {
BPMNGridView,
DataObjectNodeView,
DataStoreNodeView,
IconView,
LaneDividerView,
LaneHeaderView,
Expand Down Expand Up @@ -135,6 +137,8 @@ const bpmnDiagramModule = new ContainerModule((bind, unbind, isBound, rebind) =>
}
);
configureModelElement(context, 'dataObject', DataObjectNode, DataObjectNodeView);
configureModelElement(context, 'dataStore', DataStoreNode, DataStoreNodeView);
configureModelElement(context, 'dataStoreReference', DataStoreNode, DataStoreNodeView);
configureModelElement(context, 'message', MessageNode, MessageNodeView);
configureModelElement(context, 'textAnnotation', TextAnnotationNode, TextAnnotationNodeView);
configureModelElement(context, 'BPMNLabel', LabelNode, RectangularNodeView);
Expand Down
4 changes: 4 additions & 0 deletions open-bpmn.glsp-client/open-bpmn-model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ The model object `TextAnnotation` defines a BPMN TextAnnotation

The model object `DataObjectNode` defines a BPMN DataObject

**DataStoreNode**

The model object `DataStoreNode` defines a BPMN DataStoreReference

**PoolNode**

The model object `PoolNode` defines a BPMN Pool (Participant) and can include BPMN Lanes (LaneNode)
Expand Down
23 changes: 20 additions & 3 deletions open-bpmn.glsp-client/open-bpmn-model/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,22 @@ export class DataObjectNode extends RectangularNode implements BPMNFlowElement {
documentation: string;
}

export class DataStoreNode extends RectangularNode implements BPMNFlowElement {
static override readonly DEFAULT_FEATURES = [
connectableFeature,
deletableFeature,
selectFeature,
boundsFeature,
moveFeature,
layoutContainerFeature,
fadeFeature,
hoverFeedbackFeature,
popupFeature,
nameFeature
];
documentation: string;
}

export class MessageNode extends RectangularNode implements BPMNFlowElement {
static override readonly DEFAULT_FEATURES = [
connectableFeature,
Expand Down Expand Up @@ -282,17 +298,18 @@ export function isGatewayNode(element: GModelElement): element is GatewayNode {
* Indicates that the ModelElement has a independent BPMNLabel
*/
export function isBPMNLabelNode(element: GModelElement): element is GModelElement {
return (element instanceof EventNode || element instanceof GatewayNode || element instanceof DataObjectNode
return (element instanceof EventNode || element instanceof GatewayNode
|| element instanceof DataObjectNode || element instanceof DataStoreNode
|| element instanceof MessageNode) || false;
}

/*
* This method returns true if the element is a BPMN Node Element.
*/
export function isBPMNNode(element: GModelElement): element is TaskNode | EventNode | GatewayNode |
DataObjectNode | TextAnnotationNode | MessageNode | PoolNode {
DataObjectNode | DataStoreNode | TextAnnotationNode | MessageNode | PoolNode {
return element instanceof TaskNode || element instanceof EventNode || element instanceof GatewayNode ||
element instanceof DataObjectNode || element instanceof TextAnnotationNode ||
element instanceof DataObjectNode || element instanceof DataStoreNode || element instanceof TextAnnotationNode ||
element instanceof MessageNode || element instanceof PoolNode;
}

Expand Down
98 changes: 98 additions & 0 deletions open-bpmn.glsp-client/workspace/demo/event-types.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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:open-bpmn="http://open-bpmn.org/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exporter="org.openbpmn" exporterVersion="1.0.0" targetNamespace="http://open-bpmn.org">
<bpmn2:extensionElements>
<open-bpmn:auto-align>true</open-bpmn:auto-align>
</bpmn2:extensionElements>
<bpmn2:process id="process_1" name="Default Process" processType="Public">
<bpmn2:documentation id="documentation_D20gpQ"/>
<bpmn2:startEvent id="event_gpUlwA" name="Event-1">
<bpmn2:documentation id="documentation_iJgZhg"/>
<bpmn2:outgoing>sequenceFlow_YLnTcA</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:intermediateCatchEvent id="event_G6jH0A" name="Event-2">
<bpmn2:documentation id="documentation_F06iAA"/>
<bpmn2:escalationEventDefinition id="escalationEventDefinition_N9TERA"/>
<bpmn2:incoming>sequenceFlow_YLnTcA</bpmn2:incoming>
<bpmn2:outgoing>sequenceFlow_7cCNvg</bpmn2:outgoing>
</bpmn2:intermediateCatchEvent>
<bpmn2:intermediateThrowEvent id="event_lGOudQ" name="Event-3">
<bpmn2:documentation id="documentation_4J2vBQ"/>
<bpmn2:compensationEventDefinition id="compensationEventDefinition_wLty0g"/>
<bpmn2:incoming>sequenceFlow_7cCNvg</bpmn2:incoming>
<bpmn2:outgoing>sequenceFlow_1eQF2Q</bpmn2:outgoing>
</bpmn2:intermediateThrowEvent>
<bpmn2:endEvent id="event_A0ordA" name="Event-4">
<bpmn2:documentation id="documentation_JzlGtg"/>
<bpmn2:cancelEventDefinition id="cancelEventDefinition_n2zVZw"/>
<bpmn2:incoming>sequenceFlow_1eQF2Q</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="sequenceFlow_YLnTcA" sourceRef="event_gpUlwA" targetRef="event_G6jH0A">
<bpmn2:documentation id="documentation_wK3hxQ"/>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="sequenceFlow_7cCNvg" sourceRef="event_G6jH0A" targetRef="event_lGOudQ">
<bpmn2:documentation id="documentation_UGoq8A"/>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="sequenceFlow_1eQF2Q" sourceRef="event_lGOudQ" targetRef="event_A0ordA">
<bpmn2:documentation id="documentation_l9xhgw"/>
</bpmn2:sequenceFlow>
<bpmn2:dataObject id="dataObject_szCO8w" name="Data Object-1">
<bpmn2:documentation id="documentation_6YCL7w"/>
</bpmn2:dataObject>
<bpmn2:dataStoreReference id="dataStoreReference_B0DWhg" name="Data Store-1">
<bpmn2:documentation id="documentation_qrlD1Q"/>
</bpmn2:dataStoreReference>
</bpmn2:process>
<bpmn2:signal id="signal_1" name="Signal 1"/>
<bpmndi:BPMNDiagram id="BPMNDiagram_1" name="OpenBPMN Diagram">
<bpmndi:BPMNPlane id="BPMNPlane_1">
<bpmndi:BPMNShape bpmnElement="event_gpUlwA" id="BPMNShape_4fkuLw">
<dc:Bounds height="36.0" width="36.0" x="97.0" y="87.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_cy2xjA">
<dc:Bounds height="20.0" width="100.0" x="65.0" y="126.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="event_G6jH0A" id="BPMNShape_DKNeug">
<dc:Bounds height="36.0" width="36.0" x="257.0" y="87.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_qybZwA">
<dc:Bounds height="20.0" width="100.0" x="225.0" y="126.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="event_lGOudQ" id="BPMNShape_BbiJSw">
<dc:Bounds height="36.0" width="36.0" x="427.0" y="87.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_TAyR0A">
<dc:Bounds height="20.0" width="100.0" x="395.0" y="126.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="event_A0ordA" id="BPMNShape_mk6XWA">
<dc:Bounds height="36.0" width="36.0" x="627.0" y="87.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_t3yK1g">
<dc:Bounds height="20.0" width="100.0" x="595.0" y="126.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_YLnTcA" id="BPMNEdge_HERYAQ" sourceElement="BPMNShape_4fkuLw" targetElement="BPMNShape_DKNeug">
<di:waypoint x="133.0" y="105.0"/>
<di:waypoint x="257.0" y="105.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_7cCNvg" id="BPMNEdge_S0r0BQ" sourceElement="BPMNShape_DKNeug" targetElement="BPMNShape_BbiJSw">
<di:waypoint x="293.0" y="105.0"/>
<di:waypoint x="427.0" y="105.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_1eQF2Q" id="BPMNEdge_bkcXRQ" sourceElement="BPMNShape_BbiJSw" targetElement="BPMNShape_mk6XWA">
<di:waypoint x="463.0" y="105.0"/>
<di:waypoint x="627.0" y="105.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape bpmnElement="dataObject_szCO8w" id="BPMNShape_6MeB0A">
<dc:Bounds height="50.0" width="35.0" x="105.5" y="178.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_daqnhA">
<dc:Bounds height="20.0" width="100.0" x="73.0" y="233.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="dataStoreReference_B0DWhg" id="BPMNShape_0AVW6Q">
<dc:Bounds height="50.0" width="50.0" x="250.0" y="180.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_jsSCmg">
<dc:Bounds height="20.0" width="100.0" x="225.0" y="230.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
6 changes: 3 additions & 3 deletions open-bpmn.glsp-server/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: open-bpmn.glsp-server;singleton:=true
Automatic-Module-Name: open-bpmn.glsp-server
Bundle-SymbolicName: open-bpmn.server;singleton:=true
Automatic-Module-Name: open-bpmn.server
Bundle-Version: 1.0.4.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-RequiredExecutionEnvironment: JavaSE-17
Export-Package: org.eclipse.glsp.graph,
org.eclipse.glsp.graph.impl,
org.eclipse.glsp.graph.util,
Expand Down
1 change: 1 addition & 0 deletions open-bpmn.glsp-server/model/bpmn-glsp.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<eClassifiers xsi:type="ecore:EClass" name="EventGNode" eSuperTypes="#//BPMNGNode"/>
<eClassifiers xsi:type="ecore:EClass" name="LabelGNode" eSuperTypes="#//BPMNGNode"/>
<eClassifiers xsi:type="ecore:EClass" name="DataObjectGNode" eSuperTypes="#//BPMNGNode"/>
<eClassifiers xsi:type="ecore:EClass" name="DataStoreGNode" eSuperTypes="#//BPMNGNode"/>
<eClassifiers xsi:type="ecore:EClass" name="MessageGNode" eSuperTypes="#//BPMNGNode"/>
<eClassifiers xsi:type="ecore:EClass" name="GroupGNode" eSuperTypes="#//BPMNGNode"/>
<eClassifiers xsi:type="ecore:EClass" name="TextAnnotationGNode" eSuperTypes="#//BPMNGNode"/>
Expand Down
7 changes: 4 additions & 3 deletions open-bpmn.glsp-server/model/bpmn-glsp.genmodel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/open-bpmn.glsp-server/src/main/java-gen" modelPluginID="open-bpmn.glsp-server"
modelName="Bpmn-glsp" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" copyrightFields="false"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/open-bpmn/open-bpmn.glsp-server/src/main/java-gen"
modelPluginID="open-bpmn.server" modelName="Bpmn-glsp" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
importerID="org.eclipse.emf.importer.ecore" complianceLevel="17.0" copyrightFields="false"
operationReflection="true" importOrganizing="true">
<foreignModel>bpmn-glsp.ecore</foreignModel>
<genPackages prefix="Bpmn" basePackage="org.openbpmn.glsp" disposableProviderFactory="true"
Expand All @@ -21,6 +21,7 @@
<genClasses ecoreClass="bpmn-glsp.ecore#//EventGNode"/>
<genClasses ecoreClass="bpmn-glsp.ecore#//LabelGNode"/>
<genClasses ecoreClass="bpmn-glsp.ecore#//DataObjectGNode"/>
<genClasses ecoreClass="bpmn-glsp.ecore#//DataStoreGNode"/>
<genClasses ecoreClass="bpmn-glsp.ecore#//MessageGNode"/>
<genClasses ecoreClass="bpmn-glsp.ecore#//GroupGNode"/>
<genClasses ecoreClass="bpmn-glsp.ecore#//TextAnnotationGNode"/>
Expand Down
Loading

0 comments on commit 50739e7

Please sign in to comment.