aurea-eden 1.25.1 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +300 -95
- package/dist/bpmn-diagram.es.js +37516 -25040
- package/dist/bpmn-diagram.umd.js +13 -5790
- package/package.json +17 -8
- package/.gitattributes +0 -2
- package/.github/workflows/static.yml +0 -43
- package/CHANGELOG.md +0 -60
- package/README_.md +0 -174
- package/assets/3diagram_logo.png +0 -0
- package/assets/aurea-eden-logo.jpeg +0 -0
- package/assets/favicon/about.txt +0 -6
- package/assets/favicon/android-chrome-192x192.png +0 -0
- package/assets/favicon/android-chrome-512x512.png +0 -0
- package/assets/favicon/apple-touch-icon.png +0 -0
- package/assets/favicon/favicon-16x16.png +0 -0
- package/assets/favicon/favicon-32x32.png +0 -0
- package/assets/favicon/favicon.ico +0 -0
- package/assets/favicon/site.webmanifest +0 -1
- package/assets/threejs_camera.jpg.webp +0 -0
- package/assets/threejs_camera3.jpg.webp +0 -0
- package/assets/threejs_cameras.webp +0 -0
- package/assets/threejs_cameras2.webp +0 -0
- package/assets/threejs_objects.webp +0 -0
- package/assets/threejs_scene.webp +0 -0
- package/assets/threejs_scene_graph.webp +0 -0
- package/favicon.ico +0 -0
- package/index.html +0 -34
- package/index.js +0 -153
- package/lib/connectors/Connector.js +0 -47
- package/lib/diagrams/Diagram.js +0 -710
- package/lib/diagrams/DiagramConstants.js +0 -22
- package/lib/elements/Element.js +0 -860
- package/lib/materials/BarMaterial.js +0 -17
- package/lib/materials/DiagramEditMaterial.js +0 -28
- package/lib/notations/BpmnDiagram.js +0 -861
- package/lib/shapes/Shape.js +0 -23
- package/lib/shapes/bar/ValueBarConstants.js +0 -34
- package/lib/shapes/bar/ValueBarShape.js +0 -52
- package/lib/shapes/basic/BasicShapeConstants.js +0 -23
- package/lib/shapes/basic/BoxShape.js +0 -12
- package/lib/shapes/basic/CircleShape.js +0 -55
- package/lib/shapes/basic/DiamondShape.js +0 -169
- package/lib/shapes/basic/RoundedRectangleShape.js +0 -180
- package/lib/shapes/connector/ConnectorConstants.js +0 -7
- package/lib/shapes/connector/RoundedCornerOrthogonalConnectorShape.js +0 -229
- package/lib/shapes/icon/IconConstants.js +0 -7
- package/lib/shapes/icon/IconShape.js +0 -92
- package/lib/shapes/icon/bpmn/activities/ad-hoc-marker.svg +0 -50
- package/lib/shapes/icon/bpmn/activities/business-rule.svg +0 -92
- package/lib/shapes/icon/bpmn/activities/compensation-marker.svg +0 -50
- package/lib/shapes/icon/bpmn/activities/loop-marker.svg +0 -50
- package/lib/shapes/icon/bpmn/activities/manual.svg +0 -51
- package/lib/shapes/icon/bpmn/activities/parallel-mi-marker.svg +0 -70
- package/lib/shapes/icon/bpmn/activities/receive.svg +0 -77
- package/lib/shapes/icon/bpmn/activities/script.svg +0 -54
- package/lib/shapes/icon/bpmn/activities/send.svg +0 -86
- package/lib/shapes/icon/bpmn/activities/sequential-mi-marker.svg +0 -70
- package/lib/shapes/icon/bpmn/activities/service.svg +0 -58
- package/lib/shapes/icon/bpmn/activities/sub-process-marker.svg +0 -51
- package/lib/shapes/icon/bpmn/activities/user.svg +0 -50
- package/lib/shapes/icon/bpmn/events/compensation.svg +0 -47
- package/lib/shapes/icon/bpmn/events/conditional.svg +0 -47
- package/lib/shapes/icon/bpmn/events/error.svg +0 -47
- package/lib/shapes/icon/bpmn/events/escalation.svg +0 -47
- package/lib/shapes/icon/bpmn/events/intermediate-compensation.svg +0 -53
- package/lib/shapes/icon/bpmn/events/intermediate-conditional.svg +0 -53
- package/lib/shapes/icon/bpmn/events/intermediate-escalation.svg +0 -53
- package/lib/shapes/icon/bpmn/events/intermediate-link-catch.svg +0 -53
- package/lib/shapes/icon/bpmn/events/intermediate-link-throw.svg +0 -53
- package/lib/shapes/icon/bpmn/events/intermediate-receive.svg +0 -53
- package/lib/shapes/icon/bpmn/events/intermediate-send.svg +0 -69
- package/lib/shapes/icon/bpmn/events/intermediate-signal-catch.svg +0 -53
- package/lib/shapes/icon/bpmn/events/intermediate-signal-throw.svg +0 -53
- package/lib/shapes/icon/bpmn/events/intermediate-timer.svg +0 -107
- package/lib/shapes/icon/bpmn/events/intermediate.svg +0 -49
- package/lib/shapes/icon/bpmn/events/message-end.svg +0 -54
- package/lib/shapes/icon/bpmn/events/message-start.svg +0 -41
- package/lib/shapes/icon/bpmn/events/signal-end.svg +0 -47
- package/lib/shapes/icon/bpmn/events/signal-start.svg +0 -47
- package/lib/shapes/icon/bpmn/events/terminate.svg +0 -49
- package/lib/shapes/icon/bpmn/events/timer.svg +0 -104
- package/lib/shapes/icon/bpmn/gateways/complex.svg +0 -61
- package/lib/shapes/icon/bpmn/gateways/event-based.svg +0 -68
- package/lib/shapes/icon/bpmn/gateways/exclusive.svg +0 -57
- package/lib/shapes/icon/bpmn/gateways/inclusive.svg +0 -57
- package/lib/shapes/icon/bpmn/gateways/parallel.svg +0 -56
- package/lib/shapes/icon/decorators.svg +0 -262
- package/lib/shapes/icon/hexagon.svg +0 -5
- package/lib/shapes/text/Roboto_Regular.json +0 -5610
- package/lib/shapes/text/TextShape.js +0 -29
- package/lib/shapes/text/fonts/Roboto.zip +0 -0
- package/vite.config.js +0 -15
|
@@ -1,861 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
// Import Diagram and Element classes and constants
|
|
3
|
-
import { Diagram } from '../diagrams/Diagram.js';
|
|
4
|
-
import { DiagramDimensions } from '../diagrams/DiagramConstants.js';
|
|
5
|
-
import { Element } from '../elements/Element.js';
|
|
6
|
-
import { Connector } from '../connectors/Connector.js';
|
|
7
|
-
// Import element shapes
|
|
8
|
-
import { CircleShape } from '../shapes/basic/CircleShape.js';
|
|
9
|
-
import { RoundedRectangleShape } from '../shapes/basic/RoundedRectangleShape.js';
|
|
10
|
-
import { DiamondShape } from '../shapes/basic/DiamondShape.js';
|
|
11
|
-
import { TextShape } from '../shapes/text/TextShape.js';
|
|
12
|
-
// Import connector shapes
|
|
13
|
-
import { RoundedCornerOrthogonalConnectorShape } from '../shapes/connector/RoundedCornerOrthogonalConnectorShape.js';
|
|
14
|
-
// Import Activity icons
|
|
15
|
-
import manual from '../shapes/icon/bpmn/activities/manual.svg?raw';
|
|
16
|
-
import user from '../shapes/icon/bpmn/activities/user.svg?raw';
|
|
17
|
-
import script from '../shapes/icon/bpmn/activities/script.svg?raw';
|
|
18
|
-
import businessRule from '../shapes/icon/bpmn/activities/business-rule.svg?raw';
|
|
19
|
-
import service from '../shapes/icon/bpmn/activities/service.svg?raw';
|
|
20
|
-
import send from '../shapes/icon/bpmn/activities/send.svg?raw';
|
|
21
|
-
import receive from '../shapes/icon/bpmn/activities/receive.svg?raw';
|
|
22
|
-
// Import Gateway icons
|
|
23
|
-
import inclusive from '../shapes/icon/bpmn/gateways/inclusive.svg?raw';
|
|
24
|
-
import exclusive from '../shapes/icon/bpmn/gateways/exclusive.svg?raw';
|
|
25
|
-
import parallel from '../shapes/icon/bpmn/gateways/parallel.svg?raw';
|
|
26
|
-
import eventBased from '../shapes/icon/bpmn/gateways/event-based.svg?raw';
|
|
27
|
-
import complex from '../shapes/icon/bpmn/gateways/complex.svg?raw';
|
|
28
|
-
// Import Event icons
|
|
29
|
-
import compensation from '../shapes/icon/bpmn/events/compensation.svg?raw';
|
|
30
|
-
import conditional from '../shapes/icon/bpmn/events/conditional.svg?raw';
|
|
31
|
-
import error from '../shapes/icon/bpmn/events/error.svg?raw';
|
|
32
|
-
import escalation from '../shapes/icon/bpmn/events/escalation.svg?raw';
|
|
33
|
-
import intermediate from '../shapes/icon/bpmn/events/intermediate.svg?raw';
|
|
34
|
-
import intermediateCompensation from '../shapes/icon/bpmn/events/intermediate-compensation.svg?raw';
|
|
35
|
-
import intermediateConditional from '../shapes/icon/bpmn/events/intermediate-conditional.svg?raw';
|
|
36
|
-
import intermediateEscalation from '../shapes/icon/bpmn/events/intermediate-escalation.svg?raw';
|
|
37
|
-
import intermediateLinkCatch from '../shapes/icon/bpmn/events/intermediate-link-catch.svg?raw';
|
|
38
|
-
import intermediateLinkThrow from '../shapes/icon/bpmn/events/intermediate-link-throw.svg?raw';
|
|
39
|
-
import intermediateReceive from '../shapes/icon/bpmn/events/intermediate-receive.svg?raw';
|
|
40
|
-
import intermediateSend from '../shapes/icon/bpmn/events/intermediate-send.svg?raw';
|
|
41
|
-
import intermediateSignalCatch from '../shapes/icon/bpmn/events/intermediate-signal-catch.svg?raw';
|
|
42
|
-
import intermediateSignalThrow from '../shapes/icon/bpmn/events/intermediate-signal-throw.svg?raw';
|
|
43
|
-
import intermediateTimer from '../shapes/icon/bpmn/events/intermediate-timer.svg?raw';
|
|
44
|
-
import messageEnd from '../shapes/icon/bpmn/events/message-end.svg?raw';
|
|
45
|
-
import messageStart from '../shapes/icon/bpmn/events/message-start.svg?raw';
|
|
46
|
-
import signalEnd from '../shapes/icon/bpmn/events/signal-end.svg?raw';
|
|
47
|
-
import signalStart from '../shapes/icon/bpmn/events/signal-start.svg?raw';
|
|
48
|
-
import terminate from '../shapes/icon/bpmn/events/terminate.svg?raw';
|
|
49
|
-
import timer from '../shapes/icon/bpmn/events/timer.svg?raw';
|
|
50
|
-
|
|
51
|
-
import { add } from 'tween.js';
|
|
52
|
-
|
|
53
|
-
class BpmnDiagram extends Diagram {
|
|
54
|
-
constructor(container) {
|
|
55
|
-
super(container);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// --------------------------------------------------
|
|
59
|
-
// BPMN Diagram Dimensions
|
|
60
|
-
// --------------------------------------------------
|
|
61
|
-
static get Dimensions() {
|
|
62
|
-
return {
|
|
63
|
-
DISTANCE_BETWEEN_ELEMENTS: DiagramDimensions.DISTANCE_BETWEEN_ELEMENTS,
|
|
64
|
-
START_EVENT_LINE_WIDTH: 1,
|
|
65
|
-
END_EVENT_LINE_WIDTH: 2.4,
|
|
66
|
-
ICON_SIZE_SMALL: 10,
|
|
67
|
-
ICON_SIZE_MEDIUM: 18,
|
|
68
|
-
ICON_SIZE_LARGE: 30
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// --------------------------------------------------
|
|
73
|
-
// Add BPMN Elements
|
|
74
|
-
// --------------------------------------------------
|
|
75
|
-
|
|
76
|
-
// Start Events
|
|
77
|
-
addStartEvent(elementId) {
|
|
78
|
-
return this.addElement( new Element(elementId, new CircleShape()) );
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
addMessageStartEvent(elementId) {
|
|
82
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
83
|
-
.addIcon(messageStart, 'center', BpmnDiagram.Dimensions.ICON_SIZE_MEDIUM);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
addTimerStartEvent(elementId) {
|
|
87
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
88
|
-
.addIcon(timer, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
addConditionalStartEvent(elementId) {
|
|
92
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
93
|
-
.addIcon(conditional, 'center', BpmnDiagram.Dimensions.ICON_SIZE_MEDIUM);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
addSignalStartEvent(elementId) {
|
|
97
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
98
|
-
.addIcon(signalStart, 'center', BpmnDiagram.Dimensions.ICON_SIZE_MEDIUM);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Intermediate Events
|
|
102
|
-
addIntermediateEvent(elementId) {
|
|
103
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
104
|
-
.addIcon(intermediate, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
addIntermediateMessageCatchEvent(elementId) {
|
|
108
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
109
|
-
.addIcon(intermediateReceive, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
addIntermediateMessageThrowEvent(elementId) {
|
|
113
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
114
|
-
.addIcon(intermediateSend, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
addIntermediateTimerEvent(elementId) {
|
|
118
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
119
|
-
.addIcon(intermediateTimer, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
addIntermediateEscalationEvent(elementId) {
|
|
123
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
124
|
-
.addIcon(intermediateEscalation, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
addIntermediateConditionalEvent(elementId) {
|
|
128
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
129
|
-
.addIcon(intermediateConditional, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
addIntermediateLinkCatchEvent(elementId) {
|
|
133
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
134
|
-
.addIcon(intermediateLinkCatch, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
addIntermediateLinkThrowEvent(elementId) {
|
|
138
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
139
|
-
.addIcon(intermediateLinkThrow, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
addIntermediateCompensationEvent(elementId) {
|
|
143
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
144
|
-
.addIcon(intermediateCompensation, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
addIntermediateSignalCatchEvent(elementId) {
|
|
148
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
149
|
-
.addIcon(intermediateSignalCatch, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
addIntermediateSignalThrowEvent(elementId) {
|
|
153
|
-
return this.addElement( new Element(elementId, new CircleShape()) )
|
|
154
|
-
.addIcon(intermediateSignalThrow, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// End Events
|
|
158
|
-
addEndEvent(elementId) {
|
|
159
|
-
return this.addElement( new Element(elementId, new CircleShape(BpmnDiagram.Dimensions.END_EVENT_LINE_WIDTH)) )
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
addMessageEndEvent(elementId) {
|
|
163
|
-
return this.addElement( new Element(elementId, new CircleShape(BpmnDiagram.Dimensions.END_EVENT_LINE_WIDTH)) )
|
|
164
|
-
.addIcon(messageEnd, 'center', BpmnDiagram.Dimensions.ICON_SIZE_MEDIUM);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
addEscalationEndEvent(elementId) {
|
|
168
|
-
return this.addElement( new Element(elementId, new CircleShape(BpmnDiagram.Dimensions.END_EVENT_LINE_WIDTH)) )
|
|
169
|
-
.addIcon(escalation, 'center', BpmnDiagram.Dimensions.ICON_SIZE_MEDIUM);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
addErrorEndEvent(elementId) {
|
|
173
|
-
return this.addElement( new Element(elementId, new CircleShape(BpmnDiagram.Dimensions.END_EVENT_LINE_WIDTH)) )
|
|
174
|
-
.addIcon(error, 'center', BpmnDiagram.Dimensions.ICON_SIZE_MEDIUM);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
addCompensateEndEvent(elementId) {
|
|
178
|
-
return this.addElement( new Element(elementId, new CircleShape(BpmnDiagram.Dimensions.END_EVENT_LINE_WIDTH)) )
|
|
179
|
-
.addIcon(compensation, 'center', BpmnDiagram.Dimensions.ICON_SIZE_MEDIUM);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
addSignalEndEvent(elementId) {
|
|
183
|
-
return this.addElement( new Element(elementId, new CircleShape(BpmnDiagram.Dimensions.END_EVENT_LINE_WIDTH)) )
|
|
184
|
-
.addIcon(signalEnd, 'center', BpmnDiagram.Dimensions.ICON_SIZE_MEDIUM);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
addTerminateEndEvent(elementId) {
|
|
188
|
-
return this.addElement( new Element(elementId, new CircleShape(BpmnDiagram.Dimensions.END_EVENT_LINE_WIDTH)) )
|
|
189
|
-
.addIcon(terminate, 'center', BpmnDiagram.Dimensions.ICON_SIZE_MEDIUM);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
// Tasks
|
|
194
|
-
addTask(elementId) {
|
|
195
|
-
return this.addElement( new Element(elementId, new RoundedRectangleShape()) );
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
addManualTask(elementId) {
|
|
199
|
-
return this.addElement( new Element(elementId, new RoundedRectangleShape()) )
|
|
200
|
-
.addIcon(manual, 'top-left', BpmnDiagram.Dimensions.ICON_SIZE_SMALL);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
addUserTask(elementId) {
|
|
204
|
-
return this.addElement( new Element(elementId, new RoundedRectangleShape()) )
|
|
205
|
-
.addIcon(user, 'top-left', BpmnDiagram.Dimensions.ICON_SIZE_SMALL);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
addScriptTask(elementId) {
|
|
209
|
-
return this.addElement( new Element(elementId, new RoundedRectangleShape()) )
|
|
210
|
-
.addIcon(script, 'top-left', BpmnDiagram.Dimensions.ICON_SIZE_SMALL);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
addBusinessRuleTask(elementId) {
|
|
214
|
-
return this.addElement( new Element(elementId, new RoundedRectangleShape()) )
|
|
215
|
-
.addIcon(businessRule, 'top-left', BpmnDiagram.Dimensions.ICON_SIZE_SMALL);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
addServiceTask(elementId) {
|
|
219
|
-
return this.addElement( new Element(elementId, new RoundedRectangleShape()) )
|
|
220
|
-
.addIcon(service, 'top-left', BpmnDiagram.Dimensions.ICON_SIZE_SMALL);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
addSendTask(elementId) {
|
|
224
|
-
return this.addElement( new Element(elementId, new RoundedRectangleShape()) )
|
|
225
|
-
.addIcon(send, 'top-left', BpmnDiagram.Dimensions.ICON_SIZE_SMALL);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
addReceiveTask(elementId) {
|
|
229
|
-
return this.addElement( new Element(elementId, new RoundedRectangleShape()) )
|
|
230
|
-
.addIcon(receive, 'top-left', BpmnDiagram.Dimensions.ICON_SIZE_SMALL);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Gateways
|
|
234
|
-
addGateway(elementId) {
|
|
235
|
-
return this.addExclusiveGateway(elementId);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
addInclusiveGateway(elementId) {
|
|
239
|
-
return this.addElement( new Element(elementId, new DiamondShape()) )
|
|
240
|
-
.addIcon(inclusive, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
addExclusiveGateway(elementId) {
|
|
244
|
-
return this.addElement( new Element(elementId, new DiamondShape()) )
|
|
245
|
-
.addIcon(exclusive, 'center', BpmnDiagram.Dimensions.ICON_SIZE_MEDIUM);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
addParallelGateway(elementId) {
|
|
249
|
-
return this.addElement( new Element(elementId, new DiamondShape()) )
|
|
250
|
-
.addIcon(parallel, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
addEventBasedGateway(elementId) {
|
|
254
|
-
return this.addElement( new Element(elementId, new DiamondShape()) )
|
|
255
|
-
.addIcon(eventBased, 'center', BpmnDiagram.Dimensions.ICON_SIZE_LARGE);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
addComplexGateway(elementId) {
|
|
259
|
-
return this.addElement( new Element(elementId, new DiamondShape()) )
|
|
260
|
-
.addIcon(complex, 'center', BpmnDiagram.Dimensions.ICON_SIZE_MEDIUM);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
// --------------------------------------------------
|
|
266
|
-
// Add BPMN Connectors
|
|
267
|
-
// --------------------------------------------------
|
|
268
|
-
|
|
269
|
-
addFlowConnector(elementId, points) {
|
|
270
|
-
return this.addConnector( new Connector(elementId, new RoundedCornerOrthogonalConnectorShape(points)) );
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// --------------------------------------------------
|
|
274
|
-
// Import BPMN Diagram from .bpmn file (XML)
|
|
275
|
-
// --------------------------------------------------
|
|
276
|
-
|
|
277
|
-
import(file) {
|
|
278
|
-
if (!file) {
|
|
279
|
-
console.error('No file provided for import.');
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
const reader = new FileReader();
|
|
284
|
-
reader.onload = (event) => {
|
|
285
|
-
if (file.name.endsWith('.bpmn')) {
|
|
286
|
-
const parser = new DOMParser();
|
|
287
|
-
const xmlDoc = parser.parseFromString(event.target.result, "text/xml");
|
|
288
|
-
console.log(xmlDoc);
|
|
289
|
-
this.buildDiagram(xmlDoc);
|
|
290
|
-
} else {
|
|
291
|
-
console.warn('File format not supported.');
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
reader.readAsText(file);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
buildDiagram(xmlDoc) {
|
|
298
|
-
const bpmnNamespace = "http://www.omg.org/spec/BPMN/20100524/MODEL";
|
|
299
|
-
const bpmndiNamespace = "http://www.omg.org/spec/BPMN/20100524/DI";
|
|
300
|
-
const dcNamespace = "http://www.omg.org/spec/DD/20100524/DC";
|
|
301
|
-
const diNamespace = "http://www.omg.org/spec/DD/20100524/DI";
|
|
302
|
-
|
|
303
|
-
// Add start events
|
|
304
|
-
const startEvents = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'startEvent');
|
|
305
|
-
for (let i = 0; i < startEvents.length; i++) {
|
|
306
|
-
// Read startEvent id and name
|
|
307
|
-
const startEventId = startEvents[i].getAttribute('id');
|
|
308
|
-
console.log('startEventId:', startEventId);
|
|
309
|
-
const name = startEvents[i].getElementsByTagNameNS(bpmnNamespace, 'name');
|
|
310
|
-
console.log('name:', name);
|
|
311
|
-
// Read startEvent incoming[] and outgoing[]
|
|
312
|
-
const incoming = startEvents[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
313
|
-
console.log('incoming:', incoming);
|
|
314
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
315
|
-
console.log('incoming:', incoming[j].textContent);
|
|
316
|
-
} const outgoing = startEvents[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
317
|
-
console.log('outgoing:', outgoing);
|
|
318
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
319
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
320
|
-
}
|
|
321
|
-
// Add start event element to the diagram
|
|
322
|
-
if (startEvents[i].getElementsByTagNameNS(bpmnNamespace, 'messageEventDefinition').length > 0) {
|
|
323
|
-
this.addMessageStartEvent(startEventId);
|
|
324
|
-
} else if (startEvents[i].getElementsByTagNameNS(bpmnNamespace, 'timerEventDefinition').length > 0) {
|
|
325
|
-
this.addTimerStartEvent(startEventId);
|
|
326
|
-
} else if (startEvents[i].getElementsByTagNameNS(bpmnNamespace, 'conditionalEventDefinition').length > 0) {
|
|
327
|
-
this.addConditionalStartEvent(startEventId);
|
|
328
|
-
} else if (startEvents[i].getElementsByTagNameNS(bpmnNamespace, 'signalEventDefinition').length > 0) {
|
|
329
|
-
this.addSignalStartEvent(startEventId);
|
|
330
|
-
} else {
|
|
331
|
-
// Simple start event
|
|
332
|
-
this.addStartEvent(startEventId);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
// Add end events
|
|
337
|
-
const endEvents = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'endEvent');
|
|
338
|
-
for (let i = 0; i < endEvents.length; i++) {
|
|
339
|
-
// Read endEvent id and name
|
|
340
|
-
const endEventId = endEvents[i].getAttribute('id');
|
|
341
|
-
console.log('endEventId:', endEventId);
|
|
342
|
-
const name = endEvents[i].getElementsByTagNameNS(bpmnNamespace, 'name');
|
|
343
|
-
console.log('name:', name);
|
|
344
|
-
// Read endEvent incoming[] and outgoing[]
|
|
345
|
-
const incoming = endEvents[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
346
|
-
console.log('incoming:', incoming);
|
|
347
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
348
|
-
console.log('incoming:', incoming[j].textContent);
|
|
349
|
-
}
|
|
350
|
-
const outgoing = endEvents[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
351
|
-
console.log('outgoing:', outgoing);
|
|
352
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
353
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
354
|
-
}
|
|
355
|
-
// Add end event element to the diagram
|
|
356
|
-
if (endEvents[i].getElementsByTagNameNS(bpmnNamespace, 'messageEventDefinition').length > 0) {
|
|
357
|
-
this.addMessageEndEvent(endEventId);
|
|
358
|
-
} else if (endEvents[i].getElementsByTagNameNS(bpmnNamespace, 'escalationEventDefinition').length > 0) {
|
|
359
|
-
this.addEscalationEndEvent(endEventId);
|
|
360
|
-
} else if (endEvents[i].getElementsByTagNameNS(bpmnNamespace, 'errorEventDefinition').length > 0) {
|
|
361
|
-
this.addErrorEndEvent(endEventId);
|
|
362
|
-
} else if (endEvents[i].getElementsByTagNameNS(bpmnNamespace, 'compensateEventDefinition').length > 0) {
|
|
363
|
-
this.addCompensateEndEvent(endEventId);
|
|
364
|
-
} else if (endEvents[i].getElementsByTagNameNS(bpmnNamespace, 'signalEventDefinition').length > 0) {
|
|
365
|
-
this.addSignalEndEvent(endEventId);
|
|
366
|
-
} else if (endEvents[i].getElementsByTagNameNS(bpmnNamespace, 'terminateEventDefinition').length > 0) {
|
|
367
|
-
this.addTerminateEndEvent(endEventId);
|
|
368
|
-
} else {
|
|
369
|
-
// Simple end event
|
|
370
|
-
this.addEndEvent(endEventId);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
// Add intermediate catch events
|
|
376
|
-
const intermediateCatchEvents = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'intermediateCatchEvent');
|
|
377
|
-
for (let i = 0; i < intermediateCatchEvents.length; i++) {
|
|
378
|
-
// Read intermediateCatchEvent id and name
|
|
379
|
-
const intermediateCatchEventId = intermediateCatchEvents[i].getAttribute('id');
|
|
380
|
-
console.log('intermediateCatchEventId:', intermediateCatchEventId);
|
|
381
|
-
const name = intermediateCatchEvents[i].getElementsByTagNameNS(bpmnNamespace, 'name');
|
|
382
|
-
console.log('name:', name);
|
|
383
|
-
// Read intermediateCatchEvent incoming[] and outgoing[]
|
|
384
|
-
const incoming = intermediateCatchEvents[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
385
|
-
console.log('incoming:', incoming);
|
|
386
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
387
|
-
console.log('incoming:', incoming[j].textContent);
|
|
388
|
-
}
|
|
389
|
-
const outgoing = intermediateCatchEvents[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
390
|
-
console.log('outgoing:', outgoing);
|
|
391
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
392
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
393
|
-
}
|
|
394
|
-
// Add intermediate catch event element to the diagram
|
|
395
|
-
if (intermediateCatchEvents[i].getElementsByTagNameNS(bpmnNamespace, 'messageEventDefinition').length > 0) {
|
|
396
|
-
this.addIntermediateMessageCatchEvent(intermediateCatchEventId);
|
|
397
|
-
} else if (intermediateCatchEvents[i].getElementsByTagNameNS(bpmnNamespace, 'timerEventDefinition').length > 0) {
|
|
398
|
-
this.addIntermediateTimerEvent(intermediateCatchEventId);
|
|
399
|
-
} else if (intermediateCatchEvents[i].getElementsByTagNameNS(bpmnNamespace, 'conditionalEventDefinition').length > 0) {
|
|
400
|
-
this.addIntermediateConditionalEvent(intermediateCatchEventId);
|
|
401
|
-
} else if (intermediateCatchEvents[i].getElementsByTagNameNS(bpmnNamespace, 'linkEventDefinition').length > 0) {
|
|
402
|
-
this.addIntermediateLinkCatchEvent(intermediateCatchEventId);
|
|
403
|
-
} else if (intermediateCatchEvents[i].getElementsByTagNameNS(bpmnNamespace, 'signalEventDefinition').length > 0) {
|
|
404
|
-
this.addIntermediateSignalCatchEvent(intermediateCatchEventId);
|
|
405
|
-
} else {
|
|
406
|
-
// Simple intermediate catch event
|
|
407
|
-
this.addIntermediateEvent(intermediateCatchEventId);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// Add intermediate throw events
|
|
412
|
-
const intermediateThrowEvents = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'intermediateThrowEvent');
|
|
413
|
-
for (let i = 0; i < intermediateThrowEvents.length; i++) {
|
|
414
|
-
// Read intermediateCatchEvent id and name
|
|
415
|
-
const intermediateThrowEventId = intermediateThrowEvents[i].getAttribute('id');
|
|
416
|
-
console.log('intermediateThrowEventId:', intermediateThrowEventId);
|
|
417
|
-
const name = intermediateThrowEvents[i].getElementsByTagNameNS(bpmnNamespace, 'name');
|
|
418
|
-
console.log('name:', name);
|
|
419
|
-
// Read intermediateCatchEvent incoming[] and outgoing[]
|
|
420
|
-
const incoming = intermediateThrowEvents[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
421
|
-
console.log('incoming:', incoming);
|
|
422
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
423
|
-
console.log('incoming:', incoming[j].textContent);
|
|
424
|
-
}
|
|
425
|
-
const outgoing = intermediateThrowEvents[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
426
|
-
console.log('outgoing:', outgoing);
|
|
427
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
428
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
429
|
-
}
|
|
430
|
-
// Add intermediate throw event element to the diagram
|
|
431
|
-
if (intermediateThrowEvents[i].getElementsByTagNameNS(bpmnNamespace, 'messageEventDefinition').length > 0) {
|
|
432
|
-
this.addIntermediateMessageThrowEvent(intermediateThrowEventId);
|
|
433
|
-
} else if (intermediateThrowEvents[i].getElementsByTagNameNS(bpmnNamespace, 'escalationEventDefinition').length > 0) {
|
|
434
|
-
this.addIntermediateEscalationEvent(intermediateThrowEventId);
|
|
435
|
-
} else if (intermediateThrowEvents[i].getElementsByTagNameNS(bpmnNamespace, 'linkEventDefinition').length > 0) {
|
|
436
|
-
this.addIntermediateLinkThrowEvent(intermediateThrowEventId);
|
|
437
|
-
} else if (intermediateThrowEvents[i].getElementsByTagNameNS(bpmnNamespace, 'compensateEventDefinition').length > 0) {
|
|
438
|
-
this.addIntermediateCompensationEvent(intermediateThrowEventId);
|
|
439
|
-
} else if (intermediateThrowEvents[i].getElementsByTagNameNS(bpmnNamespace, 'signalEventDefinition').length > 0) {
|
|
440
|
-
this.addIntermediateSignalThrowEvent(intermediateThrowEventId);
|
|
441
|
-
} else {
|
|
442
|
-
// Simple intermediate throw event
|
|
443
|
-
this.addIntermediateEvent(intermediateThrowEventId);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
// Add tasks
|
|
453
|
-
const tasks = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'task');
|
|
454
|
-
for (let i = 0; i < tasks.length; i++) {
|
|
455
|
-
// Read task id and name
|
|
456
|
-
const taskId = tasks[i].getAttribute('id');
|
|
457
|
-
console.log('taskId:', taskId);
|
|
458
|
-
const name = tasks[i].getAttribute('name');
|
|
459
|
-
console.log('name:', name);
|
|
460
|
-
// Read task incoming[] and outgoing[]
|
|
461
|
-
const incoming = tasks[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
462
|
-
console.log('incoming:', incoming);
|
|
463
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
464
|
-
console.log('incoming:', incoming[j].textContent);
|
|
465
|
-
}
|
|
466
|
-
const outgoing = tasks[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
467
|
-
console.log('outgoing:', outgoing);
|
|
468
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
469
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
470
|
-
}
|
|
471
|
-
this.addTask(taskId)
|
|
472
|
-
.addWrappedText(name);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
// Add manual tasks
|
|
476
|
-
const manualTasks = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'manualTask');
|
|
477
|
-
for (let i = 0; i < manualTasks.length; i++) {
|
|
478
|
-
// Read manualTask id and name
|
|
479
|
-
const manualTaskId = manualTasks[i].getAttribute('id');
|
|
480
|
-
console.log('manualTaskId:', manualTaskId);
|
|
481
|
-
const name = manualTasks[i].getAttribute('name');
|
|
482
|
-
console.log('name:', name);
|
|
483
|
-
// Read manualTask incoming[] and outgoing[]
|
|
484
|
-
const incoming = manualTasks[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
485
|
-
console.log('incoming:', incoming);
|
|
486
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
487
|
-
console.log('incoming:', incoming[j].textContent);
|
|
488
|
-
}
|
|
489
|
-
const outgoing = manualTasks[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
490
|
-
console.log('outgoing:', outgoing);
|
|
491
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
492
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
493
|
-
}
|
|
494
|
-
this.addManualTask(manualTaskId)
|
|
495
|
-
.addWrappedText(name);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
// Add user tasks
|
|
499
|
-
const userTasks = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'userTask');
|
|
500
|
-
for (let i = 0; i < userTasks.length; i++) {
|
|
501
|
-
// Read userTask id and name
|
|
502
|
-
const userTaskId = userTasks[i].getAttribute('id');
|
|
503
|
-
console.log('userTaskId:', userTaskId);
|
|
504
|
-
const name = userTasks[i].getAttribute('name');
|
|
505
|
-
console.log('name:', name);
|
|
506
|
-
// Read userTask incoming[] and outgoing[]
|
|
507
|
-
const incoming = userTasks[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
508
|
-
console.log('incoming:', incoming);
|
|
509
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
510
|
-
console.log('incoming:', incoming[j].textContent);
|
|
511
|
-
}
|
|
512
|
-
const outgoing = userTasks[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
513
|
-
console.log('outgoing:', outgoing);
|
|
514
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
515
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
516
|
-
}
|
|
517
|
-
this.addUserTask(userTaskId)
|
|
518
|
-
.addWrappedText(name);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
// Add script tasks
|
|
522
|
-
const scriptTasks = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'scriptTask');
|
|
523
|
-
for (let i = 0; i < scriptTasks.length; i++) {
|
|
524
|
-
// Read scriptTask id and name
|
|
525
|
-
const scriptTaskId = scriptTasks[i].getAttribute('id');
|
|
526
|
-
console.log('scriptTaskId:', scriptTaskId);
|
|
527
|
-
const name = scriptTasks[i].getAttribute('name');
|
|
528
|
-
console.log('name:', name);
|
|
529
|
-
// Read scriptTask incoming[] and outgoing[]
|
|
530
|
-
const incoming = scriptTasks[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
531
|
-
console.log('incoming:', incoming);
|
|
532
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
533
|
-
console.log('incoming:', incoming[j].textContent);
|
|
534
|
-
}
|
|
535
|
-
const outgoing = scriptTasks[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
536
|
-
console.log('outgoing:', outgoing);
|
|
537
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
538
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
539
|
-
}
|
|
540
|
-
this.addScriptTask(scriptTaskId)
|
|
541
|
-
.addWrappedText(name);
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
// Add business rule tasks
|
|
545
|
-
const businessRuleTasks = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'businessRuleTask');
|
|
546
|
-
for (let i = 0; i < businessRuleTasks.length; i++) {
|
|
547
|
-
// Read businessRuleTask id and name
|
|
548
|
-
const businessRuleTaskId = businessRuleTasks[i].getAttribute('id');
|
|
549
|
-
console.log('businessRuleTaskId:', businessRuleTaskId);
|
|
550
|
-
const name = businessRuleTasks[i].getAttribute('name');
|
|
551
|
-
console.log('name:', name);
|
|
552
|
-
// Read businessRuleTask incoming[] and outgoing[]
|
|
553
|
-
const incoming = businessRuleTasks[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
554
|
-
console.log('incoming:', incoming);
|
|
555
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
556
|
-
console.log('incoming:', incoming[j].textContent);
|
|
557
|
-
}
|
|
558
|
-
const outgoing = businessRuleTasks[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
559
|
-
console.log('outgoing:', outgoing);
|
|
560
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
561
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
562
|
-
}
|
|
563
|
-
this.addBusinessRuleTask(businessRuleTaskId)
|
|
564
|
-
.addWrappedText(name);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
// Add service tasks
|
|
568
|
-
const serviceTasks = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'serviceTask');
|
|
569
|
-
for (let i = 0; i < serviceTasks.length; i++) {
|
|
570
|
-
// Read serviceTask id and name
|
|
571
|
-
const serviceTaskId = serviceTasks[i].getAttribute('id');
|
|
572
|
-
console.log('serviceTaskId:', serviceTaskId);
|
|
573
|
-
const name = serviceTasks[i].getAttribute('name');
|
|
574
|
-
console.log('name:', name);
|
|
575
|
-
// Read serviceTask incoming[] and outgoing[]
|
|
576
|
-
const incoming = serviceTasks[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
577
|
-
console.log('incoming:', incoming);
|
|
578
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
579
|
-
console.log('incoming:', incoming[j].textContent);
|
|
580
|
-
}
|
|
581
|
-
const outgoing = serviceTasks[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
582
|
-
console.log('outgoing:', outgoing);
|
|
583
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
584
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
585
|
-
}
|
|
586
|
-
this.addServiceTask(serviceTaskId)
|
|
587
|
-
.addWrappedText(name);
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
// Add send tasks
|
|
591
|
-
const sendTasks = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'sendTask');
|
|
592
|
-
for (let i = 0; i < sendTasks.length; i++) {
|
|
593
|
-
// Read sendTask id and name
|
|
594
|
-
const sendTaskId = sendTasks[i].getAttribute('id');
|
|
595
|
-
console.log('sendTaskId:', sendTaskId);
|
|
596
|
-
const name = sendTasks[i].getAttribute('name');
|
|
597
|
-
console.log('name:', name);
|
|
598
|
-
// Read sendTask incoming[] and outgoing[]
|
|
599
|
-
const incoming = sendTasks[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
600
|
-
console.log('incoming:', incoming);
|
|
601
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
602
|
-
console.log('incoming:', incoming[j].textContent);
|
|
603
|
-
}
|
|
604
|
-
const outgoing = sendTasks[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
605
|
-
console.log('outgoing:', outgoing);
|
|
606
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
607
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
608
|
-
}
|
|
609
|
-
this.addSendTask(sendTaskId)
|
|
610
|
-
.addWrappedText(name);
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
// Add receive tasks
|
|
614
|
-
const receiveTasks = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'receiveTask');
|
|
615
|
-
for (let i = 0; i < receiveTasks.length; i++) {
|
|
616
|
-
// Read receiveTask id and name
|
|
617
|
-
const receiveTaskId = receiveTasks[i].getAttribute('id');
|
|
618
|
-
console.log('receiveTaskId:', receiveTaskId);
|
|
619
|
-
const name = receiveTasks[i].getAttribute('name');
|
|
620
|
-
console.log('name:', name);
|
|
621
|
-
// Read receiveTask incoming[] and outgoing[]
|
|
622
|
-
const incoming = receiveTasks[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
623
|
-
console.log('incoming:', incoming);
|
|
624
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
625
|
-
console.log('incoming:', incoming[j].textContent);
|
|
626
|
-
}
|
|
627
|
-
const outgoing = receiveTasks[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
628
|
-
console.log('outgoing:', outgoing);
|
|
629
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
630
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
631
|
-
}
|
|
632
|
-
this.addReceiveTask(receiveTaskId)
|
|
633
|
-
.addWrappedText(name);
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
// Add inclusive gateways
|
|
637
|
-
const inclusiveGateways = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'inclusiveGateway');
|
|
638
|
-
for (let i = 0; i < inclusiveGateways.length; i++) {
|
|
639
|
-
// Read gateway id and name
|
|
640
|
-
const gatewayId = inclusiveGateways[i].getAttribute('id');
|
|
641
|
-
console.log('gatewayId:', gatewayId);
|
|
642
|
-
const name = inclusiveGateways[i].getAttribute('name');
|
|
643
|
-
console.log('name:', name);
|
|
644
|
-
// Read gateway incoming[] and outgoing[]
|
|
645
|
-
const incoming = inclusiveGateways[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
646
|
-
console.log('incoming:', incoming);
|
|
647
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
648
|
-
console.log('incoming:', incoming[j].textContent);
|
|
649
|
-
}
|
|
650
|
-
const outgoing = inclusiveGateways[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
651
|
-
console.log('outgoing:', outgoing);
|
|
652
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
653
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
654
|
-
}
|
|
655
|
-
this.addInclusiveGateway(gatewayId);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
// Add exclusive gateways
|
|
659
|
-
const exclusiveGateways = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'exclusiveGateway');
|
|
660
|
-
for (let i = 0; i < exclusiveGateways.length; i++) {
|
|
661
|
-
// Read gateway id and name
|
|
662
|
-
const gatewayId = exclusiveGateways[i].getAttribute('id');
|
|
663
|
-
console.log('gatewayId:', gatewayId);
|
|
664
|
-
const name = exclusiveGateways[i].getAttribute('name');
|
|
665
|
-
console.log('name:', name);
|
|
666
|
-
// Read gateway incoming[] and outgoing[]
|
|
667
|
-
const incoming = exclusiveGateways[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
668
|
-
console.log('incoming:', incoming);
|
|
669
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
670
|
-
console.log('incoming:', incoming[j].textContent);
|
|
671
|
-
}
|
|
672
|
-
const outgoing = exclusiveGateways[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
673
|
-
console.log('outgoing:', outgoing);
|
|
674
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
675
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
676
|
-
}
|
|
677
|
-
this.addExclusiveGateway(gatewayId);
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
// Add parallel gateways
|
|
681
|
-
const parallelGateways = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'parallelGateway');
|
|
682
|
-
for (let i = 0; i < parallelGateways.length; i++) {
|
|
683
|
-
// Read gateway id and name
|
|
684
|
-
const gatewayId = parallelGateways[i].getAttribute('id');
|
|
685
|
-
console.log('gatewayId:', gatewayId);
|
|
686
|
-
const name = parallelGateways[i].getAttribute('name');
|
|
687
|
-
console.log('name:', name);
|
|
688
|
-
// Read gateway incoming[] and outgoing[]
|
|
689
|
-
const incoming = parallelGateways[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
690
|
-
console.log('incoming:', incoming);
|
|
691
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
692
|
-
console.log('incoming:', incoming[j].textContent);
|
|
693
|
-
}
|
|
694
|
-
const outgoing = parallelGateways[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
695
|
-
console.log('outgoing:', outgoing);
|
|
696
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
697
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
698
|
-
}
|
|
699
|
-
this.addParallelGateway(gatewayId);
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
// Add event-based gateways
|
|
703
|
-
const eventBasedGateways = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'eventBasedGateway');
|
|
704
|
-
for (let i = 0; i < eventBasedGateways.length; i++) {
|
|
705
|
-
// Read gateway id and name
|
|
706
|
-
const gatewayId = eventBasedGateways[i].getAttribute('id');
|
|
707
|
-
console.log('gatewayId:', gatewayId);
|
|
708
|
-
const name = eventBasedGateways[i].getAttribute('name');
|
|
709
|
-
console.log('name:', name);
|
|
710
|
-
// Read gateway incoming[] and outgoing[]
|
|
711
|
-
const incoming = eventBasedGateways[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
712
|
-
console.log('incoming:', incoming);
|
|
713
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
714
|
-
console.log('incoming:', incoming[j].textContent);
|
|
715
|
-
}
|
|
716
|
-
const outgoing = eventBasedGateways[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
717
|
-
console.log('outgoing:', outgoing);
|
|
718
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
719
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
720
|
-
}
|
|
721
|
-
this.addEventBasedGateway(gatewayId);
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
// Add complex gateways
|
|
725
|
-
const complexGateways = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'complexGateway');
|
|
726
|
-
for (let i = 0; i < complexGateways.length; i++) {
|
|
727
|
-
// Read gateway id and name
|
|
728
|
-
const gatewayId = complexGateways[i].getAttribute('id');
|
|
729
|
-
console.log('gatewayId:', gatewayId);
|
|
730
|
-
const name = complexGateways[i].getAttribute('name');
|
|
731
|
-
console.log('name:', name);
|
|
732
|
-
// Read gateway incoming[] and outgoing[]
|
|
733
|
-
const incoming = complexGateways[i].getElementsByTagNameNS(bpmnNamespace, 'incoming');
|
|
734
|
-
console.log('incoming:', incoming);
|
|
735
|
-
for (let j = 0; j < incoming.length; j++) {
|
|
736
|
-
console.log('incoming:', incoming[j].textContent);
|
|
737
|
-
}
|
|
738
|
-
const outgoing = complexGateways[i].getElementsByTagNameNS(bpmnNamespace, 'outgoing');
|
|
739
|
-
console.log('outgoing:', outgoing);
|
|
740
|
-
for (let j = 0; j < outgoing.length; j++) {
|
|
741
|
-
console.log('outgoing:', outgoing[j].textContent);
|
|
742
|
-
}
|
|
743
|
-
this.addComplexGateway(gatewayId);
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
// Add sequence flows
|
|
747
|
-
const sequenceFlows = xmlDoc.getElementsByTagNameNS(bpmnNamespace, 'sequenceFlow');
|
|
748
|
-
for (let i = 0; i < sequenceFlows.length; i++) {
|
|
749
|
-
// Read sequenceFlow id, name, sourceRef, and targetRef
|
|
750
|
-
const sequenceFlowId = sequenceFlows[i].getAttribute('id');
|
|
751
|
-
console.log('sequenceFlowId:', sequenceFlowId);
|
|
752
|
-
const name = sequenceFlows[i].getAttribute('name');
|
|
753
|
-
console.log('name:', name);
|
|
754
|
-
const sourceRef = sequenceFlows[i].getAttribute('sourceRef');
|
|
755
|
-
console.log('sourceRef:', sourceRef);
|
|
756
|
-
const targetRef = sequenceFlows[i].getAttribute('targetRef');
|
|
757
|
-
console.log('targetRef:', targetRef);
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
// Place elements on the diagram
|
|
762
|
-
const bpmnShapes = xmlDoc.getElementsByTagNameNS(bpmndiNamespace, 'BPMNShape');
|
|
763
|
-
|
|
764
|
-
for (let i = 0; i < bpmnShapes.length; i++) {
|
|
765
|
-
const bpmnShape = bpmnShapes[i];
|
|
766
|
-
const bpmnShapeId = bpmnShape.getAttribute('id');
|
|
767
|
-
const bpmnElementId = bpmnShape.getAttribute('bpmnElement');
|
|
768
|
-
const bounds = bpmnShape.getElementsByTagNameNS(dcNamespace, 'Bounds')[0];
|
|
769
|
-
if (bounds) {
|
|
770
|
-
const x = parseFloat(bounds.getAttribute('x'));
|
|
771
|
-
const y = parseFloat(bounds.getAttribute('y')) * (-1);
|
|
772
|
-
const width = parseFloat(bounds.getAttribute('width'));
|
|
773
|
-
const height = parseFloat(bounds.getAttribute('height'));
|
|
774
|
-
|
|
775
|
-
console.log(`BPMNShape: ${bpmnShapeId}, ${bpmnElementId}, x: ${x}, y: ${y}, width: ${width}, height: ${height}`);
|
|
776
|
-
|
|
777
|
-
const position = new THREE.Vector3(x + (width / 2), y - (height / 2), 0);
|
|
778
|
-
const element = this.getElementById(bpmnElementId);
|
|
779
|
-
if (element) {
|
|
780
|
-
element.positionAt(position);
|
|
781
|
-
} else {
|
|
782
|
-
console.warn(`Element with id ${bpmnElementId} not found.`);
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
// Add label to the element (BPMNLabel)
|
|
786
|
-
let labelX, labelY, labelWidth, labelHeight;
|
|
787
|
-
const bpmnLabel = bpmnShape.getElementsByTagNameNS(bpmndiNamespace, 'BPMNLabel');
|
|
788
|
-
if (bpmnLabel.length > 0) {
|
|
789
|
-
const labelBounds = bpmnLabel[0].getElementsByTagNameNS(dcNamespace, 'Bounds')[0];
|
|
790
|
-
if (labelBounds) {
|
|
791
|
-
labelX = parseFloat(labelBounds.getAttribute('x'));
|
|
792
|
-
labelY = parseFloat(labelBounds.getAttribute('y')) * (-1);
|
|
793
|
-
labelWidth = parseFloat(labelBounds.getAttribute('width'));
|
|
794
|
-
labelHeight = parseFloat(labelBounds.getAttribute('height'));
|
|
795
|
-
console.log(`Label position (Shape): x: ${labelX}, y: ${labelY}, width: ${labelWidth}, height: ${labelHeight}`);
|
|
796
|
-
|
|
797
|
-
// Read label value from elements like bpmn:task, bpmn:startEvent, etc.
|
|
798
|
-
const bpmnElement = xmlDoc.getElementById(bpmnElementId);
|
|
799
|
-
const bpmnElementName = bpmnElement.getAttribute('name');
|
|
800
|
-
console.log(`bpmnElementName: ${bpmnElementName}`);
|
|
801
|
-
|
|
802
|
-
// Add label to the element
|
|
803
|
-
if (bpmnElementName) {
|
|
804
|
-
const labelPosition = new THREE.Vector3(labelX + (labelWidth / 2), labelY - (labelHeight / 2), 0);
|
|
805
|
-
this.addElement(new Element('t1', new TextShape(bpmnElementName)))
|
|
806
|
-
.positionAt(labelPosition);
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
// Connect elements with sequence flows
|
|
814
|
-
const bpmnEdges = xmlDoc.getElementsByTagNameNS(bpmndiNamespace, 'BPMNEdge');
|
|
815
|
-
|
|
816
|
-
for (let i = 0; i < bpmnEdges.length; i++) {
|
|
817
|
-
const bpmnEdge = bpmnEdges[i];
|
|
818
|
-
const bpmnEdgeId = bpmnEdge.getAttribute('id');
|
|
819
|
-
const bpmnElementId = bpmnEdge.getAttribute('bpmnElement');
|
|
820
|
-
const sequenceFlow = Array.from(sequenceFlows).find(flow => flow.getAttribute('id') === bpmnElementId);
|
|
821
|
-
const sequenceFlowName = sequenceFlow ? sequenceFlow.getAttribute('name') : null;
|
|
822
|
-
|
|
823
|
-
// get waypoints
|
|
824
|
-
const waypoints = bpmnEdge.getElementsByTagNameNS(diNamespace, 'waypoint');
|
|
825
|
-
const connectorPoints = [];
|
|
826
|
-
for (let j = 0; j < waypoints.length; j++) {
|
|
827
|
-
const waypoint = waypoints[j];
|
|
828
|
-
const x = parseFloat(waypoint.getAttribute('x'));
|
|
829
|
-
const y = parseFloat(waypoint.getAttribute('y')) * (-1);
|
|
830
|
-
connectorPoints.push(new THREE.Vector2(x, y));
|
|
831
|
-
console.log(`BPMNEdge: ${bpmnElementId}, x: ${x}, y: ${y}`);
|
|
832
|
-
}
|
|
833
|
-
console.log('connectorPoints:', connectorPoints);
|
|
834
|
-
|
|
835
|
-
// Add connector to the diagram
|
|
836
|
-
this.addConnector(this.addFlowConnector(bpmnEdgeId, connectorPoints));
|
|
837
|
-
|
|
838
|
-
// Add label to the connector (BPMNLabel)
|
|
839
|
-
let labelX, labelY, labelWidth, labelHeight;
|
|
840
|
-
const bpmnLabel = bpmnEdge.getElementsByTagNameNS(bpmndiNamespace, 'BPMNLabel');
|
|
841
|
-
if (bpmnLabel.length > 0) {
|
|
842
|
-
const labelBounds = bpmnLabel[0].getElementsByTagNameNS(dcNamespace, 'Bounds')[0];
|
|
843
|
-
if (labelBounds) {
|
|
844
|
-
labelX = parseFloat(labelBounds.getAttribute('x'));
|
|
845
|
-
labelY = parseFloat(labelBounds.getAttribute('y')) * (-1);
|
|
846
|
-
labelWidth = parseFloat(labelBounds.getAttribute('width'));
|
|
847
|
-
labelHeight = parseFloat(labelBounds.getAttribute('height'));
|
|
848
|
-
console.log(`Label position: x: ${labelX}, y: ${labelY}, width: ${labelWidth}, height: ${labelHeight}`);
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
if (sequenceFlowName) {
|
|
852
|
-
const labelPosition = new THREE.Vector3(labelX + (labelWidth / 2), labelY - (labelHeight / 2), 0);
|
|
853
|
-
this.addElement(new Element('t1', new TextShape(sequenceFlowName)))
|
|
854
|
-
.positionAt(labelPosition);
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
this.arrange();
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
export { BpmnDiagram };
|