Search in sources :

Example 1 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 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 ProcessVariables

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

the class ProcessVariablesProvider method findElements.

@Override
protected Collection<Pair<Object, String>> findElements(Predicate<Node> filter, Function<Node, Pair<Object, String>> mapper) {
    Collection<Pair<Object, String>> result = new ArrayList<>();
    String elementUUID = sessionManager.getCurrentSession().getCanvasHandler().getDiagram().getMetadata().getCanvasRootUUID();
    Node node;
    if (elementUUID != null) {
        node = sessionManager.getCurrentSession().getCanvasHandler().getDiagram().getGraph().getNode(elementUUID);
        Object oDefinition = ((View) node.getContent()).getDefinition();
        if (oDefinition instanceof BPMNDiagram) {
            BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) oDefinition;
            ProcessVariables processVars = bpmnDiagram.getProcessData().getProcessVariables();
            if (processVars.getValue().length() > 0) {
                List<String> list = Arrays.asList(processVars.getValue().split(","));
                list.forEach(s1 -> {
                    String value = s1.split(":")[0];
                    result.add(new Pair<>(value, value));
                });
            }
        }
    }
    return result;
}
Also used : ProcessVariables(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables) BPMNDiagram(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram) Node(org.kie.workbench.common.stunner.core.graph.Node) ArrayList(java.util.ArrayList) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Pair(org.uberfire.commons.data.Pair)

Example 3 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 mockRootNodeWithoutProcessVariables.

private Element mockRootNodeWithoutProcessVariables() {
    BPMNDiagramImpl rootNode = new BPMNDiagramImpl();
    rootNode.setProcessData(new ProcessData(new 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 4 with ProcessVariables

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

the class UserTaskTest method RHBA607.

@Test
@SuppressWarnings("unchecked")
public void RHBA607() throws Exception {
    super.init();
    final String BPMN_USER_TASK_PROPERTIES_FILE_PATH = "org/kie/workbench/common/stunner/bpmn/backend/service/diagram/userTaskProperties.bpmn";
    final String DIAGRAM_ID = "_pfJ-8O50EeiVSc03Fghuww";
    Diagram<Graph, Metadata> d = unmarshall(marshaller, BPMN_USER_TASK_PROPERTIES_FILE_PATH);
    Node<View<BPMNDiagramImpl>, ?> node = d.getGraph().getNode(DIAGRAM_ID);
    ProcessData processData = node.getContent().getDefinition().getProcessData();
    ProcessVariables processVariables = processData.getProcessVariables();
    DeclarationList declarationList = DeclarationList.fromString(processVariables.getValue());
    assertTrue(declarationList.getDeclarations().isEmpty());
}
Also used : ProcessVariables(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) DeclarationList(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.DeclarationList) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData) Test(org.junit.Test)

Example 5 with ProcessVariables

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

the class ProcessPropertyWriterTest method processVariables.

@Test
public void processVariables() {
    ProcessVariables processVariables = new ProcessVariables("GV1:Boolean:input,GV2:Boolean:output;required,GV3:Integer:customTag;required");
    p.setProcessVariables(processVariables);
    final ProcessPropertyReader pp = new ProcessPropertyReader(p.getProcess(), p.getBpmnDiagram(), p.getShape(), 1.0);
    String processVariablesString = pp.getProcessVariables();
    assertThat(processVariablesString).isEqualTo("GV1:Boolean:<![CDATA[input]]>,GV2:Boolean:<![CDATA[output;required]]>,GV3:Integer:<![CDATA[customTag;required]]>");
}
Also used : ProcessVariables(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables) ProcessPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ProcessPropertyReader) Test(org.junit.Test)

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