2 * Copyright © 2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 *http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 import cmdHelper from 'bpmn-js-properties-panel/lib/helper/CmdHelper';
18 import { createInputOutput, createElement } from './InputOutput';
19 import InputOutputHelper from './InputOutputHelper';
20 import { INPUT, OUTPUT } from './implementationConstants';
22 export default ({ element, bo, bpmnFactory, activityInputsOutputs }) => {
24 const existedInputOutput = InputOutputHelper.getInputOutput(element);
26 let newInputOutput = createInputOutput(element, bpmnFactory, {
31 const inputs = activityInputsOutputs.inputs.map(({ name, value }) =>
32 createElement(INPUT, newInputOutput, bpmnFactory, {
39 const outputs = activityInputsOutputs.outputs.map(({ name, value }) =>
40 createElement(OUTPUT, newInputOutput, bpmnFactory, {
47 newInputOutput.inputParameters = inputs;
48 newInputOutput.outputParameters = outputs;
50 const objectToRemove = existedInputOutput ? [existedInputOutput] : [];
51 const extensionElements =
52 bo.extensionElements ||
53 createElement('bpmn:ExtensionElements', bo, bpmnFactory, []);
55 if (!bo.extensionElements) {
57 cmdHelper.updateBusinessObject(element, bo, {
64 cmdHelper.addAndRemoveElementsFromList(