# all files / bpmn-js/lib/features/modeling/cmd/ UpdateSemanticParentHandler.js

100% Statements 16/16
100% Branches 0/0
100% Functions 3/3
100% Lines 16/16

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    1189×

    1×

    1×
    19×
    19×
    19×

    19×
    19×

    19×

    19×

    1×
    8×
    8×
    8×

    8×

    8×

     export default function UpdateSemanticParentHandler(bpmnUpdater) {
      this._bpmnUpdater = bpmnUpdater;
    }

    UpdateSemanticParentHandler.$inject = [ 'bpmnUpdater' ];

    UpdateSemanticParentHandler.prototype.execute = function(context) {
      var dataStoreBo = context.dataStoreBo,
          newSemanticParent = context.newSemanticParent,
          newDiParent = context.newDiParent;

      context.oldSemanticParent = dataStoreBo.$parent;
      context.oldDiParent = dataStoreBo.di.$parent;

      // update semantic parent
      this._bpmnUpdater.updateSemanticParent(dataStoreBo, newSemanticParent);

      // update DI parent
      this._bpmnUpdater.updateDiParent(dataStoreBo.di, newDiParent);
    };

    UpdateSemanticParentHandler.prototype.revert = function(context) {
      var dataStoreBo = context.dataStoreBo,
          oldSemanticParent = context.oldSemanticParent,
          oldDiParent = context.oldDiParent;

      // update semantic parent
      this._bpmnUpdater.updateSemanticParent(dataStoreBo, oldSemanticParent);

      // update DI parent
      this._bpmnUpdater.updateDiParent(dataStoreBo.di, oldDiParent);
    };