2022-08-08 20:08:44 +00:00
|
|
|
/**
|
|
|
|
* loops up until it can find the root.
|
|
|
|
* @param element
|
|
|
|
*/
|
|
|
|
export function getRoot(element) {
|
|
|
|
if(element.$parent) {
|
|
|
|
return getRoot(element.$parent)
|
|
|
|
} else {
|
|
|
|
return element
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function findCorrelationKeys(element) {
|
|
|
|
const root = getRoot(element)
|
|
|
|
const correlationProperties = [];
|
|
|
|
for (const rootElement of root.rootElements) {
|
|
|
|
if (rootElement.$type === 'bpmn:CorrelationProperty') {
|
|
|
|
correlationProperties.push(rootElement);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return correlationProperties;
|
|
|
|
}
|
|
|
|
|
2022-08-09 15:22:08 +00:00
|
|
|
export function findMessageModdleElements(element) {
|
2022-08-08 20:08:44 +00:00
|
|
|
const messages = [];
|
|
|
|
const root = getRoot(element)
|
|
|
|
for (const rootElement of root.rootElements) {
|
|
|
|
if (rootElement.$type === 'bpmn:Message') {
|
|
|
|
messages.push(rootElement);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return messages;
|
|
|
|
}
|