camunda-codegen v0.0.8
CodeGen
This project generates Java code for the Camunda workflow engine based on BPMN.
The project is a work in progress. The way the generator will work is going to change through time.
Status
Currently, the generator can generate:
- Java code from User Tasks, Service Tasks and DTO's from their input and output.
- PDFs that contain all User Tasks and Service Tasks, including their properties and incoming and outgoing flows.
Install
There are two ways of using the generation tool:
- Install
camunda-codegen
globally withnpm install -g camunda-codegen
and then usecamunda-codegen
in the commandline. - Use NPX to use the generator without having to install it globally.
npx camunda-codegen
. NPX is installed together with NPM, by default!
In this README, we'll be using the NPX way.
Usage
To start the generator without arguments, simply run npx camunda-codegen
in the terminal.
To input a BPMN model right away, use the bpmn argument like this, provided with a path to your BPMN model:
npx camunda-codegen --bpmn=./examplemodel.bpmn
The generator also supports absolute paths.
Arguments
This section contains all arguments that can be used when starting the program.
bpmn
Lets you input the path to a BPMN file. For example:
npx camunda-codegen --bpmn=./examplemodel.bpmn
cfg / config
Lets you input a custom config that will overwrite the default values. For example:
npx camunda-codegen --config=C:/codegenconfigs/javagenconfig.yml
hlp
Shows a help menu with all possible flags:
npx camunda-codegen --hlp
Configuration
The generator bases decisions on a default configuration YML file. This configuration can be overwritten by using the cfg or config argument. By default, it uses the following configuration:
java:
generate: true
package: com.codegen
outputPath: ./generated/java
pdf:
generate: true
outputPath: ./generated/pdf
log:
console: info
file: error
outputPath: ./logs
logFileName: codegen.log
Edit any options and use the cfg or config argument to overwrite the default configuration.
Logging levels
This project uses Winston. To change the default logging levels, create a config and choose one of the texts from the following levels.
NOTE: A logging level will also log all the levels that are lower than itself. For example, http
will also show info, warn and error
logs.
error: 0,
warn: 1,
info: 2,
http: 3,
verbose: 4,
debug: 5,
silly: 6
Future work
- Generate Unit Tests for the generated code.
- Extend Camunda Modeler input/output with types so typed DTO's can be generated.