Skip to content

Commit

Permalink
Merge pull request #184 from holunda-io/feature/local-polyflow
Browse files Browse the repository at this point in the history
Feature/local polyflow
  • Loading branch information
zambrovski authored Apr 12, 2023
2 parents d60e019 + 23084b9 commit 36c64bc
Show file tree
Hide file tree
Showing 46 changed files with 906 additions and 679 deletions.
156 changes: 45 additions & 111 deletions components/approval/backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
<name>examples/${project.artifactId}</name>

<properties>
<rest.api.location>src/main/api</rest.api.location>
<rest.api.base-package>io.holunda.polyflow.example.process.approval.rest</rest.api.base-package>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

Expand All @@ -24,6 +22,15 @@
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-camunda-bpm-springboot-starter</artifactId>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-camunda-bpm-engine-client</artifactId>
</dependency>
<dependency>
<groupId>io.holunda</groupId>
<artifactId>camunda-platform-7-autologin</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-users</artifactId>
Expand Down Expand Up @@ -56,54 +63,19 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<!-- Axon -->
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<!--<scope>test</scope>-->
</dependency>

<!-- Camunda Scripting-->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-datetime</artifactId>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-jmx</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-json</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-jsr223</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-macro</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-nio</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-templates</artifactId>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.1.1</version>
</dependency>
<!-- Axon -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-xml</artifactId>
<groupId>org.axonframework</groupId>
<artifactId>axon-spring-boot-starter</artifactId>
</dependency>
<!-- Data -->
<dependency>
Expand Down Expand Up @@ -147,6 +119,10 @@
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-kotlin</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
Expand All @@ -156,28 +132,9 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-openapi-ignore</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/openapi</outputDirectory>
<resources>
<resource>
<directory>${rest.api.location}</directory>
<includes>
<include>.openapi-generator-ignore</include>
<include>openapi.yml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>

<!-- Enforce resource copy -->
<!-- This is a fix of Kotlin incremental Compiler bug -->
<!-- See https://discuss.kotlinlang.org/t/kotlin-compiler-incremental-not-copying-resources/5640/5 -->
Expand Down Expand Up @@ -209,23 +166,29 @@
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.build.directory}/generated-sources/openapi/openapi.yml</inputSpec>
<generatorName>spring</generatorName>
<apiPackage>${rest.api.base-package}.api</apiPackage>
<modelPackage>${rest.api.base-package}.model</modelPackage>
<inputSpec>${project.basedir}/src/main/api/openapi.yml</inputSpec>
<ignoreFileOverride>${basedir}/src/main/api/.openapi-generator-ignore</ignoreFileOverride>
<generatorName>kotlin-spring</generatorName>
<library>spring-boot</library>
<modelNamePrefix/>
<modelNameSuffix>Dto</modelNameSuffix>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<skipIfSpecIsUnchanged>true</skipIfSpecIsUnchanged>

<apiPackage>io.holunda.polyflow.example.process.approval.rest.api</apiPackage>
<modelPackage>io.holunda.polyflow.example.process.approval.rest.model</modelPackage>
<configOptions>
<sourceFolder>src/main/java</sourceFolder>
<basePackage>${rest.api.base-package}</basePackage>
<configPackage>${rest.api.base-package}</configPackage>
<interfaceOnly>true</interfaceOnly>
<dateLibrary>java8</dateLibrary>
<swaggerDocketConfig>false</swaggerDocketConfig>
<reactive>false</reactive>
<bigDecimalAsString>true</bigDecimalAsString>
<useOptional>true</useOptional>
<useBeanValidation>true</useBeanValidation>
<delegatePattern>true</delegatePattern>
<!--
<swaggerAnnotations>true</swaggerAnnotations>
<exceptionHandler>false</exceptionHandler>
<annotationLibrary>swagger2</annotationLibrary>
-->
<gradleBuildFile>false</gradleBuildFile>
<serializationLibrary>jackson</serializationLibrary>
<useTags>true</useTags>
<enumPropertyNaming>UPPERCASE</enumPropertyNaming>
</configOptions>
</configuration>
</execution>
Expand All @@ -236,17 +199,17 @@
<!-- kotlin compiler -->
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>kapt</id>
<phase>process-sources</phase>
<goals>
<goal>kapt</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/target/generated-sources/openapi/src/main/java</sourceDir>
<sourceDir>src/main/kotlin</sourceDir>
<sourceDir>${project.basedir}/target/generated-sources/openapi/src/main/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
</sourceDirs>
<annotationProcessorPaths>
<annotationProcessorPath>
Expand All @@ -257,37 +220,8 @@
</annotationProcessorPaths>
</configuration>
</execution>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/target/generated-sources/openapi/src/main/java</sourceDir>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
<!-- java compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
64 changes: 62 additions & 2 deletions components/approval/backend/src/main/api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ paths:
- Request
requestBody:
description: Request to be approved.
required: true
content:
application/json:
schema:
Expand Down Expand Up @@ -101,6 +102,7 @@ paths:
- Request
requestBody:
description: Request to be with modification.
required: true
content:
application/json:
schema:
Expand All @@ -109,7 +111,7 @@ paths:
responses:
204:
description: Successful operation.


'/approve-request/id/{id}':
parameters:
Expand Down Expand Up @@ -143,6 +145,7 @@ paths:
- User Task Approve Request
requestBody:
description: Payload to be added to the process instance on task completion.
required: true
content:
application/json:
schema:
Expand Down Expand Up @@ -184,6 +187,7 @@ paths:
- User Task Amend Request
requestBody:
description: Payload to be added to the process instance on task completion.
required: true
content:
application/json:
schema:
Expand All @@ -193,6 +197,37 @@ paths:
201:
description: Successful operation.

'/change-assignment/{taskId}':
parameters:
- in: path
name: taskId
schema:
type: string
description: Task id.
required: true
- in: header
name: X-Current-User-ID
description: Specifies the id of current user.
schema:
type: string
required: true
post:
summary: Change assignment of the task.
tags:
- User Task Assignment
requestBody:
description: Payload to be added to the process instance on task completion.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TaskAssignment'
operationId: submitTaskAssignmentChange
responses:
201:
description: Successful operation.


components:
schemas:

Expand Down Expand Up @@ -234,8 +269,8 @@ components:
- name
- description
- createTime
- dueDate
- businessKey
- priority

ApprovalRequestDraft:
type: object
Expand Down Expand Up @@ -327,6 +362,31 @@ components:
required:
- action

TaskAssignment:
type: object
properties:
deleteCandidateGroups:
type: array
items:
type: string
deleteCandidateUsers:
type: array
items:
type: string
addCandidateGroups:
type: array
items:
type: string
addCandidateUsers:
type: array
items:
type: string
required:
- deleteCandidateGroups
- deleteCandidateUsers
- addCandidateGroups
- addCandidateUsers

Environment:
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.holunda.polyflow.example.process.approval

import io.holixon.axon.gateway.configuration.query.EnableRevisionAwareQueryGateway
import io.holunda.polyflow.client.camunda.EnableCamundaEngineClient
import io.holunda.polyflow.example.process.approval.process.RequestApprovalProcess
import io.holunda.polyflow.example.process.approval.process.RequestApprovalProcess.Variables.AMOUNT
import io.holunda.polyflow.example.process.approval.process.RequestApprovalProcess.Variables.APPLICANT
Expand All @@ -16,15 +16,20 @@ import io.holunda.polyflow.taskpool.sender.gateway.LoggingTaskCommandErrorHandle
import mu.KLogging
import org.axonframework.commandhandling.CommandResultMessage
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication
import org.springframework.boot.autoconfigure.domain.EntityScan
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import
import org.springframework.context.annotation.Primary
import org.springframework.data.jpa.repository.config.EnableJpaRepositories

@Configuration
@EnableProcessApplication
@EnableTaskpoolEngineSupport
@EnableExampleUsers
@EnableJpaRepositories
@EntityScan
@EnableCamundaEngineClient
@Import(RequestApprovalProcessRestConfiguration::class, ProcessApproveRequestSPAConfiguration::class)
class RequestApprovalProcessConfiguration {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,9 @@ import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.bind.annotation.ResponseStatus

@Configuration
// @EnableSwagger2
@ControllerAdvice
class RequestApprovalProcessRestConfiguration {

// @Bean
// fun requestApprovalRestApi() = Docket(DocumentationType.SWAGGER_2)
// .groupName("example-request-approval")
// .select()
// .apis(RequestHandlerSelectors.any())
// .paths(PathSelectors.any())
// .build()

@ResponseStatus(value = HttpStatus.FORBIDDEN, reason = "Unknown user.")
@ExceptionHandler(value = [UnknownUserException::class])
Expand Down
Loading

0 comments on commit 36c64bc

Please sign in to comment.