How to use the bpmn-js/lib/util/ModelUtil.getBusinessObject function in bpmn-js

To help you get started, we’ve selected a few bpmn-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bpmn-io / bpmn-js-properties-panel / test / spec / provider / bpmn / DocumentationSpec.js View on Github external
it('should remove the documentation for an element', inject(function(propertiesPanel, selection, elementRegistry) {

    var shape = elementRegistry.get('ServiceTask_1');
    selection.select(shape);
    var textField = domQuery('div[name=documentation]', propertiesPanel._container);
    var businessObject = getBusinessObject(shape);

    // given
    expect(textField.textContent).to.equal('Task');

    // when
    TestHelper.triggerValue(textField, '', 'change');

    // then
    expect(textField.textContent).to.equal('');
    expect(businessObject.get('documentation').length).to.equal(0);
  }));
});
github bpmn-io / bpmn-js-properties-panel / test / spec / provider / bpmn / ProcessParticipantSpec.js View on Github external
it('should get the id of the participant', inject(function(propertiesPanel, selection, elementRegistry) {

    // given
    var shape = elementRegistry.get('_Participant_2');
    var participant = getBusinessObject(shape);

    // when
    selection.select(shape);


    // then
    var input = domQuery('div[data-entry=id] input[name=id]', propertiesPanel._container);
    expect(input.value).to.equal(participant.get('id'));
  }));
github bpmn-io / bpmn-js-properties-panel / test / spec / provider / camunda / AsynchronousContinuationsSpec.js View on Github external
it('should migrate camunda:async to asyncBefore when asyncBefore is toggled', inject(function(propertiesPanel, selection, elementRegistry) {

    // given
    var shape = elementRegistry.get('ServiceTask');

    selection.select(shape);

    var asyncBeforeField = getAsyncBefore(propertiesPanel._container);

    // when
    TestHelper.triggerEvent(asyncBeforeField, 'click');

    // then
    var bo = getBusinessObject(shape);

    expect(bo.get('camunda:async')).to.be.not.ok;
  }));
github bpmn-io / bpmn-js-properties-panel / test / spec / provider / bpmn / ProcessParticipantExpandedSpec.js View on Github external
it('should get the id of the participant', inject(function(propertiesPanel, selection, elementRegistry) {

    // given
    var shape = elementRegistry.get('_Participant_2');
    var participant = getBusinessObject(shape);

    // when
    selection.select(shape);


    // then
    var input = domQuery('div[data-entry=id] input[name=id]', propertiesPanel._container);
    expect(input.value).to.equal(participant.get('id'));
  }));
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / __tests__ / HeadersSpec.js View on Github external
beforeEach(inject(function(elementRegistry, selection) {

      const shape = elementRegistry.get('Task_1');
      selection.select(shape);

      bo = getBusinessObject(shape);

      // assume
      expect(getTaskHeaders(bo)).to.be.undefined;

      // when
      clickAddHeaderButton(container);

    }));
github bpmn-io / bpmn-js-example-custom-elements / app / app.js View on Github external
bpmnModeler.on('element.contextmenu', HIGH_PRIORITY, (event) => {
    event.originalEvent.preventDefault();
    event.originalEvent.stopPropagation();

    qualityAssuranceEl.classList.remove('hidden');

    ({ element } = event);
  
    // ignore root element
    if (!element.parent) {
      return;
    }

    businessObject = getBusinessObject(element);
  
    let { suitable } = businessObject;
    
    suitabilityScoreEl.value = suitable ? suitable : '';

    suitabilityScoreEl.focus();

    analysisDetails = getExtensionElement(businessObject, 'qa:AnalysisDetails');

    lastCheckedEl.textContent = analysisDetails ? analysisDetails.lastChecked : '-';

    validate();
  });
github bpmn-io / bpmn-js-properties-panel / test / spec / provider / camunda / ScriptPropertiesSpec.js View on Github external
it('should fetch the inline script properties of an execution listener', inject(function(propertiesPanel, selection, elementRegistry) {

    var shape = elementRegistry.get('StartEvent_1');
    selection.select(shape);

    var eventType = domQuery('div[data-entry=listener-event-type] select[name=eventType]', propertiesPanel._container),
        listenerType = domQuery('div[data-entry=listener-type] select[name=listenerType]', propertiesPanel._container),
        scriptFormat = domQuery('div[data-entry=listener-script-value] input[name=scriptFormat]', propertiesPanel._container),
        scriptType = domQuery('div[data-entry=listener-script-value] select[name="scriptType"]', propertiesPanel._container),
        scriptValue = domQuery('div[data-entry=listener-script-value] textarea[name="scriptValue"]', propertiesPanel._container),
        businessObject = getBusinessObject(shape).extensionElements.values;

    selectListener(propertiesPanel._container, 0, 'executionListeners');

    expect(eventType.value).to.equal('start');
    expect(listenerType.value).to.equal('script');
    expect(scriptFormat.value).to.equal('groovy');
    expect(scriptType.value).to.equal('script');
    expect(scriptValue.value).to.equal('${sourceCode}');

    expect(businessObject.length).to.equal(1);
    expect(businessObject[0].get('event')).to.equal(eventType.value);
    expect(businessObject[0].script.get('scriptFormat')).to.equal(scriptFormat.value);
    expect(businessObject[0].script.value).to.equal(scriptValue.value);

  }));
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / parts / TaskDefinitionProps.js View on Github external
function getTaskDefinition(element) {
    const bo = getBusinessObject(element);
    return (getElements(bo, 'zeebe:TaskDefinition') || [])[0];
  }
github camunda-consulting / code / snippets / bpmnjs-custom-modeler / app / custom-modeler / custom / propertyprovider / SoftwareSettings.js View on Github external
function findExtension(element, type) {
  var bo = getBusinessObject(element);

  var extensionElements;

  if (is(bo, 'bpmn:ExtensionElements')) {
    extensionElements = bo;
  } else {
    extensionElements = bo.extensionElements;
  }

  if (!extensionElements) {
    return null;
  }

  return find(extensionElements.get('values'), function(e) {
    return is(e, type);
  });
github bpmn-io / bpmn-js-properties-panel / lib / provider / camunda / parts / ConditionalProps.js View on Github external
module.exports = function(group, element, bpmnFactory, translate) {
  var bo = getBusinessObject(element);

  if (!bo) {
    return;
  }

  var conditionalEventDefinition = eventDefinitionHelper.getConditionalEventDefinition(element);

  if (!(is(element, 'bpmn:SequenceFlow') && isConditionalSource(element.source))
    && !conditionalEventDefinition) {
    return;
  }

  var script = scriptImplementation('language', 'body', true, translate);
  group.entries.push({
    id: 'condition',
    label: translate('Condition'),