Search in sources :

Example 1 with EmbeddedSubprocess

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

the class SubProcessConverter method convertEmbeddedSubprocessNode.

private BpmnNode convertEmbeddedSubprocessNode(SubProcess subProcess) {
    Node<View<EmbeddedSubprocess>, Edge> node = factoryManager.newNode(subProcess.getId(), EmbeddedSubprocess.class);
    EmbeddedSubprocess definition = node.getContent().getDefinition();
    SubProcessPropertyReader p = propertyReaderFactory.of(subProcess);
    definition.setGeneral(new BPMNGeneralSet(new Name(subProcess.getName()), new Documentation(p.getDocumentation())));
    definition.getOnEntryAction().setValue(p.getOnEntryAction());
    definition.getOnExitAction().setValue(p.getOnExitAction());
    definition.getIsAsync().setValue(p.isAsync());
    definition.setProcessData(new ProcessData(new ProcessVariables(p.getProcessVariables())));
    definition.setSimulationSet(p.getSimulationSet());
    node.getContent().setBounds(p.getBounds());
    definition.setDimensionsSet(p.getRectangleDimensionsSet());
    definition.setFontSet(p.getFontSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    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) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) 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 2 with EmbeddedSubprocess

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

the class BPMNDirectDiagramMarshallerTest method testUnmarshallEmbeddedSubprocess.

@Test
public void testUnmarshallEmbeddedSubprocess() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EMBEDDED_SUBPROCESS);
    EmbeddedSubprocess subprocess = 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 EmbeddedSubprocess) {
                subprocess = (EmbeddedSubprocess) oDefinition;
                break;
            }
        }
    }
    assertNotNull(subprocess);
}
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) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Test(org.junit.Test)

Example 3 with EmbeddedSubprocess

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

the class BPMNDiagramMarshallerTest method testUnmarshallEmbeddedSubprocess.

@Test
public void testUnmarshallEmbeddedSubprocess() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EMBEDDED_SUBPROCESS);
    EmbeddedSubprocess subprocess = 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 EmbeddedSubprocess) {
                subprocess = (EmbeddedSubprocess) oDefinition;
                break;
            }
        }
    }
    assertNotNull(subprocess);
}
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) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Test(org.junit.Test)

Example 4 with EmbeddedSubprocess

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

the class ConditionalComboBoxFieldRendererTest method init.

@Test
public void init() throws Exception {
    resetMocks();
    EmbeddedSubprocess embeddedSubprocess = new EmbeddedSubprocess.EmbeddedSubprocessBuilder().build();
    OnEntryAction onEntryAction = embeddedSubprocess.getOnEntryAction();
    OnExitAction onExitAction = embeddedSubprocess.getOnExitAction();
    // static mock
    PowerMockito.mockStatic(ClientBindingUtils.class);
    BDDMockito.given(ClientBindingUtils.getProxiedValue(embeddedSubprocess, "onEntryAction")).willReturn(onEntryAction);
    BDDMockito.given(ClientBindingUtils.getProxiedValue(embeddedSubprocess, "onExitAction")).willReturn(onExitAction);
    // instances mock
    when(conditionalComboBoxFieldDefinition.getRelatedField()).thenReturn("onEntryAction;onExitAction");
    when(renderingContext.getModel()).thenReturn(embeddedSubprocess);
    when(adapterManager.forProperty()).thenReturn(Mockito.mock(PropertyAdapter.class));
    when(adapterManager.forProperty().getValue(onEntryAction)).thenReturn("value");
    when(adapterManager.forProperty().getValue(onExitAction)).thenReturn("");
    conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition);
    verify(conditionalComboBoxFieldRenderer, never()).setReadOnly(true);
    when(adapterManager.forProperty().getValue(onEntryAction)).thenReturn(null);
    when(adapterManager.forProperty().getValue(onExitAction)).thenReturn("");
    conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition);
    verify(conditionalComboBoxFieldRenderer, times(1)).setReadOnly(false);
}
Also used : EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) OnExitAction(org.kie.workbench.common.stunner.bpmn.definition.property.task.OnExitAction) PropertyAdapter(org.kie.workbench.common.stunner.core.definition.adapter.PropertyAdapter) OnEntryAction(org.kie.workbench.common.stunner.bpmn.definition.property.task.OnEntryAction) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 5 with EmbeddedSubprocess

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

the class SubProcessConverter method convertEmbeddedSubprocessNode.

private SubProcessPropertyWriter convertEmbeddedSubprocessNode(Node<View<EmbeddedSubprocess>, ?> n) {
    SubProcess process = bpmn2.createSubProcess();
    process.setId(n.getUUID());
    SubProcessPropertyWriter p = propertyWriterFactory.of(process);
    EmbeddedSubprocess definition = n.getContent().getDefinition();
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    p.setOnEntryAction(definition.getOnEntryAction());
    p.setOnExitAction(definition.getOnExitAction());
    p.setAsync(definition.getIsAsync().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) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) 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)

Aggregations

EmbeddedSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess)5 Test (org.junit.Test)3 View (org.kie.workbench.common.stunner.core.graph.content.view.View)3 FlowElement (org.eclipse.bpmn2.FlowElement)2 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)2 RootElement (org.eclipse.bpmn2.RootElement)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 Element (org.kie.workbench.common.stunner.core.graph.Element)2 Graph (org.kie.workbench.common.stunner.core.graph.Graph)2 SubProcess (org.eclipse.bpmn2.SubProcess)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 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)1 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)1 OnEntryAction (org.kie.workbench.common.stunner.bpmn.definition.property.task.OnEntryAction)1 OnExitAction (org.kie.workbench.common.stunner.bpmn.definition.property.task.OnExitAction)1