2022-07-13 19:23:45 +00:00
|
|
|
/**
|
|
|
|
* Returns the moddelElement if it is a process, otherwise, returns the
|
|
|
|
*
|
|
|
|
* @param container
|
|
|
|
*/
|
2022-07-11 17:09:25 +00:00
|
|
|
|
|
|
|
|
2022-07-13 19:23:45 +00:00
|
|
|
export function findDataObjects(process) {
|
2022-07-11 17:09:25 +00:00
|
|
|
let dataObjects = [];
|
2022-07-13 19:23:45 +00:00
|
|
|
if (!process || !process.flowElements) {
|
2022-07-13 15:49:29 +00:00
|
|
|
return dataObjects;
|
|
|
|
}
|
2022-07-11 17:09:25 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-11 21:29:41 +00:00
|
|
|
|
2022-07-13 19:23:45 +00:00
|
|
|
export function findDataReferenceShapes(processShape, id) {
|
2022-07-11 21:29:41 +00:00
|
|
|
let refs = [];
|
2022-07-13 19:23:45 +00:00
|
|
|
for (const shape of processShape.children) {
|
|
|
|
if (shape.type === 'bpmn:DataObjectReference') {
|
|
|
|
if (shape.businessObject.dataObjectRef && shape.businessObject.dataObjectRef.id === id) {
|
|
|
|
refs.push(shape);
|
|
|
|
}
|
2022-07-11 21:29:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return refs;
|
|
|
|
}
|