Search in sources :

Example 6 with ProcessPropertyWriter

use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter in project kie-wb-common by kiegroup.

the class ProcessConverterDelegateTest method convertDockedEdges.

@Test
public void convertDockedEdges() {
    GraphNodeStoreImpl nodes = new GraphNodeStoreImpl();
    GraphImpl g = new GraphImpl("g", nodes);
    NodeImpl<Object> root = new NodeImpl<>("root");
    BPMNDiagramImpl bpmnDiagram = new BPMNDiagramImpl();
    root.setContent(new ViewImpl<>(bpmnDiagram, Bounds.create()));
    g.addNode(root);
    NodeImpl<Object> n = new NodeImpl<>("n");
    EmbeddedSubprocess subProcessNode = new EmbeddedSubprocess();
    n.setContent(new ViewImpl<>(subProcessNode, Bounds.create()));
    g.addNode(n);
    NodeImpl<Object> e = new NodeImpl<>("e");
    IntermediateErrorEventCatching intermediateErrorEventCatching = new IntermediateErrorEventCatching();
    e.setContent(new ViewImpl<>(intermediateErrorEventCatching, Bounds.create()));
    g.addNode(e);
    EdgeImpl<Object> edge = new EdgeImpl<>("edge");
    Dock dock = new Dock();
    edge.setContent(dock);
    n.getOutEdges().add(edge);
    edge.setSourceNode(n);
    e.getInEdges().add(edge);
    edge.setTargetNode(e);
    DefinitionsBuildingContext ctx = new DefinitionsBuildingContext(g);
    PropertyWriterFactory pwFactory = new PropertyWriterFactory();
    ConverterFactory factory = new ConverterFactory(ctx, pwFactory);
    MyProcessConverter abstractProcessConverter = new MyProcessConverter(factory);
    ProcessPropertyWriter p = pwFactory.of(bpmn2.createProcess());
    assertThatCode(() -> {
        abstractProcessConverter.convertChildNodes(p, ctx);
        abstractProcessConverter.convertEdges(p, ctx);
    }).doesNotThrowAnyException();
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) EdgeImpl(org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl) DefinitionsBuildingContext(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsBuildingContext) ConverterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.ConverterFactory) ProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter) PropertyWriterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriterFactory) GraphNodeStoreImpl(org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl) Dock(org.kie.workbench.common.stunner.core.graph.content.relationship.Dock) IntermediateErrorEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateErrorEventCatching) GraphImpl(org.kie.workbench.common.stunner.core.graph.impl.GraphImpl) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) ArgumentMatchers.anyObject(org.mockito.ArgumentMatchers.anyObject) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) Test(org.junit.Test)

Example 7 with ProcessPropertyWriter

use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter in project kie-wb-common by kiegroup.

the class RootProcessConverterTest method convertProcessWithGlobalVariables.

@Test
public void convertProcessWithGlobalVariables() {
    final ProcessPropertyWriter propertyWriter = converter.convertProcess();
    verify(propertyWriter).setGlobalVariables(any(GlobalVariables.class));
}
Also used : GlobalVariables(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.GlobalVariables) ProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter) Test(org.junit.Test)

Example 8 with ProcessPropertyWriter

use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter in project kie-wb-common by kiegroup.

the class RootProcessConverterTest method convertProcessWithCaseProperties.

@Test
public void convertProcessWithCaseProperties() {
    final ProcessPropertyWriter propertyWriter = converter.convertProcess();
    verify(propertyWriter).setCaseIdPrefix(caseIdPrefix);
    verify(propertyWriter).setCaseRoles(caseRoles);
    verify(propertyWriter).setCaseFileVariables(caseFileVariables);
}
Also used : ProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter) Test(org.junit.Test)

Example 9 with ProcessPropertyWriter

use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter in project kie-wb-common by kiegroup.

the class RootProcessConverterTest method convertProcessWithExecutable.

@Test
public void convertProcessWithExecutable() {
    final ProcessPropertyWriter propertyWriter = converter.convertProcess();
    verify(propertyWriter).setExecutable(anyBoolean());
}
Also used : ProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter) Test(org.junit.Test)

Example 10 with ProcessPropertyWriter

use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter in project kie-wb-common by kiegroup.

the class RootProcessConverter method convertProcessNode.

private ProcessPropertyWriter convertProcessNode(Node<Definition<BPMNDiagram>, ?> node) {
    Process process = bpmn2.createProcess();
    BPMNDiagram definition = node.getContent().getDefinition();
    ProcessPropertyWriter p = propertyWriterFactory.of(process);
    BaseDiagramSet diagramSet = definition.getDiagramSet();
    p.setName(replaceIllegalCharsAttribute(diagramSet.getName().getValue()));
    p.setDocumentation(diagramSet.getDocumentation().getValue());
    p.setId(replaceIllegalCharsAttribute(diagramSet.getId().getValue()));
    p.setPackage(diagramSet.getPackageProperty().getValue());
    p.setType(diagramSet.getProcessType().getValue());
    p.setVersion(diagramSet.getVersion().getValue());
    p.setAdHoc(diagramSet.getAdHoc().getValue());
    p.setDescription(diagramSet.getProcessInstanceDescription().getValue());
    p.setDefaultImports(diagramSet.getImports().getValue().getDefaultImports());
    p.setExecutable(diagramSet.getExecutable().getValue());
    p.setSlaDueDate(diagramSet.getSlaDueDate());
    BaseProcessData processData = definition.getProcessData();
    p.setProcessVariables(processData.getProcessVariables());
    BaseRootProcessAdvancedData advancedData = definition.getAdvancedData();
    p.setGlobalVariables(advancedData.getGlobalVariables());
    p.setMetaData(advancedData.getMetaDataAttributes());
    // Case Management
    final CaseIdPrefix caseIdPrefix = definition.getCaseManagementSet().getCaseIdPrefix();
    p.setCaseIdPrefix(caseIdPrefix);
    final CaseRoles caseRoles = definition.getCaseManagementSet().getCaseRoles();
    p.setCaseRoles(caseRoles);
    final CaseFileVariables caseFileVariables = definition.getCaseManagementSet().getCaseFileVariables();
    p.setCaseFileVariables(caseFileVariables);
    return p;
}
Also used : BPMNDiagram(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram) CaseFileVariables(org.kie.workbench.common.stunner.bpmn.definition.property.cm.CaseFileVariables) BaseDiagramSet(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.BaseDiagramSet) CaseRoles(org.kie.workbench.common.stunner.bpmn.definition.property.cm.CaseRoles) BaseProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.BaseProcessData) Process(org.eclipse.bpmn2.Process) ProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter) BaseRootProcessAdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.BaseRootProcessAdvancedData) CaseIdPrefix(org.kie.workbench.common.stunner.bpmn.definition.property.cm.CaseIdPrefix)

Aggregations

ProcessPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter)12 Test (org.junit.Test)8 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)3 Process (org.eclipse.bpmn2.Process)2 ConverterFactory (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.ConverterFactory)2 DefinitionsBuildingContext (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsBuildingContext)2 PropertyWriterFactory (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriterFactory)2 BPMNDiagram (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram)2 EmbeddedSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess)2 IntermediateErrorEventCatching (org.kie.workbench.common.stunner.bpmn.definition.IntermediateErrorEventCatching)2 BaseDiagramSet (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.BaseDiagramSet)2 Dock (org.kie.workbench.common.stunner.core.graph.content.relationship.Dock)2 EdgeImpl (org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl)2 GraphImpl (org.kie.workbench.common.stunner.core.graph.impl.GraphImpl)2 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)2 GraphNodeStoreImpl (org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl)2 ArgumentMatchers.anyObject (org.mockito.ArgumentMatchers.anyObject)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Optional (java.util.Optional)1