Search in sources :

Example 1 with EventSubprocess

use of org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess in project kie-wb-common by kiegroup.

the class SubProcessConverter method convertEventSubprocessNode.

private SubProcessPropertyWriter convertEventSubprocessNode(Node<View<EventSubprocess>, ?> n) {
    SubProcess process = bpmn2.createSubProcess();
    process.setId(n.getUUID());
    SubProcessPropertyWriter p = propertyWriterFactory.of(process);
    EventSubprocess definition = n.getContent().getDefinition();
    process.setTriggeredByEvent(true);
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    ProcessData processData = definition.getProcessData();
    p.setProcessVariables(processData.getProcessVariables());
    p.setSimulationSet(definition.getSimulationSet());
    p.setBounds(n.getContent().getBounds());
    return p;
}
Also used : SubProcess(org.eclipse.bpmn2.SubProcess) EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) SubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SubProcessPropertyWriter) AdHocSubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)

Example 2 with EventSubprocess

use of org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testUnmarshallEventSubprocess.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallEventSubprocess() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EVENT_SUBPROCESS);
    assertDiagram(diagram, 2);
    assertEquals("EventSubProcess", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> eventSubprocessNode = diagram.getGraph().getNode("_DF031493-5F1C-4D2B-9916-2FEABB1FADFF");
    EventSubprocess eventSubprocess = (EventSubprocess) eventSubprocessNode.getContent().getDefinition();
    assertTrue(eventSubprocess.getIsAsync().getValue());
    assertEquals("Var1:String", eventSubprocess.getProcessData().getProcessVariables().getValue());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Test(org.junit.Test)

Example 3 with EventSubprocess

use of org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess in project kie-wb-common by kiegroup.

the class SubProcessConverter method convertEventSubprocessNode.

private BpmnNode convertEventSubprocessNode(SubProcess subProcess) {
    Node<View<EventSubprocess>, Edge> node = factoryManager.newNode(subProcess.getId(), EventSubprocess.class);
    EventSubprocess definition = node.getContent().getDefinition();
    SubProcessPropertyReader p = propertyReaderFactory.of(subProcess);
    definition.setGeneral(new BPMNGeneralSet(new Name(subProcess.getName()), new Documentation(p.getDocumentation())));
    definition.getIsAsync().setValue(p.isAsync());
    definition.setProcessData(new ProcessData(new ProcessVariables(p.getProcessVariables())));
    definition.setSimulationSet(p.getSimulationSet());
    definition.setDimensionsSet(p.getRectangleDimensionsSet());
    definition.setFontSet(p.getFontSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    node.getContent().setBounds(p.getBounds());
    return BpmnNode.of(node);
}
Also used : SubProcessPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.SubProcessPropertyReader) AdHocSubProcessPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.AdHocSubProcessPropertyReader) ProcessVariables(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables) EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)

Example 4 with EventSubprocess

use of org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess in project kie-wb-common by kiegroup.

the class BPMNDirectDiagramMarshallerTest method testUnmarshallEventSubprocess.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallEventSubprocess() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EVENT_SUBPROCESS);
    assertDiagram(diagram, 2);
    assertEquals("EventSubProcess", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> eventSubprocessNode = diagram.getGraph().getNode("_DF031493-5F1C-4D2B-9916-2FEABB1FADFF");
    EventSubprocess eventSubprocess = (EventSubprocess) eventSubprocessNode.getContent().getDefinition();
    assertTrue(eventSubprocess.getIsAsync().getValue());
    assertEquals(eventSubprocess.getProcessData().getProcessVariables().getValue(), "Var1:String");
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Test(org.junit.Test)

Example 5 with EventSubprocess

use of org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess in project kie-wb-common by kiegroup.

the class StartEventFilterProviderFactoryTest method setUp.

@Before
public void setUp() throws Exception {
    inEdges = Arrays.asList(edge);
    eventSubprocess = new EventSubprocess();
    otherNode = new MultipleInstanceSubprocess();
    when(sessionManager.getCurrentSession()).thenReturn(session);
    when(session.getCanvasHandler()).thenReturn(canvasHandler);
    when(canvasHandler.getGraphIndex()).thenReturn(graphIndex);
    when(canvasHandler.getGraphIndex().getNode(ELEMENT_UUID)).thenReturn(node);
    when(node.getInEdges()).thenReturn(inEdges);
    when(edge.getContent()).thenReturn(child);
    when(edge.getSourceNode()).thenReturn(parentNode);
    when(parentNode.asNode()).thenReturn(parentNode);
    when(parentNode.getContent()).thenReturn(parentView);
}
Also used : EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) MultipleInstanceSubprocess(org.kie.workbench.common.stunner.bpmn.definition.MultipleInstanceSubprocess) Before(org.junit.Before)

Aggregations

EventSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess)5 Test (org.junit.Test)2 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)2 ProcessData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)2 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)2 Graph (org.kie.workbench.common.stunner.core.graph.Graph)2 SubProcess (org.eclipse.bpmn2.SubProcess)1 Before (org.junit.Before)1 AdHocSubProcessPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter)1 SubProcessPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SubProcessPropertyWriter)1 AdHocSubProcessPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.AdHocSubProcessPropertyReader)1 SubProcessPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.SubProcessPropertyReader)1 MultipleInstanceSubprocess (org.kie.workbench.common.stunner.bpmn.definition.MultipleInstanceSubprocess)1 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)1 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)1 ProcessVariables (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables)1 Edge (org.kie.workbench.common.stunner.core.graph.Edge)1 View (org.kie.workbench.common.stunner.core.graph.content.view.View)1