This project has two components:
See also: Camunda Team Blog: Converting Excel Worksheets to DMN
See also: Added support for a new "advanced" detection strategy #8
java -jar dmn-xlsx-cli-0.2.0.jar --inputs A,B,C --outputs D,E,F path/to/input/file.xlsx path/to/output/file.dmn
. Note that this example assumes the columns A, B, and C are inputs and D, E, F are outputs. You can set these as you like.To use the Java library, add the following Maven dependency to your project:
<dependency>
<groupId>org.camunda.bpm.extension.dmn</groupId>
<artifactId>dmn-xlsx-converter</artifactId>
<version>0.2.0</version>
</dependency>
InputStream xlsxInputStream = ...; // open xlsx file here
// convert
XlsxConverter converter = new XlsxConverter();
DmnModelInstance dmnModelInstance = converter.convert(inputStream);
// write
OutputStream dmnOutputStream = ...; // open outputstream to file here
Dmn.writeModelToStream(dmnOutputStream, dmnModelInstance);
The class org.camunda.bpm.dmn.xlsx.XlsxConverter
has bean properties that allow configuration of the conversion process. These are:
ioDetectionStrategy
: An instance of org.camunda.bpm.dmn.xlsx.InputOutputDetectionStrategy
. The default strategy assumes that all but the last column of the worksheet are inputs and the last column is an output. An instance of org.camunda.bpm.dmn.xlsx.StaticInputOutputDetectionStrategy
can be set to define a static set of input and output columns. Custom strategies can be implemented by implementing the interface InputOutputDetectionStrategy
.The process engine artifact can be obtained via the following Maven coordinates:
<dependency>
<groupId>org.camunda.bpm.extension.dmn</groupId>
<artifactId>dmn-xlsx-process-engine-plugin</artifactId>
<version>0.2.0</version>
</dependency>
Make sure to make the resulting org.camunda.bpm.dmn:dmn-xlsx-process-engine-plugin
artifact available on the process engine's classpath. Then configure the class org.camunda.bpm.xlsx.plugin.XlsxDmnProcessEnginePlugin
as a process engine plugin.
With the plugin in place, xlsx files can be included in a deployment and are automatically recognized and converted into DMN XML at deployment time. To configure conversion for a file <name>.xlsx
, a file <name>.xlsx.yaml
can be included in the deployment. Example yaml contents:
---
inputs: ['A', 'B']
outputs: ['C', 'E']
This declares that the columns A and B are inputs of the decision and C and E are outputs.
Apache License 2.0.
Contributions are welcome at any time. Use github issues to discuss missing features or report bugs, and pull requests to contribute code.