Search in sources :

Example 16 with AdHocSubprocess

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

the class AdHocSubProcessTest method testUnmarshallTopLevelFilledPropertiesSubProcess.

@Test
@Override
public void testUnmarshallTopLevelFilledPropertiesSubProcess() {
    final String SUB_PROCESS_NAME_JAVA = "Ad-hoc sub-process01 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_DOCUMENTATION_JAVA = "Ad-hoc sub-process01 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_NAME_JAVASCRIPT = "Ad-hoc sub-process02 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_DOCUMENTATION_JAVASCRIPT = "Ad-hoc sub-process02 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_NAME_MVEL = "Ad-hoc sub-process03 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_DOCUMENTATION_MVEL = "Ad-hoc sub-process03 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_VARIABLES_JAVA = "subVar01:String:[]";
    final String SUB_PROCESS_VARIABLES_JAVASCRIPT = "subVar02:String:[]";
    final String SUB_PROCESS_VARIABLES_MVEL = "subVarString:String:[],subVarCustom:CustomType:[],subVarBoolean:Boolean:[],subVarFloat:Float:[],subVarInteger:Integer:[],subVarObject:Object:[]";
    Diagram<Graph, Metadata> diagram = getDiagram();
    assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
    AdHocSubprocess topLevelSubProcessJava = getSubProcessNodeById(diagram, TOP_LEVEL_FILLED_SUBPROCESS_JAVA_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
    assertGeneralSet(topLevelSubProcessJava.getGeneral(), SUB_PROCESS_NAME_JAVA, SUB_PROCESS_DOCUMENTATION_JAVA);
    assertAdHocSubProcessExecutionSet(topLevelSubProcessJava.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT_DEFAULT, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, SUBPROCESS_ON_ENTRY_ACTION_JAVA, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_JAVA, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
    assertSubProcessProcessData(topLevelSubProcessJava.getProcessData(), SUB_PROCESS_VARIABLES_JAVA);
    AdHocSubprocess topLevelSubProcessJavascript = getSubProcessNodeById(diagram, TOP_LEVEL_FILLED_SUBPROCESS_JAVASCRIPT_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
    assertGeneralSet(topLevelSubProcessJavascript.getGeneral(), SUB_PROCESS_NAME_JAVASCRIPT, SUB_PROCESS_DOCUMENTATION_JAVASCRIPT);
    assertAdHocSubProcessExecutionSet(topLevelSubProcessJavascript.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT, ADHOC_COMPLETION_CONDITION_LANGUAGE_DROOLS, ADHOC_ORDERING_PARALLEL, SUBPROCESS_ON_ENTRY_ACTION_JAVASCRIPT, SUBPROCESS_SCRIPT_JAVASCRIPT_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_JAVASCRIPT, SUBPROCESS_SCRIPT_JAVASCRIPT_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
    assertSubProcessProcessData(topLevelSubProcessJavascript.getProcessData(), SUB_PROCESS_VARIABLES_JAVASCRIPT);
    AdHocSubprocess topLevelSubProcessMVEL = getSubProcessNodeById(diagram, TOP_LEVEL_FILLED_SUBPROCESS_MVEL_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
    assertGeneralSet(topLevelSubProcessMVEL.getGeneral(), SUB_PROCESS_NAME_MVEL, SUB_PROCESS_DOCUMENTATION_MVEL);
    assertAdHocSubProcessExecutionSet(topLevelSubProcessMVEL.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT_DEFAULT, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, SUBPROCESS_ON_ENTRY_ACTION_MVEL, SUBPROCESS_SCRIPT_MVEL_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_MVEL, SUBPROCESS_SCRIPT_MVEL_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
    assertSubProcessProcessData(topLevelSubProcessMVEL.getProcessData(), SUB_PROCESS_VARIABLES_MVEL);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) Test(org.junit.Test)

Example 17 with AdHocSubprocess

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

the class AdHocSubProcessTest method testUnmarshallSubProcessLevelEmptyPropertiesSubProcess.

@Test
@Override
public void testUnmarshallSubProcessLevelEmptyPropertiesSubProcess() {
    Diagram<Graph, Metadata> diagram = getDiagram();
    assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
    AdHocSubprocess subProcessLevelSubProcess = getSubProcessNodeById(diagram, SUBPROCESS_LEVEL_EMPTY_SUBPROCESS_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
    assertGeneralSet(subProcessLevelSubProcess.getGeneral(), DEFAULT_NAME, DEFAULT_DOCUMENTATION);
    assertAdHocSubProcessExecutionSet(subProcessLevelSubProcess.getExecutionSet(), EMPTY_VALUE, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, EMPTY_VALUE, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, EMPTY_VALUE, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, IS_NOT_ASYNC, EMPTY_VALUE);
    assertSubProcessProcessData(subProcessLevelSubProcess.getProcessData(), EMPTY_VALUE);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) Test(org.junit.Test)

Example 18 with AdHocSubprocess

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

the class SubProcessConverterTest method setUp.

@Before
public void setUp() {
    Definitions definitions = bpmn2.createDefinitions();
    definitions.getRootElements().add(bpmn2.createProcess());
    BPMNDiagram bpmnDiagram = di.createBPMNDiagram();
    bpmnDiagram.setPlane(di.createBPMNPlane());
    definitions.getDiagrams().add(bpmnDiagram);
    definitionResolver = new DefinitionResolver(definitions, Collections.emptyList());
    Node adHocNode = new NodeImpl("");
    View<AdHocSubprocess> adHocContent = new ViewImpl<>(new AdHocSubprocess(), Bounds.create());
    adHocNode.setContent(adHocContent);
    Node multipleInstanceNode = new NodeImpl("");
    View<MultipleInstanceSubprocess> miContent = new ViewImpl<>(new MultipleInstanceSubprocess(), Bounds.create());
    multipleInstanceNode.setContent(miContent);
    Node embeddedNode = new NodeImpl("");
    View<EmbeddedSubprocess> embeddedContent = new ViewImpl<>(new EmbeddedSubprocess(), Bounds.create());
    embeddedNode.setContent(embeddedContent);
    Node eventNode = new NodeImpl("");
    View<EventSubprocess> eventSubprocess = new ViewImpl<>(new EventSubprocess(), Bounds.create());
    eventNode.setContent(eventSubprocess);
    FactoryManager factoryManager = mock(FactoryManager.class);
    when(factoryManager.newElement(any(), eq(getDefinitionId(AdHocSubprocess.class)))).thenReturn(adHocNode);
    when(factoryManager.newElement(any(), eq(getDefinitionId(MultipleInstanceSubprocess.class)))).thenReturn(multipleInstanceNode);
    when(factoryManager.newElement(any(), eq(getDefinitionId(EmbeddedSubprocess.class)))).thenReturn(embeddedNode);
    when(factoryManager.newElement(any(), eq(getDefinitionId(EventSubprocess.class)))).thenReturn(eventNode);
    TypedFactoryManager typedFactoryManager = new TypedFactoryManager(factoryManager);
    tested = new SubProcessConverter(typedFactoryManager, new PropertyReaderFactory(definitionResolver), definitionResolver, new ConverterFactory(definitionResolver, typedFactoryManager));
}
Also used : TypedFactoryManager(org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager) DefinitionResolver(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.DefinitionResolver) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) Definitions(org.eclipse.bpmn2.Definitions) BpmnNode(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode) Node(org.kie.workbench.common.stunner.core.graph.Node) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) PropertyReaderFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.PropertyReaderFactory) ConverterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.ConverterFactory) MultipleInstanceSubprocess(org.kie.workbench.common.stunner.bpmn.definition.MultipleInstanceSubprocess) BPMNDiagram(org.eclipse.bpmn2.di.BPMNDiagram) EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) TypedFactoryManager(org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager) FactoryManager(org.kie.workbench.common.stunner.core.api.FactoryManager) Before(org.junit.Before)

Example 19 with AdHocSubprocess

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

the class AbstractDataTypeCacheTest method textExtractAdhocSubprocess.

@Test
public void textExtractAdhocSubprocess() {
    AdHocSubprocess adHocSubprocess = new AdHocSubprocess();
    AdHocSubprocess adHocSubprocess2 = new AdHocSubprocess();
    when(firstView.getDefinition()).thenReturn(adHocSubprocess);
    when(lastView.getDefinition()).thenReturn(adHocSubprocess2);
    dataTypeCache.extractFromItem(firstView);
    dataTypeCache.extractFromItem(lastView);
    assertTrue(dataTypeCache.allDataTypes.contains("MyType"));
    assertTrue(dataTypeCache.allDataTypes.contains("com.myspace.Person"));
}
Also used : AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) Test(org.junit.Test)

Example 20 with AdHocSubprocess

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

the class VariableSearchService method getVariables.

protected String getVariables(Node<?, ? extends Edge> node) {
    View view = node.getContent() instanceof View ? (View) node.getContent() : null;
    if (view == null) {
        return null;
    }
    if (view.getDefinition() instanceof EventSubprocess) {
        return ((EventSubprocess) view.getDefinition()).getProcessData().getProcessVariables().getValue();
    }
    if (view.getDefinition() instanceof AdHocSubprocess) {
        return ((AdHocSubprocess) view.getDefinition()).getProcessData().getProcessVariables().getValue();
    }
    if (view.getDefinition() instanceof EmbeddedSubprocess) {
        return ((EmbeddedSubprocess) view.getDefinition()).getProcessData().getProcessVariables().getValue();
    }
    if (view.getDefinition() instanceof MultipleInstanceSubprocess) {
        return ((MultipleInstanceSubprocess) view.getDefinition()).getProcessData().getProcessVariables().getValue();
    }
    if (view.getDefinition() instanceof BPMNDiagramImpl) {
        BPMNDiagramImpl bpmnDiagram = ((BPMNDiagramImpl) view.getDefinition());
        StringBuilder variablesBuilder = new StringBuilder();
        String processVariables = bpmnDiagram.getProcessData().getProcessVariables().getValue();
        if (!isEmpty(processVariables)) {
            variablesBuilder.append(processVariables);
        }
        addCaseFileVariables(variablesBuilder, bpmnDiagram.getCaseManagementSet());
        return variablesBuilder.length() > 0 ? variablesBuilder.toString() : null;
    }
    return null;
}
Also used : EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) MultipleInstanceSubprocess(org.kie.workbench.common.stunner.bpmn.definition.MultipleInstanceSubprocess)

Aggregations

AdHocSubprocess (org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess)20 Test (org.junit.Test)14 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)8 Graph (org.kie.workbench.common.stunner.core.graph.Graph)8 View (org.kie.workbench.common.stunner.core.graph.content.view.View)8 ProcessData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)5 ViewImpl (org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl)5 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)5 AdHocSubProcessPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter)4 EmbeddedSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess)4 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)4 AdHocSubprocessTaskExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocSubprocessTaskExecutionSet)4 SubProcessPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SubProcessPropertyWriter)3 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)3 BaseAdHocSubprocess (org.kie.workbench.common.stunner.bpmn.definition.BaseAdHocSubprocess)3 EventSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess)3 MultipleInstanceSubprocess (org.kie.workbench.common.stunner.bpmn.definition.MultipleInstanceSubprocess)3 Node (org.kie.workbench.common.stunner.core.graph.Node)3 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)2 FlowElement (org.eclipse.bpmn2.FlowElement)2