Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 408x 408x 318x 90x 90x 251x 164x 164x 87x 74x 74x 74x 74x 74x 13x 90x 11x 408x 2362x 2313x 49x 2362x 49x 49x 49x 29x 29x 26x 49x 408x 408x 408x | import type { Element as XmlElement } from '@xmldom/xmldom';
import type { FlowableDocumentState } from '../types';
import {
buildXmlIdentity,
findDirectChild,
getElementChildren,
getLocalName,
isActivitiElement,
serializer,
} from './xmlUtils';
import { parseEventListener } from './xmlParsers';
function extractProcessExtensionState(
processElement: XmlElement,
processId: string,
documentState: FlowableDocumentState,
): void {
const extensionElements = findDirectChild(processElement, 'extensionElements');
if (!extensionElements) {
return;
}
const preservedExtensionElements: string[] = [];
for (const child of getElementChildren(extensionElements)) {
if (isActivitiElement(child, 'eventListener')) {
documentState.eventListeners.push({
...parseEventListener(child),
processId,
});
continue;
}
if (isActivitiElement(child, 'localization')) {
const localizationElement = child as XmlElement;
const locale = localizationElement.getAttribute('locale') || '';
const documentationChild = findDirectChild(localizationElement, 'documentation');
documentState.localizations.push({
id: `localization-${locale}`,
processId,
locale,
name: localizationElement.getAttribute('name') || '',
description: documentationChild?.textContent || '',
xmlIdentity: buildXmlIdentity('processLocalization', localizationElement),
});
continue;
}
preservedExtensionElements.push(serializer.serializeToString(child));
}
if (preservedExtensionElements.length > 0) {
documentState.processExtensionElements.push({
processId,
preservedExtensionElements,
});
}
}
function extractProcessDataObjects(
processElement: XmlElement,
processId: string,
documentState: FlowableDocumentState,
): void {
for (const child of getElementChildren(processElement)) {
if (getLocalName(child) !== 'dataObject') {
continue;
}
const id = child.getAttribute('id') || '';
Iif (!id) {
continue;
}
let defaultValue = '';
const dataObjectExtensions = findDirectChild(child, 'extensionElements');
if (dataObjectExtensions) {
for (const extensionChild of getElementChildren(dataObjectExtensions)) {
if (isActivitiElement(extensionChild, 'value')) {
defaultValue = extensionChild.textContent || '';
}
}
}
documentState.dataObjects.push({
id,
processId,
name: child.getAttribute('name') || '',
itemSubjectRef: child.getAttribute('itemSubjectRef') || '',
defaultValue,
xmlIdentity: buildXmlIdentity('dataObject', child),
});
}
}
export function extractProcessLevelState(processElement: XmlElement, documentState: FlowableDocumentState): void {
const processId = processElement.getAttribute('id') || '';
extractProcessExtensionState(processElement, processId, documentState);
extractProcessDataObjects(processElement, processId, documentState);
} |