Giter Club home page Giter Club logo

camunda-bpmn-model's Introduction

camunda BPMN model API

The camunda BPMN model API is a simple, lightweight Java library for parsing, creating and editing BPMN 2.0 XML files. It is licensed under the Apache 2.0 license.

Note

camunda BPMN model can be used standalone, independenly of camunda BPM platform / process engine.

Features

Fluent builder API

To easily create simple BPMN 2.0 processes we provide the fluent builder API. It supports most BPMN 2.0 elements and allows you to set attributes and add some child elements. The following process is deployable and can be executed by the camunda BPM platform.

BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("processId")
  .startEvent()
  .userTask()
  .endEvent()
  .done();

For more complex examples see the docs, the tests in ProcessBuilderTest.java or this example.

Create an empty BPMN model

You can easily create a new empty BPMN model.

BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
definitions.setTargetNamespace("http://camunda.org/examples");
modelInstance.setDefinitions(definitions);

Validate a BPMN model

At any time you can validate your model against the BPMN 2.0 specification.

BpmnModelInstance modelInstance = [...]
Bpmn.validateModel(modelInstance);

Creating a Process using the full API

The fluent API is usually a good choice for creating a new BPMN process. However, not all elements supported by the model are exposed through fluent builders and the fluent api may not be the appropriate API style for all usecases. In such cases, the full API can be used for creating a process model. The following code creates a simple Process as a jUnit4 test using the full API: CreateModelTest.java.

Find elements inside the model

// find element instance by ID
ModelElementInstance elementInstance = modelInstance.getModelElementById("start");

// find all elements of the type task
ModelElementType taskType = modelInstance.getModel().getType(Task.class);
Collection<ModelElementInstance> elementInstances = modelInstance.getModelElementsByType(taskType);

Save the BPMN model

The model API allows you to save your model in several ways

// create BPMN model
BpmnModelInstance modelInstance = [...]

// convert to string
String xmlString = Bpmn.convertToString(modelInstance);

// write to output stream
OutputStream outputStream = new OutputStream(...);
Bpmn.writeModelToStream(outputStream, modelInstance);

// write to file
File file = new File(...);
Bpmn.writeModelToFile(file, modelInstance);

Planned features

  • extended validation support like integrity checks for broken references

FAQ

What is BPMN 2.0?

Which Java (JRE) Version is required?

Java JRE 1.6+ is required. We test camunda BPMN model API on Oracle and IBM JVMs.

Under which License is camunda BPMN model API distributed?

Apache License 2.0.

Does this API support all BPMN 2.0 Elements?

No, but support is already quite extensive. See org.camunda.bpm.model.bpmn.instance for a list of currently supported elements.

camunda-bpmn-model's People

Contributors

berndruecker avatar dario-campagna avatar deivarayanazhagappan avatar falko avatar filiphr avatar hawky-4s- avatar koevskinikola avatar menski avatar meyerdan avatar pazolka avatar piccinin-esteco avatar polenz avatar rbraeunlich avatar roboticbird avatar romansmirnov avatar saig0 avatar sdorokhova avatar thorbenlindhauer avatar yanavasileva avatar zelldon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.