Search in sources :

Example 11 with ProcessVariables

use of org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables 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 12 with ProcessVariables

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

the class ProcessVariableProviderTest method mockRootNode.

private Element mockRootNode(String processVariables) {
    BPMNDiagramImpl rootNode = new BPMNDiagramImpl();
    rootNode.setProcessData(new ProcessData(new ProcessVariables(processVariables)));
    return mockNode(rootNode);
}
Also used : ProcessVariables(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)

Example 13 with ProcessVariables

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

the class BPMNDiagramMarshallerTest method testUnmarshallProcessVariables.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallProcessVariables() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_PROCESSVARIABLES);
    assertDiagram(diagram, 8);
    assertEquals("ProcessVariables", diagram.getMetadata().getTitle());
    ProcessVariables variables = 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 BPMNDiagram) {
                BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) oDefinition;
                variables = bpmnDiagram.getProcessData().getProcessVariables();
                break;
            }
        }
    }
    assertEquals(variables.getValue(), "employee:java.lang.String,reason:java.lang.String,performance:java.lang.String");
    Node<? extends Definition, ?> diagramNode = diagram.getGraph().getNode("_luRBMdEjEeWXpsZ1tNStKQ");
    assertTrue(diagramNode.getContent().getDefinition() instanceof BPMNDiagram);
    BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) diagramNode.getContent().getDefinition();
    assertTrue(bpmnDiagram.getProcessData() != null);
    assertTrue(bpmnDiagram.getProcessData().getProcessVariables() != null);
    variables = bpmnDiagram.getProcessData().getProcessVariables();
    assertEquals(variables.getValue(), "employee:java.lang.String,reason:java.lang.String,performance:java.lang.String");
}
Also used : ProcessVariables(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables) BPMNDiagram(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram) 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) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Test(org.junit.Test)

Example 14 with ProcessVariables

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

the class BPMNDirectDiagramMarshallerTest method testUnmarshallProcessVariables.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallProcessVariables() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_PROCESSVARIABLES);
    assertDiagram(diagram, 8);
    assertEquals("ProcessVariables", diagram.getMetadata().getTitle());
    BPMNDiagramImpl bpmnDiagram = getBpmnDiagram(diagram);
    ProcessVariables variables = bpmnDiagram.getProcessData().getProcessVariables();
    assertEquals(variables.getValue(), "employee:java.lang.String:[],reason:java.lang.String:[],performance:java.lang.String:[]");
    Node<? extends Definition, ?> diagramNode = diagram.getGraph().getNode("_luRBMdEjEeWXpsZ1tNStKQ");
    assertTrue(diagramNode.getContent().getDefinition() instanceof BPMNDiagram);
    bpmnDiagram = (BPMNDiagramImpl) diagramNode.getContent().getDefinition();
    assertTrue(bpmnDiagram.getProcessData() != null);
    assertTrue(bpmnDiagram.getProcessData().getProcessVariables() != null);
    variables = bpmnDiagram.getProcessData().getProcessVariables();
    assertEquals(variables.getValue(), "employee:java.lang.String:[],reason:java.lang.String:[],performance:java.lang.String:[]");
}
Also used : ProcessVariables(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables) BPMNDiagram(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) Test(org.junit.Test)

Example 15 with ProcessVariables

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

the class BaseSubProcessConverter method convertMultiInstanceSubprocessNode.

private BpmnNode convertMultiInstanceSubprocessNode(SubProcess subProcess) {
    Node<View<MultipleInstanceSubprocess>, Edge> node = delegate.factoryManager.newNode(subProcess.getId(), MultipleInstanceSubprocess.class);
    MultipleInstanceSubprocess definition = node.getContent().getDefinition();
    MultipleInstanceSubProcessPropertyReader p = delegate.propertyReaderFactory.ofMultipleInstance(subProcess);
    definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    definition.setExecutionSet(new MultipleInstanceSubprocessTaskExecutionSet(new MultipleInstanceExecutionMode(p.isSequential()), new MultipleInstanceCollectionInput(p.getCollectionInput()), new MultipleInstanceCollectionOutput(p.getCollectionOutput()), new MultipleInstanceDataInput(p.getDataInput()), new MultipleInstanceDataOutput(p.getDataOutput()), new MultipleInstanceCompletionCondition(p.getCompletionCondition()), new OnEntryAction(p.getOnEntryAction()), new OnExitAction(p.getOnExitAction()), new IsMultipleInstance(true), new IsAsync(p.isAsync()), new SLADueDate(p.getSlaDueDate())));
    definition.setProcessData(new ProcessData(new ProcessVariables(p.getProcessVariables())));
    definition.setSimulationSet(p.getSimulationSet());
    definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
    definition.setDimensionsSet(p.getRectangleDimensionsSet());
    definition.setFontSet(p.getFontSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    node.getContent().setBounds(p.getBounds());
    return BpmnNode.of(node, p);
}
Also used : Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) MultipleInstanceSubProcessPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.MultipleInstanceSubProcessPropertyReader) MultipleInstanceCollectionOutput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionOutput) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) OnExitAction(org.kie.workbench.common.stunner.bpmn.definition.property.task.OnExitAction) OnEntryAction(org.kie.workbench.common.stunner.bpmn.definition.property.task.OnEntryAction) View(org.kie.workbench.common.stunner.core.graph.content.view.View) MultipleInstanceSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceSubprocessTaskExecutionSet) BaseProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.BaseProcessData) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData) MultipleInstanceSubprocess(org.kie.workbench.common.stunner.bpmn.definition.MultipleInstanceSubprocess) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) ProcessVariables(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables) SLADueDate(org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate) AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) MultipleInstanceCompletionCondition(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCompletionCondition) IsMultipleInstance(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsMultipleInstance) MultipleInstanceCollectionInput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionInput) MultipleInstanceExecutionMode(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceExecutionMode) MultipleInstanceDataInput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceDataInput) IsAsync(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync) Edge(org.kie.workbench.common.stunner.core.graph.Edge) MultipleInstanceDataOutput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceDataOutput)

Aggregations

ProcessVariables (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables)20 ProcessData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)15 View (org.kie.workbench.common.stunner.core.graph.content.view.View)10 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)9 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)8 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)8 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)7 Edge (org.kie.workbench.common.stunner.core.graph.Edge)7 Test (org.junit.Test)6 AdHocSubProcessPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.AdHocSubProcessPropertyReader)5 SLADueDate (org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate)5 IsAsync (org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync)5 OnEntryAction (org.kie.workbench.common.stunner.bpmn.definition.property.task.OnEntryAction)5 OnExitAction (org.kie.workbench.common.stunner.bpmn.definition.property.task.OnExitAction)5 AdvancedData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData)4 ProcessPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ProcessPropertyReader)3 SubProcessPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.SubProcessPropertyReader)3 BPMNDiagram (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram)3 IsMultipleInstance (org.kie.workbench.common.stunner.bpmn.definition.property.task.IsMultipleInstance)3 MultipleInstanceCollectionInput (org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionInput)3