Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function(group, element, bpmnFactory, translate) {
var bo;
if (is(element, 'bpmn:SequenceFlow')) {
bo = getBusinessObject(element);
}
if (!bo) {
return;
}
if (!isConditionalSource(element.source)) {
return;
}
// group.entries.push({
// id: 'condition',
// label: translate('Condition'),
// html: '<div class="bpp-row">' +
// '<label for="cam-condition-type">'+translate('Condition Type')+'</label>' +</div>
ChoreoRules.prototype.canCreate = function(shape, target, source, position) {
if (is(target, 'bpmn:Choreography')) {
// elements can be created within a choreography
return true;
} else if (is(target, 'bpmn:SubChoreography') && target.collapsed) {
// elements can not be placed on collapsed sub-choreographies
return false;
}
return BpmnRules.prototype.canCreate.call(this, shape, target, source, position);
};
this.addRule('element.paste', function(context) {
var parent = context.parent,
element = context.element,
position = context.position,
source = context.source,
target = context.target;
// Check if is either participant or message from choreo
// Todo: more fine grained implementation based on target, e.g should't be possible to paste only band
if (is(parent, 'bpmn:ChoreographyActivity') || (is(parent, 'bpmn:Participant') && is(element, 'bpmn:Message'))) {
return true;
}
if (source || target) {
return self.canConnect(source, target);
}
// attach checks for boundary events? canCreate will allways fail for bpmn:Participant
return self.canAttach([ element ], parent, null, position) || self.canCreate(element, parent, null, position);
});
ChoreoLabelEditingProvider.prototype.getEditingBBox = function(element) {
const boundsAndStyle = LabelEditingProvider.prototype.getEditingBBox.call(this, element);
if (is(element, 'bpmn:ChoreographyActivity')) {
const elementBounds = this._canvas.getAbsoluteBBox(element);
const maxHeight = elementBounds.height - heightOfTopBands(element) - heightOfBottomBands(element);
let height = maxHeight;
if (
(element.businessObject.loopType !== 'None' || !element.businessObject.loopType) ||
is(element, 'bpmn:CallChoreography') ||
(is(element, 'bpmn:SubChoreography') && element.collapsed)) {
height -= 21; // leave space for the marker to be shown
}
if (is(element, 'bpmn:SubChoreography') && !element.collapsed) {
height = maxHeight < 20? maxHeight: 20; // Reduce height to one line
}
const activityBounds = {
x: elementBounds.x,
y: elementBounds.y + heightOfTopBands(element),
width: elementBounds.width,
height: height
};
boundsAndStyle.bounds = activityBounds;
}
return boundsAndStyle;
};
function getLabelAttr(semantic) {
if (is(semantic, 'domainStory:actorPerson') ||
is(semantic, 'domainStory:actorGroup') ||
is(semantic, 'domainStory:actorSystem') ||
is(semantic, 'domainStory:workObject') ||
is(semantic, 'domainStory:workObjectFolder') ||
is(semantic, 'domainStory:workObjectCall') ||
is(semantic, 'domainStory:workObjectEmail') ||
is(semantic, 'domainStory:workObjectBubble') ||
is(semantic, 'domainStory:activity') ||
is(semantic, 'domainStory:group') ||
is(semantic, 'domainStory:workObjectInfo')) {
return 'name';
}
if (is(semantic, 'domainStory:textAnnotation')) {
return 'text';
}
}
var getInputOutputParameterLabel = function(param, translate) {
if (is(param, 'camunda:InputParameter')) {
return translate('Input Parameter');
}
if (is(param, 'camunda:OutputParameter')) {
return translate('Output Parameter');
}
return '';
};
function isActivity(element) {
return is(element, 'bpmn:SubProcess') || is(element, 'bpmn:Task');
}
ChoreoUpdater.prototype.updateParent = function(element, oldParent) {
if (!is(element, 'bpmn:Participant') && !is(element, 'bpmn:Message')) {
BpmnUpdater.prototype.updateParent.call(this, element, oldParent);
}
};
flowElements.forEach(flowElement => {
if (is(flowElement, 'bpmn:SequenceFlow')) {
self._deferred.push(function() {
self.handleSequenceFlow(flowElement, parentShape);
});
} else if (is(flowElement, 'bpmn:BoundaryEvent')) {
self._deferred.unshift(function() {
self.handleBoundaryEvent(flowElement, parentShape);
});
} else if (is(flowElement, 'bpmn:FlowNode')) {
self.handleFlowNode(flowElement, parentShape);
} else {
throw new Error(
'unrecognized flowElement ' +
elementToString(flowElement) + ' in context ' +
(parentShape ? elementToString(parentShape.businessObject) : 'null')
);
}
});
}