UpdateSemanticParentHandler.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. export default function UpdateSemanticParentHandler(bpmnUpdater) {
  2. this._bpmnUpdater = bpmnUpdater;
  3. }
  4. UpdateSemanticParentHandler.$inject = [ 'bpmnUpdater' ];
  5. UpdateSemanticParentHandler.prototype.execute = function(context) {
  6. var dataStoreBo = context.dataStoreBo,
  7. newSemanticParent = context.newSemanticParent,
  8. newDiParent = context.newDiParent;
  9. context.oldSemanticParent = dataStoreBo.$parent;
  10. context.oldDiParent = dataStoreBo.di.$parent;
  11. // update semantic parent
  12. this._bpmnUpdater.updateSemanticParent(dataStoreBo, newSemanticParent);
  13. // update DI parent
  14. this._bpmnUpdater.updateDiParent(dataStoreBo.di, newDiParent);
  15. };
  16. UpdateSemanticParentHandler.prototype.revert = function(context) {
  17. var dataStoreBo = context.dataStoreBo,
  18. oldSemanticParent = context.oldSemanticParent,
  19. oldDiParent = context.oldDiParent;
  20. // update semantic parent
  21. this._bpmnUpdater.updateSemanticParent(dataStoreBo, oldSemanticParent);
  22. // update DI parent
  23. this._bpmnUpdater.updateDiParent(dataStoreBo.di, oldDiParent);
  24. };