Search in sources :

Example 6 with BPMNDiagram

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

the class BPMNDiagramMarshallerTest method testUnmarshallProcessProperties.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallProcessProperties() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_PROCESSPROPERTIES);
    assertDiagram(diagram, 4);
    assertEquals("BPSimple", diagram.getMetadata().getTitle());
    DiagramSet diagramProperties = null;
    Iterator<Element> it = nodesIterator(diagram);
    while (it.hasNext()) {
        Element element = it.next();
        if (element.getContent() instanceof View) {
            Object oDefinition = ((View) element.getContent()).getDefinition();
            if (oDefinition instanceof BPMNDiagram) {
                BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) oDefinition;
                diagramProperties = bpmnDiagram.getDiagramSet();
                break;
            }
        }
    }
    assertEquals("BPSimple", diagramProperties.getName().getValue());
    assertEquals("This is a\n" + "simple\n" + "process", diagramProperties.getDocumentation().getValue());
    assertEquals("JDLProj.BPSimple", diagramProperties.getId().getValue());
    assertEquals("org.jbpm", diagramProperties.getPackageProperty().getValue());
    assertEquals(Boolean.valueOf(true), diagramProperties.getExecutable().getValue());
    assertEquals(Boolean.valueOf(true), diagramProperties.getAdHoc().getValue());
    assertEquals("This is the\n" + "Process\n" + "Instance\n" + "Description", diagramProperties.getProcessInstanceDescription().getValue());
}
Also used : BPMNDiagram(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram) Graph(org.kie.workbench.common.stunner.core.graph.Graph) DiagramSet(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FlowElement(org.eclipse.bpmn2.FlowElement) RootElement(org.eclipse.bpmn2.RootElement) Element(org.kie.workbench.common.stunner.core.graph.Element) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Test(org.junit.Test)

Example 7 with BPMNDiagram

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

the class BaseDiagramMarshaller method getTitle.

private String getTitle(final Graph graph) {
    final Node<Definition<BPMNDiagram>, ?> diagramNode = getFirstDiagramNode(graph);
    final BPMNDiagram diagramBean = null != diagramNode ? (BPMNDiagram) ((Definition) diagramNode.getContent()).getDefinition() : null;
    return getTitle(diagramBean);
}
Also used : BPMNDiagram(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram) Definition(org.kie.workbench.common.stunner.core.graph.content.definition.Definition)

Aggregations

BPMNDiagram (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram)7 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)5 View (org.kie.workbench.common.stunner.core.graph.content.view.View)5 FlowElement (org.eclipse.bpmn2.FlowElement)4 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)4 RootElement (org.eclipse.bpmn2.RootElement)4 Test (org.junit.Test)4 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)4 Element (org.kie.workbench.common.stunner.core.graph.Element)4 Graph (org.kie.workbench.common.stunner.core.graph.Graph)4 DiagramSet (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet)3 ProcessVariables (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables)3 ArrayList (java.util.ArrayList)1 Package (org.guvnor.common.services.project.model.Package)1 Node (org.kie.workbench.common.stunner.core.graph.Node)1 Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)1 Pair (org.uberfire.commons.data.Pair)1