Search in sources :

Example 26 with BPMNGeneralSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet 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 27 with BPMNGeneralSet

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

the class DefaultRouteFormProviderTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    when(definitionManager.adapters()).thenReturn(adapterManager);
    when(adapterManager.forDefinition()).thenReturn(definitionAdapter);
    when(session.getSelectionControl()).thenReturn(selectionControl);
    Collection<String> selectedItems = new ArrayList<>();
    when(selectedNode.getUUID()).thenReturn(SELECTED_UUID);
    selectedItems.add(selectedNode.getUUID());
    when(selectionControl.getSelectedItems()).thenReturn(selectedItems);
    when(graph.getNode(SELECTED_UUID)).thenReturn(selectedNode);
    outEdges = new ArrayList<>();
    UserTask userTask1 = new UserTask(new TaskGeneralSet(new Name("UserTask1"), null), null, null, null, null, null, null);
    when(definitionAdapter.getTitle(eq(userTask1))).thenReturn("User Task");
    outEdges.add(mockEdge("Edge1", userTask1));
    UserTask userTask2 = new UserTask(new TaskGeneralSet(new Name("UserTask2"), null), null, null, null, null, null, null);
    when(definitionAdapter.getTitle(eq(userTask2))).thenReturn("User Task");
    outEdges.add(mockEdge("Edge2", userTask2));
    ScriptTask scriptTask3 = new ScriptTask(new TaskGeneralSet(new Name("ScriptTask3"), null), null, null, null, null, null, null);
    when(definitionAdapter.getTitle(eq(scriptTask3))).thenReturn("Script Task");
    outEdges.add(mockEdge("Edge3", scriptTask3));
    ExclusiveGateway gateway4 = new ExclusiveGateway(new BPMNGeneralSet("Gateway4"), null, null, null, null);
    when(definitionAdapter.getTitle(eq(gateway4))).thenReturn("Exclusive Gateway");
    outEdges.add(mockEdge("Edge4", gateway4));
    InclusiveGateway gateway5 = new InclusiveGateway(new BPMNGeneralSet(""), null, null, null, null);
    when(definitionAdapter.getTitle(eq(gateway5))).thenReturn("Inclusive Gateway");
    outEdges.add(mockEdge("Edge5", gateway5));
}
Also used : ExclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.ExclusiveGateway) ScriptTask(org.kie.workbench.common.stunner.bpmn.definition.ScriptTask) InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) ArrayList(java.util.ArrayList) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) TaskGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) Before(org.junit.Before)

Example 28 with BPMNGeneralSet

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

the class BPMNDirectDiagramMarshallerTest method testUnmarshallReusableSubprocess.

@Test
public void testUnmarshallReusableSubprocess() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_REUSABLE_SUBPROCESS);
    ReusableSubprocess reusableSubprocess = null;
    Iterator<Element> it = nodesIterator(diagram);
    while (it.hasNext()) {
        Element element = it.next();
        if (element.getContent() instanceof View) {
            Object oDefinition = ((View) element.getContent()).getDefinition();
            if (oDefinition instanceof ReusableSubprocess) {
                reusableSubprocess = (ReusableSubprocess) oDefinition;
                break;
            }
        }
    }
    assertNotNull(reusableSubprocess);
    assertNotNull(reusableSubprocess.getExecutionSet());
    assertNotNull(reusableSubprocess.getExecutionSet().getCalledElement());
    assertNotNull(reusableSubprocess.getGeneral());
    BPMNGeneralSet generalSet = reusableSubprocess.getGeneral();
    ReusableSubprocessTaskExecutionSet executionSet = reusableSubprocess.getExecutionSet();
    assertNotNull(generalSet);
    assertNotNull(executionSet);
    assertEquals("my subprocess", generalSet.getName().getValue());
    assertEquals("my-called-element", executionSet.getCalledElement().getValue());
    assertEquals(false, executionSet.getIndependent().getValue());
    assertEquals(false, executionSet.getWaitForCompletion().getValue());
    String assignmentsInfo = reusableSubprocess.getDataIOSet().getAssignmentsinfo().getValue();
    assertEquals("|input1:String,input2:Float||output1:String,output2:Float|[din]pv1->input1,[din]pv2->input2,[dout]output1->pv1,[dout]output2->pv2", assignmentsInfo);
    assertEquals("true", reusableSubprocess.getExecutionSet().getIsAsync().getValue().toString());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FlowElement(org.eclipse.bpmn2.FlowElement) RootElement(org.eclipse.bpmn2.RootElement) Element(org.kie.workbench.common.stunner.core.graph.Element) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ReusableSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.ReusableSubprocessTaskExecutionSet) Test(org.junit.Test)

Example 29 with BPMNGeneralSet

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

the class BPMNDirectDiagramMarshallerTest method testUnmarshallAddHocSubprocess.

@Test
public void testUnmarshallAddHocSubprocess() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ADHOC_SUBPROCESS);
    AdHocSubprocess adHocSubprocess = null;
    Iterator<Element> it = nodesIterator(diagram);
    while (it.hasNext()) {
        Element element = it.next();
        if (element.getContent() instanceof View) {
            Object oDefinition = ((View) element.getContent()).getDefinition();
            if (oDefinition instanceof AdHocSubprocess) {
                adHocSubprocess = (AdHocSubprocess) oDefinition;
                break;
            }
        }
    }
    assertNotNull(adHocSubprocess);
    BPMNGeneralSet generalSet = adHocSubprocess.getGeneral();
    AdHocSubprocessTaskExecutionSet executionSet = adHocSubprocess.getExecutionSet();
    ProcessData processData = adHocSubprocess.getProcessData();
    assertNotNull(generalSet);
    assertNotNull(executionSet);
    assertNotNull(processData);
    assertEquals("AdHocSubprocess1", generalSet.getName().getValue());
    assertEquals("AdHocSubprocess1Documentation", generalSet.getDocumentation().getValue());
    assertNotNull(executionSet.getAdHocCompletionCondition());
    assertNotNull(executionSet.getAdHocCompletionCondition().getValue());
    assertNotNull(executionSet.getAdHocOrdering());
    assertNotNull(executionSet.getOnEntryAction());
    assertNotNull(executionSet.getOnExitAction());
    assertEquals("autocomplete", executionSet.getAdHocCompletionCondition().getValue().getScript());
    assertEquals("drools", executionSet.getAdHocCompletionCondition().getValue().getLanguage());
    assertEquals("Sequential", executionSet.getAdHocOrdering().getValue());
    assertEquals(1, executionSet.getOnEntryAction().getValue().getValues().size());
    assertEquals("System.out.println(\"onEntryAction\");", executionSet.getOnEntryAction().getValue().getValues().get(0).getScript());
    assertEquals("mvel", executionSet.getOnEntryAction().getValue().getValues().get(0).getLanguage());
    assertEquals(1, executionSet.getOnExitAction().getValue().getValues().size());
    assertEquals("System.out.println(\"onExitAction\");", executionSet.getOnExitAction().getValue().getValues().get(0).getScript());
    assertEquals("java", executionSet.getOnExitAction().getValue().getValues().get(0).getLanguage());
    assertEquals("subProcessVar1:String,subProcessVar2:String", processData.getProcessVariables().getValue());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FlowElement(org.eclipse.bpmn2.FlowElement) RootElement(org.eclipse.bpmn2.RootElement) Element(org.kie.workbench.common.stunner.core.graph.Element) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) AdHocSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocSubprocessTaskExecutionSet) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData) Test(org.junit.Test)

Example 30 with BPMNGeneralSet

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

the class EndEventConverter method endNoneEvent.

private BpmnNode endNoneEvent(EndEvent event) {
    Node<View<EndNoneEvent>, Edge> node = factoryManager.newNode(event.getId(), EndNoneEvent.class);
    EndNoneEvent definition = node.getContent().getDefinition();
    EventPropertyReader p = propertyReaderFactory.of(event);
    definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    node.getContent().setBounds(p.getBounds());
    definition.setDimensionsSet(p.getCircleDimensionSet());
    definition.setFontSet(p.getFontSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    return BpmnNode.of(node);
}
Also used : Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) EndNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent) 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) EventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader) ThrowEventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)

Aggregations

BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)61 View (org.kie.workbench.common.stunner.core.graph.content.view.View)29 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)28 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)25 Edge (org.kie.workbench.common.stunner.core.graph.Edge)24 EventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader)16 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)15 Test (org.junit.Test)11 CatchEventPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter)9 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)9 Graph (org.kie.workbench.common.stunner.core.graph.Graph)9 CatchEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader)8 ProcessData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)8 ThrowEventPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ThrowEventPropertyWriter)7 ThrowEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader)7 EndEvent (org.eclipse.bpmn2.EndEvent)5 StartEvent (org.eclipse.bpmn2.StartEvent)5 BaseEndEvent (org.kie.workbench.common.stunner.bpmn.definition.BaseEndEvent)5 BaseStartEvent (org.kie.workbench.common.stunner.bpmn.definition.BaseStartEvent)5 IsInterrupting (org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting)5