Skip to content

Commit

Permalink
JBPM-8317 - Process to executable model dumper
Browse files Browse the repository at this point in the history
  • Loading branch information
mswiderski committed Mar 14, 2019
1 parent acef2a0 commit d7e8d7c
Show file tree
Hide file tree
Showing 28 changed files with 1,343 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ bin/
# files used for external db testing
jdbc_driver.jar
db-settings.xml

quarkus.log
34 changes: 34 additions & 0 deletions jbpm-quarkus-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
bin/
/target
/local

# Eclipse, Netbeans and IntelliJ files
/.*
!.gitignore
/nbproject
/*.ipr
/*.iws
/*.iml

# Repository wide ignore mac DS_Store files
.DS_Store

# Original jbpm ignores
*~

# Test info
/settings*.xml
/lib-jdbc/
*.db
*.tlog

# modules that don't exist in this branch
/jbpm-human-task-war/
/jbpm-bam/
/jbpm-gwt/

# files used for external db testing
jdbc_driver.jar
db-settings.xml

quarkus.log
69 changes: 69 additions & 0 deletions jbpm-quarkus-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# jBPM + Quarkus example

## Installing and Running

- Prerequisites: build locally submarine-bom and submarine-runtimes


- Compile and Run

```
mvn clean compile quarkus:dev
```

- Native Image (requires JAVA_HOME to point to a valid GraalVM)

```
mvn clean package -Pnative
```

native executable (and runnable jar) generated in `target/`

## Swagger documentation

Point to [swagger docs](http://localhost:8080/docs/swagger.json) to retrieve swagger definition of the exposed service

You can visualize that JSON file at [swagger editor](https://editor.swagger.io)

In addition client application can be easily generated from the swagger definition to interact with this service.

## Examples

### post /orders

Allows to create new orders with following sample command

```sh
curl -d '{"approver" : "john", "order" : {"orderNumber" : "12345", "shipped" : false}}' -H "Content-Type: application/json" \
-X POST http://localhost:8080/orders
```

As response the updated order is returned.

### get /orders

Returns list of orders currently active with following command

```sh
curl -H "Accept: application/json" -X GET http://localhost:8080/orders
```

As response array of orders is returned

### get /orders/{id}

Returns specified order active following command

```sh
curl -H "Accept: application/json" -X GET http://localhost:8080/orders/1
```

As response single order is returned if found otherwise no content (204)

### delete /orders/{id}

Cancels specified order with following command

```sh
curl -H "Accept: application/json" -X DELETE http://localhost:8080/orders/1
```
153 changes: 153 additions & 0 deletions jbpm-quarkus-example/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.submarine.examples</groupId>
<artifactId>jbpm-quarkus-example</artifactId>
<version>1.0.0</version>
<packaging>kjar</packaging>

<name>jBPM example running on Quarkus</name>
<description>Order management service</description>

<properties>
<quarkus.version>0.11.0</quarkus.version>
<submarine.version>8.0.0-SNAPSHOT</submarine.version>
<swagger.version>1.5.9</swagger.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bom</artifactId>
<version>${quarkus.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jsonb</artifactId>
</dependency>

<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${submarine.version}</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow</artifactId>
<version>${submarine.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>${submarine.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>io.openapitools.swagger</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<configuration>
<resourcePackages>
<resourcePackage>com.myspace.demo</resourcePackage>
</resourcePackages>
<outputDirectory>${basedir}/target/classes/META-INF/resources/docs/</outputDirectory>
<outputFilename>swagger</outputFilename>
<outputFormats>JSON</outputFormats>
<prettyPrint>true</prettyPrint>
<swaggerConfig>
<info>
<title>${project.description}</title>
<version>${project.version}</version>
</info>
</swaggerConfig>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${submarine.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${submarine.version}</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow</artifactId>
<version>${submarine.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<configuration>
<enableHttpUrlHandler>true</enableHttpUrlHandler>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Empty file.
Empty file.
53 changes: 53 additions & 0 deletions jbpm-quarkus-example/src/main/java/com/myspace/demo/Order.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.myspace.demo;

/**
* This class was automatically generated by the data modeler tool.
*/

public class Order implements java.io.Serializable {

static final long serialVersionUID = 1L;

private java.lang.String orderNumber;
private java.lang.Boolean shipped;
private java.lang.Double total;

public Order() {
}

public java.lang.String getOrderNumber() {
return this.orderNumber;
}

public void setOrderNumber(java.lang.String orderNumber) {
this.orderNumber = orderNumber;
}

public java.lang.Boolean getShipped() {
return this.shipped;
}

public void setShipped(java.lang.Boolean shipped) {
this.shipped = shipped;
}

public java.lang.Double getTotal() {
return this.total;
}

public void setTotal(java.lang.Double total) {
this.total = total;
}

public Order(java.lang.String orderNumber, java.lang.Boolean shipped,
java.lang.Double total) {
this.orderNumber = orderNumber;
this.shipped = shipped;
this.total = total;
}

public String toString() {
return "Order[" + this.orderNumber + "]";
}

}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<kmodule xmlns="http://www.drools.org/xsd/kmodule" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
Empty file.

0 comments on commit d7e8d7c

Please sign in to comment.