mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-03-04 02:50:38 +00:00
9c0da0240 Merge pull request #21 from sartography/bug/data_objects 6fe36aeb0 Minor fixes. d21cb75fb Assure we aren't setting the properties on every service task to the same thing. f28a3f89e Deleting any data object reference caused the associated data object to get deleted. Fixes this so that only if you delete all references, wii the data object be removed. Also assures that a new data object is not created when adding to a participant in a collaboration (an edge case bug(. git-subtree-dir: bpmn-js-spiffworkflow git-subtree-split: 9c0da02406ecbc51cfd7fd1ed1f2f311101d9987
49 lines
1.0 KiB
JavaScript
49 lines
1.0 KiB
JavaScript
/**
|
|
* Returns the moddelElement if it is a process, otherwise, returns the
|
|
*
|
|
* @param container
|
|
*/
|
|
|
|
|
|
export function findDataObjects(parent) {
|
|
let dataObjects = [];
|
|
let process;
|
|
if (!parent) {
|
|
return [];
|
|
}
|
|
if (parent.processRef) {
|
|
process = parent.processRef;
|
|
} else {
|
|
process = parent;
|
|
}
|
|
if (!process.flowElements) {
|
|
return [];
|
|
}
|
|
for (const element of process.flowElements) {
|
|
if (element.$type === 'bpmn:DataObject') {
|
|
dataObjects.push(element);
|
|
}
|
|
}
|
|
return dataObjects;
|
|
}
|
|
|
|
export function findDataObject(process, id) {
|
|
for (const dataObj of findDataObjects(process)) {
|
|
if (dataObj.id === id) {
|
|
return dataObj;
|
|
}
|
|
}
|
|
}
|
|
|
|
export function findDataReferenceShapes(processShape, id) {
|
|
let refs = [];
|
|
for (const shape of processShape.children) {
|
|
if (shape.type === 'bpmn:DataObjectReference') {
|
|
if (shape.businessObject.dataObjectRef && shape.businessObject.dataObjectRef.id === id) {
|
|
refs.push(shape);
|
|
}
|
|
}
|
|
}
|
|
return refs;
|
|
}
|