Search in sources :

Example 1 with SubProcessPropertyWriter

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

the class SubProcessConverter method convertSubProcess.

public PropertyWriter convertSubProcess(Node<View<BaseSubprocess>, ?> node) {
    SubProcessPropertyWriter processRoot = NodeMatch.fromNode(BaseSubprocess.class, SubProcessPropertyWriter.class).when(EmbeddedSubprocess.class, this::convertEmbeddedSubprocessNode).when(EventSubprocess.class, this::convertEventSubprocessNode).when(AdHocSubprocess.class, this::convertAdHocSubprocessNode).apply(node).value();
    DefinitionsBuildingContext subContext = context.withRootNode(node);
    super.convertChildNodes(processRoot, subContext.nodes(), subContext.lanes());
    super.convertEdges(processRoot, subContext);
    return processRoot;
}
Also used : BaseSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseSubprocess) EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) DefinitionsBuildingContext(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsBuildingContext) SubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SubProcessPropertyWriter) AdHocSubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter)

Example 2 with SubProcessPropertyWriter

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

the class SubProcessConverter method convertEventSubprocessNode.

protected 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());
    EventSubprocessExecutionSet executionSet = definition.getExecutionSet();
    p.setAsync(executionSet.getIsAsync().getValue());
    p.setSlaDueDate(executionSet.getSlaDueDate());
    p.setSimulationSet(definition.getSimulationSet());
    p.setMetaData(definition.getAdvancedData().getMetaDataAttributes());
    p.setAbsoluteBounds(n);
    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) EventSubprocessExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.subProcess.execution.EventSubprocessExecutionSet) SubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SubProcessPropertyWriter) AdHocSubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter) MultipleInstanceSubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.MultipleInstanceSubProcessPropertyWriter) BaseProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.BaseProcessData) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)

Example 3 with SubProcessPropertyWriter

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

the class SubProcessConverterTest method testConvertEmbeddedSubprocess.

@Test
public void testConvertEmbeddedSubprocess() {
    final EmbeddedSubprocess definition = new EmbeddedSubprocess();
    setBaseSubprocessExecutionSetValues(definition.getExecutionSet());
    final View<EmbeddedSubprocess> view = new ViewImpl<>(definition, Bounds.create());
    final Node<View<EmbeddedSubprocess>, ?> node = new NodeImpl<>(UUID.randomUUID().toString());
    node.setContent(view);
    SubProcessPropertyWriter writer = tested.convertEmbeddedSubprocessNode(node);
    assertBaseSubprocessExecutionSet(writer);
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) SubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SubProcessPropertyWriter) AdHocSubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter) Test(org.junit.Test)

Example 4 with SubProcessPropertyWriter

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

the class SubProcessConverterTest method testConvertAdHocSubprocessNode_autostart.

@Test
public void testConvertAdHocSubprocessNode_autostart() {
    final AdHocSubprocess definition = new AdHocSubprocess();
    definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(true));
    final View<BaseAdHocSubprocess> view = new ViewImpl<>(definition, Bounds.create());
    final Node<View<BaseAdHocSubprocess>, ?> node = new NodeImpl<>(UUID.randomUUID().toString());
    node.setContent(view);
    SubProcessPropertyWriter writer = tested.convertAdHocSubprocessNode(node);
    assertTrue(AdHocSubProcessPropertyWriter.class.isInstance(writer));
    assertTrue(CustomElement.autoStart.of(writer.getFlowElement()).get());
}
Also used : AdHocSubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) BaseAdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseAdHocSubprocess) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) BaseAdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseAdHocSubprocess) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) AdHocAutostart(org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocAutostart) View(org.kie.workbench.common.stunner.core.graph.content.view.View) SubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SubProcessPropertyWriter) AdHocSubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter) Test(org.junit.Test)

Example 5 with SubProcessPropertyWriter

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

the class SubProcessConverterTest method testConvertAdHocSubprocessNode_notautostart.

@Test
public void testConvertAdHocSubprocessNode_notautostart() {
    final AdHocSubprocess definition = new AdHocSubprocess();
    definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(false));
    final View<BaseAdHocSubprocess> view = new ViewImpl<>(definition, Bounds.create());
    final Node<View<BaseAdHocSubprocess>, ?> node = new NodeImpl<>(UUID.randomUUID().toString());
    node.setContent(view);
    SubProcessPropertyWriter writer = tested.convertAdHocSubprocessNode(node);
    assertTrue(AdHocSubProcessPropertyWriter.class.isInstance(writer));
    assertFalse(CustomElement.autoStart.of(writer.getFlowElement()).get());
}
Also used : AdHocSubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) BaseAdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseAdHocSubprocess) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) BaseAdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseAdHocSubprocess) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) AdHocAutostart(org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocAutostart) View(org.kie.workbench.common.stunner.core.graph.content.view.View) SubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SubProcessPropertyWriter) AdHocSubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter) Test(org.junit.Test)

Aggregations

AdHocSubProcessPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter)10 SubProcessPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SubProcessPropertyWriter)10 Test (org.junit.Test)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)6 ViewImpl (org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl)6 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)6 BaseAdHocSubprocess (org.kie.workbench.common.stunner.bpmn.definition.BaseAdHocSubprocess)4 MultipleInstanceSubProcessPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.MultipleInstanceSubProcessPropertyWriter)3 AdHocSubprocess (org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess)3 EmbeddedSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess)3 EventSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess)3 SubProcess (org.eclipse.bpmn2.SubProcess)2 DefinitionsBuildingContext (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsBuildingContext)2 BPMNViewDefinition (org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition)2 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)2 AdHocAutostart (org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocAutostart)2 BaseProcessData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.BaseProcessData)2 ProcessData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)2 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)1 BPMNShape (org.eclipse.bpmn2.di.BPMNShape)1