Search in sources :

Example 1 with AssociationPropertyWriter

use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AssociationPropertyWriter in project kie-wb-common by kiegroup.

the class AssociationPropertyWriterTest method setUp.

@Before
public void setUp() {
    when(sourceWriter.getElement()).thenReturn(sourceElement);
    when(targetWriter.getElement()).thenReturn(targetElement);
    associationWriter = new AssociationPropertyWriter(association, variableScope);
}
Also used : AssociationPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AssociationPropertyWriter) Before(org.junit.Before)

Example 2 with AssociationPropertyWriter

use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AssociationPropertyWriter in project kie-wb-common by kiegroup.

the class AssociationConverter method toFlowElement.

public Result<BasePropertyWriter> toFlowElement(Edge<?, ?> edge, ElementContainer process) {
    ViewConnector<Association> connector = (ViewConnector<Association>) edge.getContent();
    Association definition = connector.getDefinition();
    org.eclipse.bpmn2.Association association = bpmn2.createAssociation();
    AssociationPropertyWriter p = propertyWriterFactory.of(association);
    association.setId(edge.getUUID());
    BasePropertyWriter pSrc = process.getChildElement(edge.getSourceNode().getUUID());
    BasePropertyWriter pTgt = process.getChildElement(edge.getTargetNode().getUUID());
    if (pSrc == null || pTgt == null) {
        String msg = String.format("BasePropertyWriter was not found for source node or target node at edge: %s, pSrc = %s, pTgt = %s", edge.getUUID(), pSrc, pTgt);
        LOG.debug(msg);
        return Result.failure(msg);
    }
    p.setSource(pSrc);
    p.setTarget(pTgt);
    p.setConnection(connector);
    BPMNGeneralSet general = definition.getGeneral();
    p.setDocumentation(general.getDocumentation().getValue());
    p.setDirectionAssociation(definition);
    return Result.of(p);
}
Also used : BasePropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.BasePropertyWriter) Association(org.kie.workbench.common.stunner.bpmn.definition.Association) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) AssociationPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AssociationPropertyWriter)

Aggregations

AssociationPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AssociationPropertyWriter)2 Before (org.junit.Before)1 Factories.bpmn2 (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2)1 BasePropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.BasePropertyWriter)1 Association (org.kie.workbench.common.stunner.bpmn.definition.Association)1 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)1 ViewConnector (org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector)1