parent
f177a462ea
commit
d55e3afe35
|
@ -84,17 +84,26 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
||||||
|
|
||||||
var references;
|
var references;
|
||||||
|
|
||||||
function resolveReferences(descriptor) {
|
function resolveReferences(descriptor, cache) {
|
||||||
var businessObject = getBusinessObject(descriptor);
|
var businessObject = getBusinessObject(descriptor);
|
||||||
|
|
||||||
// default sequence flows
|
// default sequence flows
|
||||||
if (descriptor.default) {
|
if (descriptor.default) {
|
||||||
|
|
||||||
|
// relationship cannot be resolved immediately
|
||||||
references[ descriptor.default ] = {
|
references[ descriptor.default ] = {
|
||||||
element: businessObject,
|
element: businessObject,
|
||||||
property: 'default'
|
property: 'default'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// boundary events
|
||||||
|
if (descriptor.host) {
|
||||||
|
|
||||||
|
// relationship can be resolved immediately
|
||||||
|
getBusinessObject(descriptor).attachedToRef = getBusinessObject(cache[ descriptor.host ]);
|
||||||
|
}
|
||||||
|
|
||||||
references = omit(references, reduce(references, function(array, reference, key) {
|
references = omit(references, reduce(references, function(array, reference, key) {
|
||||||
var element = reference.element,
|
var element = reference.element,
|
||||||
property = reference.property;
|
property = reference.property;
|
||||||
|
@ -134,7 +143,7 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// resolve references e.g. default sequence flow
|
// resolve references e.g. default sequence flow
|
||||||
resolveReferences(descriptor);
|
resolveReferences(descriptor, cache);
|
||||||
|
|
||||||
copyProperties(descriptor, newBusinessObject, [
|
copyProperties(descriptor, newBusinessObject, [
|
||||||
'isExpanded',
|
'isExpanded',
|
||||||
|
|
|
@ -167,6 +167,38 @@ describe('features/copy-paste', function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
it('should copy attacher properties', inject(function(canvas, copyPaste, elementRegistry) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var task = elementRegistry.get('Task_1'),
|
||||||
|
boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||||
|
rootElement = canvas.getRootElement();
|
||||||
|
|
||||||
|
// when
|
||||||
|
copyPaste.copy([ task, boundaryEvent ]);
|
||||||
|
|
||||||
|
var elements = copyPaste.paste({
|
||||||
|
element: rootElement,
|
||||||
|
point: {
|
||||||
|
x: 1000,
|
||||||
|
y: 1000
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// then
|
||||||
|
task = find(elements, function(element) {
|
||||||
|
return is(element, 'bpmn:Task');
|
||||||
|
});
|
||||||
|
|
||||||
|
boundaryEvent = find(elements, function(element) {
|
||||||
|
return is(element, 'bpmn:BoundaryEvent');
|
||||||
|
});
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(getBusinessObject(boundaryEvent).attachedToRef).to.equal(getBusinessObject(task));
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('should copy loop characteristics porperties',
|
it('should copy loop characteristics porperties',
|
||||||
inject(function(canvas, copyPaste, elementRegistry, modeling) {
|
inject(function(canvas, copyPaste, elementRegistry, modeling) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue