use of org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl in project kie-wb-common by kiegroup.
the class AssignmentsEditorWidget method getProcessVariables.
protected String getProcessVariables() {
Diagram diagram = canvasSessionManager.getCurrentSession().getCanvasHandler().getDiagram();
Iterator<Element> it = diagram.getGraph().nodes().iterator();
while (it.hasNext()) {
Element element = it.next();
if (element.getContent() instanceof View) {
Object oDefinition = ((View) element.getContent()).getDefinition();
if (oDefinition instanceof BPMNDiagramImpl) {
BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) oDefinition;
ProcessVariables variables = bpmnDiagram.getProcessData().getProcessVariables();
if (variables != null) {
return variables.getValue();
}
break;
}
}
}
return null;
}
use of org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl 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);
}
use of org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl in project kie-wb-common by kiegroup.
the class RootProcessConverter method convertProcessNode.
private BpmnNode convertProcessNode(String id, Process process) {
Node<View<BPMNDiagramImpl>, Edge> diagramNode = factoryManager.newNode(id, BPMNDiagramImpl.class);
BPMNDiagramImpl definition = diagramNode.getContent().getDefinition();
ProcessPropertyReader e = propertyReaderFactory.of(process);
definition.setDiagramSet(new DiagramSet(new Name(process.getName()), new Documentation(e.getDocumentation()), new Id(process.getId()), new Package(e.getPackage()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Executable(process.isIsExecutable())));
definition.setProcessData(new ProcessData(new ProcessVariables(e.getProcessVariables())));
diagramNode.getContent().setBounds(e.getBounds());
definition.setFontSet(e.getFontSet());
definition.setBackgroundSet(e.getBackgroundSet());
return BpmnNode.of(diagramNode);
}
use of org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallProcessVariables.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallProcessVariables() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_PROCESSVARIABLES);
assertDiagram(diagram, 8);
assertEquals("ProcessVariables", diagram.getMetadata().getTitle());
ProcessVariables variables = 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;
variables = bpmnDiagram.getProcessData().getProcessVariables();
break;
}
}
}
assertEquals(variables.getValue(), "employee:java.lang.String,reason:java.lang.String,performance:java.lang.String");
Node<? extends Definition, ?> diagramNode = diagram.getGraph().getNode("_luRBMdEjEeWXpsZ1tNStKQ");
assertTrue(diagramNode.getContent().getDefinition() instanceof BPMNDiagram);
BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) diagramNode.getContent().getDefinition();
assertTrue(bpmnDiagram.getProcessData() != null);
assertTrue(bpmnDiagram.getProcessData().getProcessVariables() != null);
variables = bpmnDiagram.getProcessData().getProcessVariables();
assertEquals(variables.getValue(), "employee:java.lang.String,reason:java.lang.String,performance:java.lang.String");
}
use of org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest 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.TRUE, diagramProperties.getExecutable().getValue());
assertEquals(Boolean.TRUE, diagramProperties.getAdHoc().getValue());
assertEquals("This is the\n" + "Process\n" + "Instance\n" + "Description", diagramProperties.getProcessInstanceDescription().getValue());
}
Aggregations