interface ElementsRegistry {
    getElementsByIds(bpmnElementIds: string | string[]): BpmnElement[];
    getElementsByKinds(bpmnKinds: BpmnElementKind | BpmnElementKind[]): BpmnElement[];
    getModelElementsByIds(bpmnElementIds: string | string[]): BpmnSemantic[];
    getModelElementsByKinds(bpmnKinds: BpmnElementKind | BpmnElementKind[]): BpmnSemantic[];
}

Implemented by

Methods

  • Get all elements by ids. The returned array contains elements in the order of the bpmnElementIds parameter.

    Not found elements are not returned as undefined in the array, so the returned array contains at most as many elements as the bpmnElementIds parameter.

    ...
    // Find all elements by specified id or ids
    const bpmnElements1 = bpmnVisualization.bpmnElementsRegistry.getElementsByIds('userTask_1');
    const bpmnElements2 = bpmnVisualization.bpmnElementsRegistry.getElementsByIds(['startEvent_3', 'userTask_2']);
    // now you can do whatever you want with the elements
    ...

    WARNING: this method is not designed to accept a large amount of ids. It does DOM lookup to retrieve the HTML elements relative to the BPMN elements. Attempts to retrieve too many elements, especially on large BPMN diagram, may lead to performance issues.

    If you only need to retrieve the BPMN model data, use getModelElementsByIds instead.

    Parameters

    • bpmnElementIds: string | string[]

      The BPMN ID of the element(s) to retrieve.

    Returns BpmnElement[]

  • Get all elements by kinds.

    ...
    // Find all elements by desired type or types
    const bpmnTaskElements = bpmnVisualization.bpmnElementsRegistry.getElementsByKinds(ShapeBpmnElementKind.TASK);
    const bpmnEndEventAndPoolElements = bpmnVisualization.bpmnElementsRegistry.getElementsByKinds([ShapeBpmnElementKind.EVENT_END, ShapeBpmnElementKind.POOL]);
    // now you can do whatever you want with the elements
    ...

    If you only need to retrieve the BPMN model data, use getModelElementsByKinds instead.

    WARNING: this method is not designed to accept a large amount of types. It does DOM lookup to retrieve the HTML elements relative to the BPMN elements. Attempts to retrieve too many elements, especially on large BPMN diagrams, may lead to performance issues.

    Parameters

    Returns BpmnElement[]

  • Get all model elements in the form of BpmnSemantic objects corresponding to the identifiers supplied. The returned array contains elements in the order of the bpmnElementIds parameter.

    Not found elements are not returned as undefined in the array, so the returned array contains at most as many elements as the bpmnElementIds parameter.

    ...
    // Find all elements by specified id or ids
    const bpmnElements1 = bpmnVisualization.bpmnElementsRegistry.getModelElementsByIds('userTask_1');
    const bpmnElements2 = bpmnVisualization.bpmnElementsRegistry.getModelElementsByIds(['startEvent_3', 'userTask_2']);
    // now you can do whatever you want with the elements
    ...

    If you also need to retrieve the related DOM elements and more information, use getElementsByIds instead.

    Parameters

    • bpmnElementIds: string | string[]

      The BPMN ID of the element(s) to retrieve.

    Returns BpmnSemantic[]

    0.39.0

  • Get all model elements in the form of BpmnSemantic objects corresponding to the BPMN kinds supplied

    ...
    // Find all elements by desired kind or kinds
    const bpmnElements1 = bpmnVisualization.bpmnElementsRegistry.getModelElementsByKinds(ShapeBpmnElementKind.TASK);
    const bpmnElements2 = bpmnVisualization.bpmnElementsRegistry.getModelElementsByKinds([ShapeBpmnElementKind.EVENT_END, ShapeBpmnElementKind.POOL]);
    // now you can do whatever you want with the elements
    ...

    If you also need to retrieve the related DOM elements and more information, use getElementsByKinds instead.

    Parameters

    Returns BpmnSemantic[]

    0.39.0