use of org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation in project kie-wb-common by kiegroup.
the class ArtifactsConverter method toTextAnnotation.
private PropertyWriter toTextAnnotation(Node<View<TextAnnotation>, ?> node) {
org.eclipse.bpmn2.TextAnnotation element = bpmn2.createTextAnnotation();
element.setId(node.getUUID());
TextAnnotationPropertyWriter writer = propertyWriterFactory.of(element);
TextAnnotation definition = node.getContent().getDefinition();
BPMNGeneralSet general = definition.getGeneral();
writer.setName(general.getName().getValue());
writer.setDocumentation(general.getDocumentation().getValue());
writer.setMetaData(definition.getAdvancedData().getMetaDataAttributes());
writer.setAbsoluteBounds(node);
return writer;
}
use of org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation in project kie-wb-common by kiegroup.
the class ArtifactsConverter method toTextAnnotation.
private BpmnNode toTextAnnotation(org.eclipse.bpmn2.TextAnnotation element) {
TextAnnotationPropertyReader p = propertyReaderFactory.of(element);
Node<View<TextAnnotation>, Edge> node = typedFactoryManager.newNode(element.getId(), TextAnnotation.class);
TextAnnotation definition = node.getContent().getDefinition();
definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
node.getContent().setBounds(p.getBounds());
definition.setDimensionsSet(p.getRectangleDimensionsSet());
definition.setFontSet(p.getFontSet());
definition.setBackgroundSet(p.getBackgroundSet());
definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
return BpmnNode.of(node, p);
}
use of org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation in project kie-wb-common by kiegroup.
the class ArtifactsConverterTest method toTextAnnotationElement.
@Test
public void toTextAnnotationElement() {
TextAnnotation textAnnotation = new TextAnnotation();
textAnnotation.getGeneral().getDocumentation().setValue(DOC);
textAnnotation.getGeneral().getName().setValue(NAME);
textAnnotationNode = new NodeImpl<>(UUID.uuid());
textAnnotationNode.setContent(textAnnotationView);
when(textAnnotationView.getDefinition()).thenReturn(textAnnotation);
when(propertyWriterFactory.of(any(org.eclipse.bpmn2.TextAnnotation.class))).thenReturn(textAnnotationWriter);
artifactsConverter = new ArtifactsConverter(propertyWriterFactory);
PropertyWriter propertyWriter = artifactsConverter.toElement(((NodeImpl) textAnnotationNode));
verify(textAnnotationWriter).setName(NAME);
verify(textAnnotationWriter).setDocumentation(DOC);
verify(textAnnotationWriter).setAbsoluteBounds(textAnnotationNode);
assertEquals(textAnnotationWriter, propertyWriter);
}
Aggregations