Search in sources :

Example 1 with BPMNDiagramImpl

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

the class BPMNDiagramTest method testVersionInvalid.

@Test
public void testVersionInvalid() {
    BPMNDiagramImpl BPMNDiagramImpl = createValidBpmnDiagram();
    BPMNDiagramImpl.getDiagramSet().setVersion(new Version(VERSION_INVALID));
    Set<ConstraintViolation<BPMNDiagramImpl>> violations = this.validator.validate(BPMNDiagramImpl);
    assertEquals(1, violations.size());
}
Also used : Version(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Version) ConstraintViolation(javax.validation.ConstraintViolation) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) Test(org.junit.Test)

Example 2 with BPMNDiagramImpl

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

the class BPMNDiagramTest method testAllValid.

@Test
public void testAllValid() {
    BPMNDiagramImpl BPMNDiagramImpl = createValidBpmnDiagram();
    Set<ConstraintViolation<BPMNDiagramImpl>> violations = this.validator.validate(BPMNDiagramImpl);
    assertTrue(violations.isEmpty());
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) Test(org.junit.Test)

Example 3 with BPMNDiagramImpl

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

the class BPMNDiagramTest method testIDInvalid.

@Test
public void testIDInvalid() {
    BPMNDiagramImpl BPMNDiagramImpl = createValidBpmnDiagram();
    BPMNDiagramImpl.getDiagramSet().setId(new Id(ID_INVALID));
    Set<ConstraintViolation<BPMNDiagramImpl>> violations = this.validator.validate(BPMNDiagramImpl);
    assertEquals(1, violations.size());
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) Id(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Id) Test(org.junit.Test)

Example 4 with BPMNDiagramImpl

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

the class RootProcessConverter method convertProcessNode.

private ProcessPropertyWriter convertProcessNode(Node<Definition<BPMNDiagramImpl>, ?> node) {
    Process process = bpmn2.createProcess();
    ProcessPropertyWriter p = propertyWriterFactory.of(process);
    BPMNDiagramImpl definition = node.getContent().getDefinition();
    DiagramSet diagramSet = definition.getDiagramSet();
    p.setName(diagramSet.getName().getValue());
    p.setDocumentation(diagramSet.getDocumentation().getValue());
    process.setId(diagramSet.getId().getValue());
    p.setPackage(diagramSet.getPackageProperty().getValue());
    p.setVersion(diagramSet.getVersion().getValue());
    p.setAdHoc(diagramSet.getAdHoc().getValue());
    p.setDescription(diagramSet.getProcessInstanceDescription().getValue());
    p.setExecutable(diagramSet.getExecutable().getValue());
    ProcessData processData = definition.getProcessData();
    p.setProcessVariables(processData.getProcessVariables());
    return p;
}
Also used : DiagramSet(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet) Process(org.eclipse.bpmn2.Process) ProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)

Example 5 with BPMNDiagramImpl

use of org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl 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)

Aggregations

BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)16 Test (org.junit.Test)9 ProcessVariables (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables)7 View (org.kie.workbench.common.stunner.core.graph.content.view.View)7 ConstraintViolation (javax.validation.ConstraintViolation)5 BPMNDiagram (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram)5 DiagramSet (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet)5 Element (org.kie.workbench.common.stunner.core.graph.Element)5 FlowElement (org.eclipse.bpmn2.FlowElement)4 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)4 RootElement (org.eclipse.bpmn2.RootElement)4 ProcessData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)4 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)4 Graph (org.kie.workbench.common.stunner.core.graph.Graph)4 Id (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Id)3 Package (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Package)3 Version (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Version)3 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)3 ArrayList (java.util.ArrayList)1 Process (org.eclipse.bpmn2.Process)1