Search in sources :

Example 1 with BaseDiagramSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.BaseDiagramSet 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)

Example 2 with BaseDiagramSet

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

the class DefinitionsConverter method toDefinitions.

public Definitions toDefinitions() {
    Definitions definitions = bpmn2.createDefinitions();
    DefinitionsPropertyWriter p = propertyWriterFactory.of(definitions);
    ProcessPropertyWriter pp = processConverter.convertProcess();
    Node<Definition<BPMNDiagram>, ?> node = converterFactory.context.firstNode();
    BPMNDiagram definition = node.getContent().getDefinition();
    BaseDiagramSet diagramSet = definition.getDiagramSet();
    p.setExporter("jBPM Process Modeler");
    p.setExporterVersion("2.0");
    p.setProcess(pp.getProcess());
    p.setDiagram(pp.getBpmnDiagram());
    p.setRelationship(pp.getRelationship());
    p.setWSDLImports(diagramSet.getImports().getValue().getWSDLImports());
    p.addAllRootElements(pp.getItemDefinitions());
    p.addAllRootElements(pp.getRootElements());
    p.addAllRootElements(pp.getInterfaces());
    return definitions;
}
Also used : BPMNDiagram(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram) BaseDiagramSet(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.BaseDiagramSet) Definitions(org.eclipse.bpmn2.Definitions) DefinitionsPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.DefinitionsPropertyWriter) Definition(org.kie.workbench.common.stunner.core.graph.content.definition.Definition) ProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter)

Example 3 with BaseDiagramSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.BaseDiagramSet 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) {
    // Set kie related properties for the current project.
    final BPMNDiagram diagram = diagramNode.getContent().getDefinition();
    final BaseDiagramSet 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(createValidId(projectName) + createValidId(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);
    }
    super.updateDiagramProperties(name, diagramNode, metadata);
}
Also used : BPMNDiagram(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram) BaseDiagramSet(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.BaseDiagramSet) Package(org.guvnor.common.services.project.model.Package)

Aggregations

BPMNDiagram (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram)3 BaseDiagramSet (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.BaseDiagramSet)3 ProcessPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter)2 Definitions (org.eclipse.bpmn2.Definitions)1 Process (org.eclipse.bpmn2.Process)1 Package (org.guvnor.common.services.project.model.Package)1 DefinitionsPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.DefinitionsPropertyWriter)1 CaseFileVariables (org.kie.workbench.common.stunner.bpmn.definition.property.cm.CaseFileVariables)1 CaseIdPrefix (org.kie.workbench.common.stunner.bpmn.definition.property.cm.CaseIdPrefix)1 CaseRoles (org.kie.workbench.common.stunner.bpmn.definition.property.cm.CaseRoles)1 BaseProcessData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.BaseProcessData)1 BaseRootProcessAdvancedData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.BaseRootProcessAdvancedData)1 Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)1