Search in sources :

Example 1 with BaseReusableSubprocess

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

the class ReusableSubprocessConverter method toFlowElement.

public PropertyWriter toFlowElement(Node<View<BaseReusableSubprocess>, ?> n) {
    CallActivity activity = bpmn2.createCallActivity();
    activity.setId(n.getUUID());
    CallActivityPropertyWriter p = propertyWriterFactory.of(activity);
    BaseReusableSubprocess definition = n.getContent().getDefinition();
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    BaseReusableSubprocessTaskExecutionSet executionSet = definition.getExecutionSet();
    p.setOnEntryAction(executionSet.getOnEntryAction());
    p.setOnExitAction(executionSet.getOnExitAction());
    p.setCalledElement(replaceIllegalCharsAttribute(executionSet.getCalledElement().getValue()));
    p.setAsync(executionSet.getIsAsync().getValue());
    p.setIndependent(executionSet.getIndependent().getValue());
    if (Boolean.FALSE.equals(executionSet.getIndependent().getValue())) {
        p.setAbortParent(executionSet.getAbortParent().getValue());
    }
    p.setWaitForCompletion(executionSet.getWaitForCompletion().getValue());
    p.setSlaDueDate(executionSet.getSlaDueDate());
    p.setAssignmentsInfo(definition.getDataIOSet().getAssignmentsinfo());
    if (Boolean.TRUE.equals(executionSet.getIsMultipleInstance().getValue())) {
        p.setIsSequential(executionSet.getMultipleInstanceExecutionMode().isSequential());
        p.setCollectionInput(executionSet.getMultipleInstanceCollectionInput().getValue());
        p.setInput(executionSet.getMultipleInstanceDataInput().getValue());
        p.setCollectionOutput(executionSet.getMultipleInstanceCollectionOutput().getValue());
        p.setOutput(executionSet.getMultipleInstanceDataOutput().getValue());
        p.setCompletionCondition(executionSet.getMultipleInstanceCompletionCondition().getValue());
    }
    p.setSimulationSet(definition.getSimulationSet());
    p.setAbsoluteBounds(n);
    p.setCase(executionSet.getIsCase().getValue());
    p.setAdHocAutostart(executionSet.getAdHocAutostart().getValue());
    p.setMetaData(definition.getAdvancedData().getMetaDataAttributes());
    return p;
}
Also used : CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) BaseReusableSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.BaseReusableSubprocessTaskExecutionSet) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) CallActivity(org.eclipse.bpmn2.CallActivity)

Example 2 with BaseReusableSubprocess

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

the class ReusableSubprocessConverterTest method testToFlowElement_autostart.

@Test
public void testToFlowElement_autostart() {
    final ReusableSubprocess definition = new ReusableSubprocess();
    definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(true));
    final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create());
    final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString());
    node.setContent(view);
    final PropertyWriter propertyWriter = tested.toFlowElement(node);
    assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter));
    assertTrue(CustomElement.autoStart.of(propertyWriter.getFlowElement()).get());
}
Also used : CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) 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) CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) PropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter) Test(org.junit.Test)

Example 3 with BaseReusableSubprocess

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

the class ReusableSubprocessConverterTest method testToFlowElementForAbortParent.

private void testToFlowElementForAbortParent(boolean independent, boolean abortParent, boolean expectedAbortParent) {
    final ReusableSubprocess definition = new ReusableSubprocess();
    definition.getExecutionSet().setIndependent(new Independent(independent));
    definition.getExecutionSet().setAbortParent(new AbortParent(abortParent));
    final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create());
    final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString());
    node.setContent(view);
    final PropertyWriter propertyWriter = tested.toFlowElement(node);
    assertEquals(expectedAbortParent, CustomElement.abortParent.of(propertyWriter.getFlowElement()).get());
}
Also used : BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) Independent(org.kie.workbench.common.stunner.bpmn.definition.property.task.Independent) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) AbortParent(org.kie.workbench.common.stunner.bpmn.definition.property.task.AbortParent) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) PropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter)

Example 4 with BaseReusableSubprocess

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

the class ReusableSubprocessConverterTest method testToFlowElement_case.

@Test
public void testToFlowElement_case() {
    final BaseReusableSubprocess definition = new ReusableSubprocess();
    definition.getExecutionSet().setIsCase(new IsCase(true));
    final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create());
    final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString());
    node.setContent(view);
    final PropertyWriter propertyWriter = tested.toFlowElement(node);
    assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter));
    assertTrue(CustomElement.isCase.of(propertyWriter.getFlowElement()).get());
}
Also used : CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) IsCase(org.kie.workbench.common.stunner.bpmn.definition.property.subProcess.IsCase) View(org.kie.workbench.common.stunner.core.graph.content.view.View) CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) PropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter) Test(org.junit.Test)

Example 5 with BaseReusableSubprocess

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

the class ReusableSubprocessConverterTest method testToFlowElement_notautostart.

@Test
public void testToFlowElement_notautostart() {
    final ReusableSubprocess definition = new ReusableSubprocess();
    definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(false));
    final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create());
    final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString());
    node.setContent(view);
    final PropertyWriter propertyWriter = tested.toFlowElement(node);
    assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter));
    assertFalse(CustomElement.autoStart.of(propertyWriter.getFlowElement()).get());
}
Also used : CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) 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) CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) PropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter) Test(org.junit.Test)

Aggregations

BaseReusableSubprocess (org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess)9 ReusableSubprocess (org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess)8 CallActivityPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter)7 ViewImpl (org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl)7 PropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)6 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)6 Test (org.junit.Test)5 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)3 AdHocAutostart (org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocAutostart)3 CallActivity (org.eclipse.bpmn2.CallActivity)2 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)2 SLADueDate (org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate)2 IsCase (org.kie.workbench.common.stunner.bpmn.definition.property.subProcess.IsCase)2 AbortParent (org.kie.workbench.common.stunner.bpmn.definition.property.task.AbortParent)2 Independent (org.kie.workbench.common.stunner.bpmn.definition.property.task.Independent)2 IsAsync (org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync)2 IsMultipleInstance (org.kie.workbench.common.stunner.bpmn.definition.property.task.IsMultipleInstance)2 MultipleInstanceCollectionInput (org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionInput)2 MultipleInstanceCollectionOutput (org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionOutput)2