mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-28 17:54:57 +00:00
bc53dc98db
Closes #421 Fixing incorrect test+implementation for ID property update
42 lines
718 B
JavaScript
42 lines
718 B
JavaScript
'use strict';
|
|
|
|
|
|
function IdClaimHandler(moddle) {
|
|
this._moddle = moddle;
|
|
}
|
|
|
|
IdClaimHandler.$inject = [ 'moddle' ];
|
|
|
|
module.exports = IdClaimHandler;
|
|
|
|
|
|
IdClaimHandler.prototype.execute = function(context) {
|
|
var ids = this._moddle.ids,
|
|
id = context.id,
|
|
element = context.element,
|
|
claiming = context.claiming;
|
|
|
|
if (claiming){
|
|
ids.claim(id, element);
|
|
} else {
|
|
ids.unclaim(id);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Command revert implementation.
|
|
*/
|
|
IdClaimHandler.prototype.revert = function(context) {
|
|
var ids = this._moddle.ids,
|
|
id = context.id,
|
|
element = context.element,
|
|
claiming = context.claiming;
|
|
|
|
if (claiming){
|
|
ids.unclaim(id);
|
|
} else {
|
|
ids.claim(id, element);
|
|
}
|
|
};
|
|
|