Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
New outputBehavior attribute on ioMapping added
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Horn authored and Dominik Horn committed Jun 13, 2018
1 parent 848d1b5 commit aca8e3f
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 1 deletion.
75 changes: 74 additions & 1 deletion client/lib/custom/propertyprovider/parts/InputOutputProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,80 @@

var inputOutput = require('./implementation/InputOutput');

module.exports = function(group, element, bpmnFactory) {
var elementHelper = require('bpmn-js-properties-panel/lib/helper/ElementHelper'),
cmdHelper = require('bpmn-js-properties-panel/lib/helper/CmdHelper'),
inputOutputHelper = require('../helper/InputOutputHelper');

var entryFactory = require('bpmn-js-properties-panel/lib/factory/EntryFactory');

var extensionElementsHelper = require('bpmn-js-properties-panel/lib/helper/ExtensionElementsHelper');
var getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject;

module.exports = function (group, element, bpmnFactory) {


function getIoMapping(element) {
var bo = getBusinessObject(element);
return (getElements(bo, 'zeebe:IoMapping') || [])[0];
}

function getElements(bo, type, prop) {
var elems = extensionElementsHelper.getExtensionElements(bo, type) || [];
return !prop ? elems : (elems[0] || {})[prop] || [];
}

function ensureInputOutputSupported(element) {
return inputOutputHelper.isInputOutputSupported(element);
}

if (ensureInputOutputSupported(element)) {


group.entries.push(entryFactory.selectBox({
id: 'io-mapping-outputBehavior',
label: 'Output Behavior',
selectOptions: [
{ name: 'MERGE', value: 'merge' },
{ name: 'OVERWRITE', value: 'overwrite' },
{ name: 'NONE', value: 'none' }
],
modelProperty: 'outputBehavior',
emptyParameter: true,

get: function (element, node) {
return (getIoMapping(element, node) || {});
},

set: function (element, values, node) {
var bo = getBusinessObject(element);
var commands = [];

//CREATE extensionElemente
var extensionElements = bo.get('extensionElements');
if (!extensionElements) {
extensionElements = elementHelper.createElement('bpmn:ExtensionElements', { values: [] }, bo, bpmnFactory);
commands.push(cmdHelper.updateProperties(element, { extensionElements: extensionElements }));
}
//create taskDefinition
var ioMapping = getIoMapping(element);

if (!ioMapping) {
ioMapping = elementHelper.createElement('zeebe:IoMapping', {}, extensionElements, bpmnFactory);
commands.push(cmdHelper.addAndRemoveElementsFromList(
element,
extensionElements,
'values',
'extensionElements',
[ioMapping],
[]
));
}

commands.push(cmdHelper.updateBusinessObject(element, ioMapping, values));
return commands;
}
}));
}

var inputOutputEntry = inputOutput(element, bpmnFactory);
group.entries = group.entries.concat(inputOutputEntry.entries);
Expand Down
5 changes: 5 additions & 0 deletions client/lib/custom/zeebe-bpmn-moddle/zeebe.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
"name": "ioMapping",
"type": "IoMapping"
},
{
"name": "outputBehavior",
"type": "String",
"isAttr": true
},
{
"name": "connectorId",
"type": "String"
Expand Down

0 comments on commit aca8e3f

Please sign in to comment.