use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet 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.property.diagram.DiagramSet 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.property.diagram.DiagramSet 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());
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet in project kie-wb-common by kiegroup.
the class BPMNProjectDiagramFactoryImpl method updateDiagramProperties.
@Override
protected void updateDiagramProperties(final String name, final Node<Definition<BPMNDiagram>, ?> diagramNode, final ProjectMetadata metadata) {
super.updateDiagramProperties(name, diagramNode, metadata);
// Set kie related properties for the current project.
final BPMNDiagram diagram = diagramNode.getContent().getDefinition();
final DiagramSet diagramSet = diagram.getDiagramSet();
final String id = diagramSet.getId().getValue();
if (id == null || id.isEmpty()) {
final String projectName = null != metadata.getModuleName() ? metadata.getModuleName() + "." : "";
diagramSet.getId().setValue(projectName + name);
}
final String p = diagramSet.getPackageProperty().getValue();
if (p == null || p.isEmpty()) {
final Package metadataPackage = metadata.getProjectPackage();
final String value = metadataPackage == null ? org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Package.DEFAULT_PACKAGE : metadata.getProjectPackage().getPackageName();
diagramSet.getPackageProperty().setValue(value);
}
final String diagramName = diagramSet.getName().getValue();
if (null == diagramName || diagramName.isEmpty()) {
diagramSet.getName().setValue(name);
}
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet 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());
}
Aggregations