Skip to content

Commit

Permalink
feature: [converter/core] Export converter version (#392)
Browse files Browse the repository at this point in the history
* Add version to transformed diagram

* Add version to transformed diagram
  • Loading branch information
jonathanlukas authored Sep 8, 2023
1 parent c475b42 commit 3d0d65e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public BpmnDiagramCheckResult check(
LOG.info("Start check");
BpmnDiagramCheckResult result = new BpmnDiagramCheckResult();
result.setFilename(filename);
result.setConverterVersion(getClass().getPackage().getImplementationVersion());
BpmnDiagramCheckContext context = new BpmnDiagramCheckContext();
traverse(modelInstance.getDocument().getRootElement(), result, context, properties);
LOG.info("Done check");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
public class BpmnDiagramCheckResult {
private final List<BpmnElementCheckResult> results = new ArrayList<>();
private String filename;
private String converterVersion;

public String getConverterVersion() {
return converterVersion;
}

public void setConverterVersion(String converterVersion) {
this.converterVersion = converterVersion;
}

public List<BpmnElementCheckResult> getResults() {
return results;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.camunda.community.migration.converter.visitor.impl;

import static org.camunda.community.migration.converter.NamespaceUri.*;

import java.util.function.Consumer;
import org.camunda.bpm.model.xml.instance.DomElement;
import org.camunda.community.migration.converter.DomElementVisitorContext;
Expand All @@ -13,6 +15,7 @@
public class DefinitionsVisitor extends AbstractBpmnElementVisitor {
private static final String VERSION_HEADER = "executionPlatformVersion";
private static final String PLATFORM_HEADER = "executionPlatform";
private static final String CONVERTER_VERSION_HEADER = "converterVersion";
private static final String PLATFORM_VALUE = "Camunda Cloud";
private static final String ZEEBE_NAMESPACE_NAME = "zeebe";
private static final String CONVERSION_NAMESPACE_NAME = "conversion";
Expand All @@ -36,9 +39,11 @@ protected void visitBpmnElement(DomElementVisitorContext context) {
// }
element.registerNamespace(MODELER_NAMESPACE_NAME, NamespaceUri.MODELER);
element.registerNamespace(ZEEBE_NAMESPACE_NAME, NamespaceUri.ZEEBE);
element.registerNamespace(CONVERSION_NAMESPACE_NAME, NamespaceUri.CONVERSION);
element.registerNamespace(CONVERSION_NAMESPACE_NAME, CONVERSION);
element.setAttribute(NamespaceUri.MODELER, PLATFORM_HEADER, PLATFORM_VALUE);
element.setAttribute(NamespaceUri.MODELER, VERSION_HEADER, desiredVersion.toString());
element.setAttribute(
CONVERSION, CONVERTER_VERSION_HEADER, getClass().getPackage().getImplementationVersion());
}

private void setNamespace(Node root, String oldPrefix) {
Expand Down

0 comments on commit 3d0d65e

Please sign in to comment.