camunda-bpmn-js 0.11.5 → 0.12.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/CHANGELOG.md +7 -0
- package/dist/assets/properties-panel.css +780 -0
- package/dist/camunda-cloud-modeler.development.js +546 -505
- package/dist/camunda-cloud-modeler.production.min.js +3 -3
- package/dist/camunda-platform-modeler.development.js +178 -270
- package/dist/camunda-platform-modeler.production.min.js +1 -1
- package/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +112 -0
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeBoundaryEventBehavior.js +51 -55
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +56 -59
- package/lib/camunda-cloud/features/modeling/behavior/FormDefinitionBehavior.js +69 -127
- package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +76 -128
- package/lib/camunda-cloud/features/modeling/behavior/index.js +3 -0
- package/lib/camunda-cloud/features/properties-provider/parts/implementation/InputOutput.js +21 -7
- package/lib/camunda-cloud/features/rules/BpmnRules.js +1 -1
- package/lib/camunda-cloud/helper/CalledElementHelper.js +43 -41
- package/lib/camunda-cloud/helper/FormsHelper.js +38 -50
- package/lib/camunda-cloud/helper/InputOutputHelper.js +92 -106
- package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js +24 -47
- package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +39 -81
- package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +31 -65
- package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +42 -76
- package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +21 -26
- package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +16 -10
- package/lib/camunda-platform/helper/InputOutputHelper.js +29 -0
- package/package.json +2 -2
|
@@ -1,132 +1,135 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getBusinessObject
|
|
2
|
+
getBusinessObject,
|
|
3
|
+
is
|
|
3
4
|
} from 'bpmn-js/lib/util/ModelUtil';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
isAny
|
|
7
|
-
} from 'bpmn-js/lib/features/modeling/util/ModelingUtil';
|
|
6
|
+
import { isAny } from 'bpmn-js/lib/features/modeling/util/ModelingUtil';
|
|
8
7
|
|
|
9
|
-
import
|
|
10
|
-
isZeebeServiceTask
|
|
11
|
-
} from './ZeebeServiceTaskHelper';
|
|
8
|
+
import elementHelper from 'bpmn-js-properties-panel/lib/helper/ElementHelper';
|
|
12
9
|
|
|
13
|
-
import
|
|
10
|
+
import { isZeebeServiceTask } from './ZeebeServiceTaskHelper';
|
|
14
11
|
|
|
15
|
-
import elementHelper from 'bpmn-js-properties-panel/lib/helper/ElementHelper';
|
|
16
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Get zeebe:IoMapping from an element.
|
|
15
|
+
*
|
|
16
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
17
|
+
*
|
|
18
|
+
* @return {ModdleElement}
|
|
19
|
+
*/
|
|
20
|
+
export function getIoMapping(element) {
|
|
21
|
+
const businessObject = getBusinessObject(element);
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
const elems = extensionElementsHelper.getExtensionElements(bo, type);
|
|
20
|
-
return !prop ? elems : (elems[0] || {})[prop] || [];
|
|
21
|
-
}
|
|
23
|
+
const extensionElements = businessObject.get('extensionElements');
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
25
|
+
if (!extensionElements) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* @param {djs.model.Base} element
|
|
32
|
-
*
|
|
33
|
-
* @return {ModdleElement} the inputOutput object
|
|
34
|
-
*/
|
|
35
|
-
export function getInputOutput(element) {
|
|
36
|
-
const bo = getBusinessObject(element);
|
|
37
|
-
return (getElements(bo, 'zeebe:IoMapping') || [])[0];
|
|
29
|
+
return extensionElements.get('values').find((value) => {
|
|
30
|
+
return is(value, 'zeebe:IoMapping');
|
|
31
|
+
});
|
|
38
32
|
}
|
|
39
33
|
|
|
40
|
-
|
|
41
34
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*/
|
|
35
|
+
* Get zeebe:InputParameters from an element.
|
|
36
|
+
*
|
|
37
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
38
|
+
*
|
|
39
|
+
* @return {Array<ModdleElement>}
|
|
40
|
+
*/
|
|
49
41
|
export function getInputParameters(element) {
|
|
50
|
-
|
|
42
|
+
const ioMapping = getIoMapping(element);
|
|
43
|
+
|
|
44
|
+
if (ioMapping) {
|
|
45
|
+
return ioMapping.get('zeebe:inputParameters');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return [];
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*/
|
|
52
|
+
* Get zeebe:OutputParameters from an element.
|
|
53
|
+
*
|
|
54
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
55
|
+
*
|
|
56
|
+
* @return {Array<ModdleElement>}
|
|
57
|
+
*/
|
|
61
58
|
export function getOutputParameters(element) {
|
|
62
|
-
|
|
59
|
+
const ioMapping = getIoMapping(element);
|
|
60
|
+
|
|
61
|
+
if (ioMapping) {
|
|
62
|
+
return ioMapping.get('zeebe:outputParameters');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return [];
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
export function getInputParameter(element,
|
|
74
|
-
return getInputParameters(element)[
|
|
69
|
+
* Get zeebe:Input at index.
|
|
70
|
+
*
|
|
71
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
72
|
+
* @param {number} index
|
|
73
|
+
*
|
|
74
|
+
* @return {ModdleElement}
|
|
75
|
+
*/
|
|
76
|
+
export function getInputParameter(element, index) {
|
|
77
|
+
return getInputParameters(element)[ index ];
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
export function getOutputParameter(element,
|
|
86
|
-
return getOutputParameters(element)[
|
|
81
|
+
* Get zeebe:Output at index.
|
|
82
|
+
*
|
|
83
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
84
|
+
* @param {number} index
|
|
85
|
+
*
|
|
86
|
+
* @return {ModdleElement}
|
|
87
|
+
*/
|
|
88
|
+
export function getOutputParameter(element, index) {
|
|
89
|
+
return getOutputParameters(element)[ index ];
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
* Check whether element supports zeebe:Input or zeebe:Output.
|
|
94
|
+
*
|
|
95
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
96
|
+
*
|
|
97
|
+
* @return {boolean}
|
|
98
|
+
*/
|
|
96
99
|
export function isInputOutputSupported(element) {
|
|
97
|
-
return
|
|
100
|
+
return areInputParametersSupported(element) || areOutputParametersSupported(element);
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
/**
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
* Check whether element supports zeebe:Input.
|
|
105
|
+
*
|
|
106
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
107
|
+
*
|
|
108
|
+
* @return {boolean}
|
|
109
|
+
*/
|
|
107
110
|
export function areInputParametersSupported(element) {
|
|
108
111
|
return isAny(element, [
|
|
109
|
-
'bpmn:
|
|
112
|
+
'bpmn:CallActivity',
|
|
110
113
|
'bpmn:SubProcess',
|
|
111
|
-
'bpmn:
|
|
114
|
+
'bpmn:UserTask'
|
|
112
115
|
]) || isZeebeServiceTask(element);
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
* Check whether element supports zeebe:Output.
|
|
120
|
+
*
|
|
121
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
122
|
+
*
|
|
123
|
+
* @return {boolean}
|
|
124
|
+
*/
|
|
122
125
|
export function areOutputParametersSupported(element) {
|
|
123
126
|
return isAny(element, [
|
|
124
|
-
'zeebe:ZeebeServiceTask',
|
|
125
|
-
'bpmn:UserTask',
|
|
126
|
-
'bpmn:SubProcess',
|
|
127
|
-
'bpmn:ReceiveTask',
|
|
128
127
|
'bpmn:CallActivity',
|
|
129
|
-
'bpmn:Event'
|
|
128
|
+
'bpmn:Event',
|
|
129
|
+
'bpmn:ReceiveTask',
|
|
130
|
+
'bpmn:SubProcess',
|
|
131
|
+
'bpmn:UserTask',
|
|
132
|
+
'zeebe:ZeebeServiceTask'
|
|
130
133
|
]);
|
|
131
134
|
}
|
|
132
135
|
|
|
@@ -134,23 +137,6 @@ export function createElement(type, parent, factory, properties) {
|
|
|
134
137
|
return elementHelper.createElement(type, properties, parent, factory);
|
|
135
138
|
}
|
|
136
139
|
|
|
137
|
-
export function
|
|
140
|
+
export function createIoMapping(parent, bpmnFactory, properties) {
|
|
138
141
|
return createElement('zeebe:IoMapping', parent, bpmnFactory, properties);
|
|
139
142
|
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Get getter function for IOMapping parameters according to provided property name
|
|
143
|
-
*
|
|
144
|
-
* @param {string} property
|
|
145
|
-
*
|
|
146
|
-
* @returns {Function} Getter function for the IOMapping parameters according to provided property name
|
|
147
|
-
*/
|
|
148
|
-
export function determineParamGetFunc(property) {
|
|
149
|
-
if (property == 'inputParameters') {
|
|
150
|
-
return getInputParameters;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (property == 'outputParameters') {
|
|
154
|
-
return getOutputParameters;
|
|
155
|
-
}
|
|
156
|
-
}
|
package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import inherits from 'inherits';
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
getBusinessObject,
|
|
5
3
|
is
|
|
@@ -11,18 +9,19 @@ const HIGH_PRIORITY = 5000;
|
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
|
-
* Camunda BPMN specific
|
|
15
|
-
*
|
|
16
|
-
* When `camunda:type` is set to something different than `external`
|
|
17
|
-
* on an element, then `camunda:errorEventDefinition` extension elements
|
|
18
|
-
* shall be removed.
|
|
12
|
+
* Camunda BPMN specific camunda:ErrorEventDefinition behavior.
|
|
19
13
|
*/
|
|
20
|
-
export default
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
export default class DeleteErrorEventDefinitionBehavior extends CommandInterceptor {
|
|
15
|
+
constructor(eventBus, modeling) {
|
|
16
|
+
super(eventBus);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Remove camunda:ErrorEventDefinitions on camunda:type set to external.
|
|
20
|
+
*/
|
|
21
|
+
this.postExecute([
|
|
22
|
+
'element.updateProperties',
|
|
23
|
+
'properties-panel.update-businessobject'
|
|
24
|
+
], HIGH_PRIORITY, function(context) {
|
|
26
25
|
const {
|
|
27
26
|
element,
|
|
28
27
|
oldProperties,
|
|
@@ -30,52 +29,30 @@ export default function DeleteErrorEventDefinitionBehavior(eventBus) {
|
|
|
30
29
|
} = context;
|
|
31
30
|
|
|
32
31
|
const businessObject = getBusinessObject(element),
|
|
33
|
-
extensionElements = businessObject.extensionElements;
|
|
32
|
+
extensionElements = businessObject.get('extensionElements');
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
extensionElements &&
|
|
39
|
-
externalTypeChanged(oldProperties, properties)
|
|
40
|
-
) {
|
|
34
|
+
if (is(element, 'camunda:ExternalCapable')
|
|
35
|
+
&& extensionElements
|
|
36
|
+
&& externalTypeChanged(oldProperties, properties)) {
|
|
41
37
|
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const values = extensionElements.get('values').filter((element) => {
|
|
39
|
+
return !is(element, 'camunda:ErrorEventDefinition');
|
|
40
|
+
});
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
element => !is(element, 'camunda:ErrorEventDefinition')
|
|
47
|
-
);
|
|
42
|
+
modeling.updateModdleProperties(element, extensionElements, { values });
|
|
48
43
|
}
|
|
49
|
-
|
|
50
44
|
}, true);
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
HIGH_PRIORITY, function({ context }) {
|
|
54
|
-
const {
|
|
55
|
-
element,
|
|
56
|
-
deletedErrorEventDefinitions: oldExtensionElements
|
|
57
|
-
} = context;
|
|
58
|
-
|
|
59
|
-
const businessObject = getBusinessObject(element);
|
|
60
|
-
|
|
61
|
-
// Only intercept the revert, if the behavior became active
|
|
62
|
-
if (oldExtensionElements) {
|
|
63
|
-
const extensionElements = businessObject.extensionElements;
|
|
64
|
-
|
|
65
|
-
extensionElements.values = oldExtensionElements;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
46
|
+
}
|
|
68
47
|
}
|
|
69
48
|
|
|
70
|
-
|
|
71
49
|
DeleteErrorEventDefinitionBehavior.$inject = [
|
|
72
|
-
'eventBus'
|
|
50
|
+
'eventBus',
|
|
51
|
+
'modeling'
|
|
73
52
|
];
|
|
74
53
|
|
|
75
|
-
inherits(DeleteErrorEventDefinitionBehavior, CommandInterceptor);
|
|
76
|
-
|
|
77
54
|
|
|
78
|
-
//
|
|
55
|
+
// helpers //////////
|
|
79
56
|
|
|
80
57
|
function externalTypeChanged(oldProperties, updatesProperties) {
|
|
81
58
|
const {
|
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
import inherits from 'inherits';
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
getBusinessObject,
|
|
5
3
|
is
|
|
6
4
|
} from 'bpmn-js/lib/util/ModelUtil';
|
|
7
5
|
|
|
8
|
-
import {
|
|
9
|
-
find
|
|
10
|
-
} from 'min-dash';
|
|
11
|
-
|
|
12
6
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
13
7
|
|
|
14
|
-
const HIGH_PRIORITY =
|
|
8
|
+
const HIGH_PRIORITY = 5000;
|
|
15
9
|
|
|
16
10
|
|
|
17
11
|
/**
|
|
18
|
-
* Camunda BPMN specific
|
|
19
|
-
*
|
|
20
|
-
* When `camunda:asyncAfter` or `camunda:asyncBefore` are set to false
|
|
21
|
-
* on an element, then `camunda:FailedJobRetryTimeCycle` shall be removed. This ensures
|
|
22
|
-
* that the BPMN diagram XML reflects the behavior of Camunda Platform engine.
|
|
12
|
+
* Camunda BPMN specific camunda:FailedJobRetryTimeCycle behavior.
|
|
23
13
|
*/
|
|
24
|
-
export default
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
export default class DeleteRetryTimeCycleBehavior extends CommandInterceptor {
|
|
15
|
+
constructor(eventBus, modeling) {
|
|
16
|
+
super(eventBus);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Remove camunda:FailedJobRetryTimeCycle if camunda:asyncAfter or camunda:asyncBefore is set to false.
|
|
20
|
+
*/
|
|
21
|
+
this.postExecute([
|
|
22
|
+
'element.updateProperties',
|
|
23
|
+
'properties-panel.update-businessobject'
|
|
24
|
+
], HIGH_PRIORITY, function(context) {
|
|
30
25
|
const {
|
|
31
26
|
element,
|
|
32
27
|
properties
|
|
@@ -35,92 +30,55 @@ export default function DeleteRetryTimeCycleBehavior(eventBus) {
|
|
|
35
30
|
const businessObject = getBusinessObject(element),
|
|
36
31
|
extensionElements = businessObject.extensionElements;
|
|
37
32
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
properties &&
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
if (
|
|
34
|
+
!is(element, 'camunda:AsyncCapable')
|
|
35
|
+
|| (properties[ 'camunda:asyncBefore' ] !== false && properties[ 'camunda:asyncAfter' ] !== false)
|
|
36
|
+
|| !extensionElements
|
|
37
|
+
|| !extensionElements.get('values').length
|
|
38
|
+
|| !extensionElements.get('values').find((value) => is(value, 'camunda:FailedJobRetryTimeCycle'))
|
|
39
|
+
|| getTimerEventDefinition(element)
|
|
40
|
+
|| isAsyncBefore(businessObject)
|
|
41
|
+
|| isAsyncAfter(businessObject)
|
|
46
42
|
) {
|
|
47
|
-
|
|
48
|
-
// (1.2) ... but don't execute if one async is still true
|
|
49
|
-
if (isAsyncBefore(businessObject) || isAsyncAfter(businessObject)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// (2) Delete the camunda:FailedJobRetryTimeCycle and save them for revert
|
|
54
|
-
context.deleteRetryCycleOldExtElements = extensionElements.values;
|
|
55
|
-
|
|
56
|
-
extensionElements.values = extensionElements.values.filter(
|
|
57
|
-
ele => !is(ele, 'camunda:FailedJobRetryTimeCycle'));
|
|
43
|
+
return;
|
|
58
44
|
}
|
|
59
45
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
HIGH_PRIORITY, function({ context }) {
|
|
64
|
-
const {
|
|
65
|
-
element,
|
|
66
|
-
deleteRetryCycleOldExtElements: oldExtensionElements
|
|
67
|
-
} = context;
|
|
68
|
-
|
|
69
|
-
const businessObject = getBusinessObject(element);
|
|
46
|
+
const values = extensionElements.get('values').filter((element) => {
|
|
47
|
+
return !is(element, 'camunda:FailedJobRetryTimeCycle');
|
|
48
|
+
});
|
|
70
49
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const extensionElements = businessObject.extensionElements;
|
|
50
|
+
modeling.updateModdleProperties(element, extensionElements, { values });
|
|
51
|
+
}, true);
|
|
74
52
|
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
});
|
|
53
|
+
}
|
|
78
54
|
}
|
|
79
55
|
|
|
80
|
-
|
|
81
56
|
DeleteRetryTimeCycleBehavior.$inject = [
|
|
82
|
-
'eventBus'
|
|
57
|
+
'eventBus',
|
|
58
|
+
'modeling'
|
|
83
59
|
];
|
|
84
60
|
|
|
85
|
-
inherits(DeleteRetryTimeCycleBehavior, CommandInterceptor);
|
|
86
61
|
|
|
62
|
+
// helpers //////////
|
|
87
63
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Returns true if the attribute 'camunda:asyncBefore' is set
|
|
92
|
-
* to true.
|
|
93
|
-
*
|
|
94
|
-
* @param {ModdleElement} bo
|
|
95
|
-
*
|
|
96
|
-
* @return {boolean} a boolean value
|
|
97
|
-
*/
|
|
98
|
-
function isAsyncBefore(bo) {
|
|
99
|
-
return !!(bo.get('camunda:asyncBefore') || bo.get('camunda:async'));
|
|
64
|
+
function isAsyncBefore(businessObject) {
|
|
65
|
+
return !!(businessObject.get('camunda:asyncBefore') || businessObject.get('camunda:async'));
|
|
100
66
|
}
|
|
101
67
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
* to true.
|
|
105
|
-
*
|
|
106
|
-
* @param {ModdleElement} bo
|
|
107
|
-
*
|
|
108
|
-
* @return {boolean} a boolean value
|
|
109
|
-
*/
|
|
110
|
-
function isAsyncAfter(bo) {
|
|
111
|
-
return !!bo.get('camunda:asyncAfter');
|
|
68
|
+
function isAsyncAfter(businessObject) {
|
|
69
|
+
return !!businessObject.get('camunda:asyncAfter');
|
|
112
70
|
}
|
|
113
71
|
|
|
114
72
|
function getTimerEventDefinition(element) {
|
|
115
73
|
return getEventDefinition(element, 'bpmn:TimerEventDefinition');
|
|
116
74
|
}
|
|
117
75
|
|
|
118
|
-
function getEventDefinition(element,
|
|
76
|
+
function getEventDefinition(element, type) {
|
|
119
77
|
const businessObject = getBusinessObject(element);
|
|
120
78
|
|
|
121
79
|
const eventDefinitions = businessObject.get('eventDefinitions') || [];
|
|
122
80
|
|
|
123
|
-
return find(
|
|
124
|
-
return is(
|
|
81
|
+
return eventDefinitions.find((eventDefinition) => {
|
|
82
|
+
return is(eventDefinition, type);
|
|
125
83
|
});
|
|
126
84
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import inherits from 'inherits';
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
getBusinessObject,
|
|
5
3
|
is
|
|
@@ -7,22 +5,23 @@ import {
|
|
|
7
5
|
|
|
8
6
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
9
7
|
|
|
10
|
-
const HIGH_PRIORITY =
|
|
8
|
+
const HIGH_PRIORITY = 5000;
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
|
-
* Camunda BPMN specific
|
|
15
|
-
*
|
|
16
|
-
* When `camunda:asyncAfter` or `camunda:asyncBefore` are set to false
|
|
17
|
-
* on an element, then `camunda:exclusive` shall be set to true. This ensures
|
|
18
|
-
* that the BPMN diagram XML reflects the behavior of Camunda Platform engine.
|
|
12
|
+
* Camunda BPMN specific camunda:exclusive behavior.
|
|
19
13
|
*/
|
|
20
|
-
export default
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
export default class UpdateCamundaExclusiveBehavior extends CommandInterceptor {
|
|
15
|
+
constructor(eventBus) {
|
|
16
|
+
super(eventBus);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Set camunda:exclusive to true on camunda:asyncBefore or camunda:asyncAfter set to false.
|
|
20
|
+
*/
|
|
21
|
+
this.preExecute([
|
|
22
|
+
'element.updateProperties',
|
|
23
|
+
'properties-panel.update-businessobject'
|
|
24
|
+
], HIGH_PRIORITY, function(context) {
|
|
26
25
|
const {
|
|
27
26
|
element,
|
|
28
27
|
properties
|
|
@@ -30,70 +29,37 @@ export default function UpdateCamundaExclusiveBehavior(eventBus) {
|
|
|
30
29
|
|
|
31
30
|
const businessObject = getBusinessObject(element);
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
if (!is(element, 'camunda:AsyncCapable')
|
|
33
|
+
|| (properties[ 'camunda:asyncBefore' ] !== false && properties[ 'camunda:asyncAfter' ] !== false)
|
|
34
|
+
|| isExclusive(businessObject)
|
|
35
|
+
|| (isAsyncAfter(businessObject) && properties[ 'camunda:asyncAfter' ] !== false)
|
|
36
|
+
|| (isAsyncBefore(businessObject) && properties[ 'camunda:asyncBefore' ] !== false)
|
|
37
|
+
|| (properties[ 'camunda:asyncBefore' ] === true || properties[ 'camunda:asyncAfter' ] === true)
|
|
39
38
|
) {
|
|
40
|
-
|
|
41
|
-
// (1.2) ...but don't execute if...
|
|
42
|
-
if ((isAsyncAfter(businessObject) && properties['camunda:asyncAfter'] !== false) || // ...asyncAfter will stay
|
|
43
|
-
(isAsyncBefore(businessObject) && properties['camunda:asyncBefore'] !== false) || // ...asyncBefore will stay
|
|
44
|
-
(properties['camunda:asyncBefore'] || properties['camunda:asyncAfter']) // one is set to true
|
|
45
|
-
) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// (2) Update the context
|
|
50
|
-
properties['camunda:exclusive'] = true;
|
|
39
|
+
return;
|
|
51
40
|
}
|
|
41
|
+
|
|
42
|
+
properties[ 'camunda:exclusive' ] = true;
|
|
52
43
|
}, true);
|
|
53
|
-
}
|
|
54
44
|
|
|
45
|
+
}
|
|
46
|
+
}
|
|
55
47
|
|
|
56
48
|
UpdateCamundaExclusiveBehavior.$inject = [
|
|
57
49
|
'eventBus'
|
|
58
50
|
];
|
|
59
51
|
|
|
60
|
-
inherits(UpdateCamundaExclusiveBehavior, CommandInterceptor);
|
|
61
|
-
|
|
62
52
|
|
|
63
|
-
//
|
|
53
|
+
// helpers //////////
|
|
64
54
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
* to true.
|
|
68
|
-
*
|
|
69
|
-
* @param {ModdleElement} bo
|
|
70
|
-
*
|
|
71
|
-
* @return {boolean} a boolean value
|
|
72
|
-
*/
|
|
73
|
-
function isAsyncBefore(bo) {
|
|
74
|
-
return !!(bo.get('camunda:asyncBefore') || bo.get('camunda:async'));
|
|
55
|
+
function isAsyncBefore(businessObject) {
|
|
56
|
+
return !!(businessObject.get('camunda:asyncBefore') || businessObject.get('camunda:async'));
|
|
75
57
|
}
|
|
76
58
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* to true.
|
|
80
|
-
*
|
|
81
|
-
* @param {ModdleElement} bo
|
|
82
|
-
*
|
|
83
|
-
* @return {boolean} a boolean value
|
|
84
|
-
*/
|
|
85
|
-
function isAsyncAfter(bo) {
|
|
86
|
-
return !!bo.get('camunda:asyncAfter');
|
|
59
|
+
function isAsyncAfter(businessObject) {
|
|
60
|
+
return !!businessObject.get('camunda:asyncAfter');
|
|
87
61
|
}
|
|
88
62
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
* to true.
|
|
92
|
-
*
|
|
93
|
-
* @param {ModdleElement} bo
|
|
94
|
-
*
|
|
95
|
-
* @return {boolean} a boolean value
|
|
96
|
-
*/
|
|
97
|
-
function isExclusive(bo) {
|
|
98
|
-
return !!bo.get('camunda:exclusive');
|
|
63
|
+
function isExclusive(businessObject) {
|
|
64
|
+
return !!businessObject.get('camunda:exclusive');
|
|
99
65
|
}
|