All Projects → holunda-io → camunda-bpm-data

holunda-io / camunda-bpm-data

Licence: Apache-2.0 License
Beautiful process data handling for Camunda BPM.

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to camunda-bpm-data

micronaut-camunda-bpm
Integration between Micronaut and Camunda (Workflow Engine). We configure Camunda with sensible defaults, so that you can get started with minimum configuration: simply add a dependency in your Micronaut project to embed the workflow engine!
Stars: ✭ 73 (+204.17%)
Mutual labels:  process, bpm, camunda
micronaut-camunda-external-client
This open source project allows you to easily integrate Camunda's External Task Clients into Micronaut projects: simply add a dependency in your Micronaut project
Stars: ✭ 19 (-20.83%)
Mutual labels:  bpm, camunda
Workflower
A BPMN 2.0 workflow engine for PHP
Stars: ✭ 540 (+2150%)
Mutual labels:  process, bpm
workflower-bundle
A Symfony bundle for Workflower
Stars: ✭ 23 (-4.17%)
Mutual labels:  process, bpm
awesome-camunda
a curated list of awesome Camunda BPM projects, libraries, tools, documentations, forum posts, etc.
Stars: ✭ 93 (+287.5%)
Mutual labels:  bpm, camunda
camunda-prometheus-process-engine-plugin
Monitor your KPIs!!! Camunda BPM Process Engine Plugin providing Prometheus Monitoring, Metric classes for various BPMN use, Grafana Annotations, and HTTPServer data export: Used to generate Prometheus metrics anywhere in the Engine, including BPMN, CMN, and DMN engines and instances.
Stars: ✭ 48 (+100%)
Mutual labels:  bpm, camunda
codebase
The jBPT code library is a compendium of technologies that support research on design, execution, and evaluation of business processes. The library offers a broad range of basis analysis and utility functionality and, due to its open publishing model, can easily be extended.
Stars: ✭ 26 (+8.33%)
Mutual labels:  process
direct-access-py
Enverus Drillinginfo Direct Access Developer API Python Client
Stars: ✭ 30 (+25%)
Mutual labels:  data
PRUNE
Logs key Windows process performance metrics. #nsacyber
Stars: ✭ 56 (+133.33%)
Mutual labels:  process
vtenext
vtenext the CRM for the Digital Innovation. It allows you to engage your customers into your business processes using a specific technology. It can also be used to manage processes generated by internal customers.
Stars: ✭ 22 (-8.33%)
Mutual labels:  bpm
qual-o-mat-data
JSON data from Wahl-O-Mat
Stars: ✭ 39 (+62.5%)
Mutual labels:  data
open-datasets
Running list of Open Datasets
Stars: ✭ 21 (-12.5%)
Mutual labels:  data
xbpch
xarray interface for bpch files
Stars: ✭ 17 (-29.17%)
Mutual labels:  data
Process
Creation of Dynamic Dedicated WebWorkers, definition of dependencies, promise support.
Stars: ✭ 13 (-45.83%)
Mutual labels:  process
rsnps
Wrapper to a number of SNP web APIs
Stars: ✭ 44 (+83.33%)
Mutual labels:  data
fake-sandbox
👁‍🗨 This script will simulate fake processes of analysis sandbox/VM software that some malware will try to avoid.
Stars: ✭ 110 (+358.33%)
Mutual labels:  process
census-100-people
Census 2016: This is Australia as 100 people
Stars: ✭ 13 (-45.83%)
Mutual labels:  data
camunda-worker-dotnet
Ultimate solution to connect your ASP.NET Core application to Camunda external tasks
Stars: ✭ 53 (+120.83%)
Mutual labels:  camunda
async-pidfd
Rust crate to use process file descriptors (pidfd) for Linux
Stars: ✭ 42 (+75%)
Mutual labels:  process
Synthetic-data-gen
Various methods for generating synthetic data for data science and ML
Stars: ✭ 57 (+137.5%)
Mutual labels:  data

Build Status Maven Central CodeCov Codacy Changes gitter

Camunda BPM Data

Beautiful process data handling for Camunda BPM.

Why to use this library in every Camunda project

If you are a software engineer and run process automation projects in your company or on behalf of the customer based on Camunda Process Engine, you probably are familiar with process variables. Camunda offers an API to access them and thereby manipulate the state of the process execution - one of the core features during process automation.

Unfortunately, as a user of the Camunda API, you have to exactly know the variable type (so the Java class behind it). For example, if you store a String in a variable "orderId" you must extract it as a String in every piece of code. Since there is no code connection between the different code parts, but the BPMN process model orchestrates these snippets to a single process execution, it makes refactoring and testing of process automation projects error-prone and challenging.

This library helps you to overcome these difficulties and make access, manipulation and testing process variables really easy and convenient. We leverage the Camunda API and offer you not only a better API but also some additional features.

If you want to read more about data in Camunda processes, have a look on those articles:

Quick Introduction

Setup

If you just want to start using the library, put the following dependency into your project pom.xml:

<dependency>
  <groupId>io.holunda.data</groupId>
  <artifactId>camunda-bpm-data</artifactId>
  <version>1.2.3</version>
</dependency>

If you are using Gradle Kotlin DSL add to your build.gradle.kts:

implementation("io.holunda.data:camunda-bpm-data:1.2.3")

For Gradle Groovy DSL add to your build.gradle:

implementation 'io.holunda.data:camunda-bpm-data:1.2.3'

Variable declaration

Now your setup is completed, and you can declare your variables like this:

import io.holunda.camunda.bpm.data.factory.VariableFactory;
import static io.holunda.camunda.bpm.data.CamundaBpmData.*;

public class OrderApproval {
  public static final VariableFactory<String> ORDER_ID = stringVariable("orderId");
  public static final VariableFactory<Order> ORDER = customVariable("order", Order.class);
  public static final VariableFactory<Boolean> ORDER_APPROVED = booleanVariable("orderApproved");
  public static final VariableFactory<BigDecimal> ORDER_TOTAL = customVariable("orderTotal", BigDecimal.class);
  public static final VariableFactory<OrderPosition> ORDER_POSITION = customVariable("orderPosition", OrderPosition.class);
}

Variable access from Java Delegate

Finally, you want to access them from your Java delegates, Execution or Task Listeners or simple Java components:

public class MyDelegate implements JavaDelegate {
  @Override
  public void execute(DelegateExecution execution) {
    VariableReader reader = CamundaBpmData.reader(execution);
    OrderPosition orderPosition = reader.get(ORDER_POSITION);
    BigDecimal oldTotal = reader.getOptional(ORDER_TOTAL).orElse(BigDecimal.ZERO);

    BigDecimal newTotal = oldTotal.add(calculatePrice(orderPosition));
    ORDER_TOTAL.on(execution).setLocal(newTotal);
  }

  private BigDecimal calculatePrice(OrderPosition orderPosition) {
     return orderPosition.getNetCost().multiply(BigDecimal.valueOf(orderPosition.getAmount()));
  }
}

Variable access from REST Controller

Now imagine you are implementing a REST controller for a user task form which loads data from the process application, displays it, captures some input and sends that back to the process application to complete the user task. By doing so, you will usually need to access process variables. Here is an example:

@RestController
@RequestMapping("/task/approve-order")
public class ApproveOrderTaskController {

    private final TaskService taskService;

    public ApproveOrderTaskController(TaskService taskService) {
        this.taskService = taskService;
    }

    @GetMapping("/{taskId}")
    public ResponseEntity<ApproveTaskDto> loadTask(@PathVariable("taskId") String taskId) {
        Order order = ORDER.from(taskService, taskId).get();
        return ResponseEntity.ok(new ApproveTaskDto(order));
    }

    @PostMapping("/{taskId}")
    public ResponseEntity<Void> completeTask(@PathVariable("taskId") String taskId, @RequestBody ApproveTaskCompleteDto userInput) {
        VariableMap vars = CamundaBpmData.builder()
            .set(ORDER_APPROVED, userInput.getApproved())
            .build();
        taskService.complete(taskId, vars);
        return ResponseEntity.noContent().build();
    }
}

Testing correct variable access

If you want to write the test for the REST controller, you will need to stub the task service and verify that the correct variables has been set. To simplify these tests, we created an additional library module camunda-bpm-data-test. Please put the following dependency into your pom.xml:

<dependency>
  <groupId>io.holunda.data</groupId>
  <artifactId>camunda-bpm-data-test</artifactId>
  <version>1.2.2</version>
  <scope>test</scope>
</dependency>

Now you can use TaskServiceVariableMockBuilder to stub correct behavior of Camunda Task Service and TaskServiceVerifier to verify the correct access to variables easily. Here is the JUnit test of the REST controller above, making use of camunda-bpm-data-test.

public class ApproveOrderTaskControllerTest {

    private static Order order = new Order("ORDER-ID-1", new Date(), new ArrayList<>());
    private TaskService taskService = mock(TaskService.class);
    private TaskServiceMockVerifier verifier = taskServiceMockVerifier(taskService);
    private ApproveOrderTaskController controller = new ApproveOrderTaskController(taskService);
    private String taskId;

    @Before
    public void prepareTest() {
        reset(taskService);
        taskId = UUID.randomUUID().toString();
    }

    @Test
    public void testLoadTask() {
        // given
        taskServiceVariableMockBuilder(taskService).initial(ORDER, order).build();
        // when
        ResponseEntity<ApproveTaskDto> responseEntity = controller.loadTask(taskId);
        // then
        assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
        assertThat(responseEntity.getBody()).isEqualTo(new ApproveTaskDto(order));
        verifier.verifyGet(ORDER, taskId);
        verifier.verifyNoMoreInteractions();
    }

    @Test
    public void testCompleteTask() {
        // when
        ApproveTaskCompleteDto response = new ApproveTaskCompleteDto(true);
        ResponseEntity<Void> responseEntity = controller.completeTask(taskId, response);
        // then
        assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
        verifier.verifyComplete(builder().set(ORDER_APPROVED, response.getApproved()).build(), taskId);
        verifier.verifyNoMoreInteractions();
    }
}

Further documentation

For further details, please consult our Quick Start guide or have a look to our primary documentation - the User Guide

Working Example

We prepared some typical usage scenarios and implemented two example projects in Java and Kotlin. See our Examples section for usage and configuration.

License

Apache License 2

This library is developed under Apache 2.0 License.

Contribution

If you want to contribute to this project, feel free to do so. Start with Contributing guide.

Maintainer

zambrovski jangalinski christian-maschmann stefanzilske nernsting pschalk srsp
zambrovski jangalinski christian-maschmann stefanzilske nernsting pschalk srsp
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].