ExternalTaskConfigurationProps.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. var is = require('bpmn-js/lib/util/ModelUtil').is,
  3. getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject;
  4. var ImplementationTypeHelper = require('../../../helper/ImplementationTypeHelper');
  5. var externalTaskPriority = require('./implementation/ExternalTaskPriority');
  6. function getServiceTaskLikeBusinessObject(element) {
  7. var bo = ImplementationTypeHelper.getServiceTaskLikeBusinessObject(element);
  8. // if the element is not a serviceTaskLike element, fetch the normal business object
  9. // This avoids the loss of the process / participant business object
  10. if (!bo) {
  11. bo = getBusinessObject(element);
  12. }
  13. return bo;
  14. }
  15. module.exports = function(group, element, bpmnFactory, translate) {
  16. var bo = getServiceTaskLikeBusinessObject(element);
  17. if (!bo) {
  18. return;
  19. }
  20. if (is(bo, 'activiti:TaskPriorized') || (is(bo, 'bpmn:Participant')) && bo.get('processRef')) {
  21. group.entries = group.entries.concat(externalTaskPriority(element, bpmnFactory, {
  22. getBusinessObject: function(element) {
  23. if (!is(bo, 'bpmn:Participant')) {
  24. return bo;
  25. }
  26. return bo.get('processRef');
  27. }
  28. }, translate));
  29. }
  30. };