shikeying
2023-03-17 8c1a723d62a6aa5d6266ca613ae4eb77c789db06
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
'use strict';
 
var forEach = require('lodash/forEach');
 
/**
 * A handler that combines and executes multiple commands.
 *
 * All updates are bundled on the command stack and executed in one step.
 * This also makes it possible to revert the changes in one step.
 *
 * Example use case: remove the camunda:formKey attribute and in addition
 * add all form fields needed for the camunda:formData property.
 *
 * @class
 * @constructor
 */
function MultiCommandHandler(commandStack) {
  this._commandStack = commandStack;
}
 
MultiCommandHandler.$inject = [ 'commandStack' ];
 
module.exports = MultiCommandHandler;
 
MultiCommandHandler.prototype.preExecute = function(context) {
 
  var commandStack = this._commandStack;
 
  forEach(context, function(command) {
    commandStack.execute(command.cmd, command.context);
  });
};