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());
}
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());
}
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());
}
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;
}
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;
}
Aggregations