Hi,
Is there any way to get text annotations of certain task?
Thanks,
Pedro Silva
Hi,
Is there any way to get text annotations of certain task?
Thanks,
Pedro Silva
OK. Thanks!
Additionally this code would be helpful for you. Value can be retrieved from textAnnotation.getText().getTextContent()
@BeforeClass
public static void parseModel() {
modelInstance = Bpmn.readModelFromStream(TextAnnotationTest.class
.getResourceAsStream("TextAnnotationTest.bpmn"));
}
@Test
public void testGetTextAnnotationsByType() {
Collection<TextAnnotation> textAnnotations = modelInstance.getModelElementsByType(TextAnnotation.class);
assertThat(textAnnotations)
.isNotNull()
.hasSize(2);
}
@Test
public void testGetTextAnnotationById() {
TextAnnotation textAnnotation = modelInstance.getModelElementById("textAnnotation2");
assertThat(textAnnotation).isNotNull();
assertThat(textAnnotation.getTextFormat()).isEqualTo("text/plain");
Text text = textAnnotation.getText();
assertThat(text.getTextContent()).isEqualTo("Attached text annotation");
}