parent
9cd5f58ee4
commit
283ddae6d3
|
@ -71,7 +71,7 @@ UpdatePropertiesHandler.prototype.execute = function(context) {
|
||||||
properties = context.properties,
|
properties = context.properties,
|
||||||
oldProperties = context.oldProperties || getProperties(businessObject, keys(properties));
|
oldProperties = context.oldProperties || getProperties(businessObject, keys(properties));
|
||||||
|
|
||||||
if (ID in properties) {
|
if (isIdChange(properties, businessObject)) {
|
||||||
ids.unclaim(businessObject[ID]);
|
ids.unclaim(businessObject[ID]);
|
||||||
|
|
||||||
elementRegistry.updateId(element, properties[ID]);
|
elementRegistry.updateId(element, properties[ID]);
|
||||||
|
@ -126,7 +126,7 @@ UpdatePropertiesHandler.prototype.revert = function(context) {
|
||||||
// update properties
|
// update properties
|
||||||
setProperties(businessObject, oldProperties);
|
setProperties(businessObject, oldProperties);
|
||||||
|
|
||||||
if (ID in properties) {
|
if (isIdChange(properties, businessObject)) {
|
||||||
ids.unclaim(properties[ID]);
|
ids.unclaim(properties[ID]);
|
||||||
|
|
||||||
elementRegistry.updateId(element, oldProperties[ID]);
|
elementRegistry.updateId(element, oldProperties[ID]);
|
||||||
|
@ -134,3 +134,8 @@ UpdatePropertiesHandler.prototype.revert = function(context) {
|
||||||
|
|
||||||
return context.changed;
|
return context.changed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function isIdChange(properties, businessObject) {
|
||||||
|
return ID in properties && properties[ID] !== businessObject[ID];
|
||||||
|
}
|
|
@ -334,4 +334,24 @@ describe('features/modeling - update properties', function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('error handling', function() {
|
||||||
|
|
||||||
|
it('should ignore unchanged id', inject(function(elementRegistry, modeling) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
||||||
|
var ids = flowConnection.businessObject.$model.ids;
|
||||||
|
|
||||||
|
// when
|
||||||
|
modeling.updateProperties(flowConnection, { id: 'SequenceFlow_1' });
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(ids.assigned('SequenceFlow_1')).to.exist;
|
||||||
|
|
||||||
|
expect(flowConnection.businessObject.id).to.equal('SequenceFlow_1');
|
||||||
|
}));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue