Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[bpmn2-modeler-dev] Problem accessing to the elements at the ends of an association

Hi all:

I am trying to parse a BPMN model and process the text annotations attached to some of the elements in the model, mostly tasks and gateways. After loading the model from the file into memory I can get a list with the text annotations and the associations by calling the method getArtifacts on the processes of the model. However, the text annotations do not hold the reference to the element the annotation refers to. The reference is stored in an association, that holds the identifiers of both the text annotation and the annotated element.

    <bpmn2:textAnnotation id="TextAnnotation_1">
      <bpmn2:text>Text annotation relative to Task 1</bpmn2:text>
    </bpmn2:textAnnotation>
    <bpmn2:association id="Association_1" sourceRef="TextAnnotation_1" targetRef="Task_1"/>

In order to know what text annotations and elements are related, I am trying to access to the identifiers of the elements at the ends of an Association element. When I make a call to getSourceRef() or getTargetRef() I don’t get a String with the elements’ identifiers, but an instance of BaseElementImpl. The identifier I am trying to access is contained in such an instance. In particular, it is contained in the attribute eProperties (of class BasicEObjectImpl$EPropertiesHolderImpl). Inside eProperties, the navigation must continue through the attribute eProxyURI (of class URI$Fragment) and, inside of it, to the attribute fragment, that contains the identifier I am looking for.

My problem is that I don’t know how can I get to the eProperties attribute of the BaseElementImpl instances returned by the calls to getSourceRef() and getTargetRef(). Presently I am getting the identifiers by parsing the string resulting from calling the method toString() on the BaseElement element, but I don’t find it to be a smart solution.

Can somebody explain me how to access properly to those identifiers?

Thanks in advance.

--
José María Álvarez Palomo
Dpt. de Lenguajes y Ciencias de la Computación
E.T.S.I. Informática - Universidad de Málaga
Bulevar Louis Pasteur, 35. Despacho 3.2.6
29071 Málaga - España
Tel. +34 952 132750

Attachment: Captura de pantalla 2018-11-09 a las 14.07.46.png
Description: PNG image


Back to the top