Skip to content

Commit 36c64bc

Browse files
authored
Merge pull request #184 from holunda-io/feature/local-polyflow
Feature/local polyflow
2 parents d60e019 + 23084b9 commit 36c64bc

File tree

46 files changed

+906
-679
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+906
-679
lines changed

components/approval/backend/pom.xml

Lines changed: 45 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
<name>examples/${project.artifactId}</name>
1515

1616
<properties>
17-
<rest.api.location>src/main/api</rest.api.location>
18-
<rest.api.base-package>io.holunda.polyflow.example.process.approval.rest</rest.api.base-package>
1917
<maven.deploy.skip>true</maven.deploy.skip>
2018
</properties>
2119

@@ -24,6 +22,15 @@
2422
<groupId>io.holunda.polyflow</groupId>
2523
<artifactId>polyflow-camunda-bpm-springboot-starter</artifactId>
2624
</dependency>
25+
<dependency>
26+
<groupId>io.holunda.polyflow</groupId>
27+
<artifactId>polyflow-camunda-bpm-engine-client</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>io.holunda</groupId>
31+
<artifactId>camunda-platform-7-autologin</artifactId>
32+
<version>0.0.1</version>
33+
</dependency>
2734
<dependency>
2835
<groupId>io.holunda.polyflow</groupId>
2936
<artifactId>polyflow-example-users</artifactId>
@@ -56,54 +63,19 @@
5663
<groupId>org.springframework.boot</groupId>
5764
<artifactId>spring-boot-starter-data-jpa</artifactId>
5865
</dependency>
59-
60-
<!-- Axon -->
61-
<dependency>
62-
<groupId>org.axonframework</groupId>
63-
<artifactId>axon-spring-boot-starter</artifactId>
64-
</dependency>
65-
<dependency>
66-
<groupId>com.h2database</groupId>
67-
<artifactId>h2</artifactId>
68-
<!--<scope>test</scope>-->
69-
</dependency>
70-
71-
<!-- Camunda Scripting-->
72-
<dependency>
73-
<groupId>org.codehaus.groovy</groupId>
74-
<artifactId>groovy</artifactId>
75-
</dependency>
7666
<dependency>
77-
<groupId>org.codehaus.groovy</groupId>
78-
<artifactId>groovy-datetime</artifactId>
67+
<groupId>jakarta.validation</groupId>
68+
<artifactId>jakarta.validation-api</artifactId>
7969
</dependency>
8070
<dependency>
81-
<groupId>org.codehaus.groovy</groupId>
82-
<artifactId>groovy-jmx</artifactId>
83-
</dependency>
84-
<dependency>
85-
<groupId>org.codehaus.groovy</groupId>
86-
<artifactId>groovy-json</artifactId>
87-
</dependency>
88-
<dependency>
89-
<groupId>org.codehaus.groovy</groupId>
90-
<artifactId>groovy-jsr223</artifactId>
91-
</dependency>
92-
<dependency>
93-
<groupId>org.codehaus.groovy</groupId>
94-
<artifactId>groovy-macro</artifactId>
95-
</dependency>
96-
<dependency>
97-
<groupId>org.codehaus.groovy</groupId>
98-
<artifactId>groovy-nio</artifactId>
99-
</dependency>
100-
<dependency>
101-
<groupId>org.codehaus.groovy</groupId>
102-
<artifactId>groovy-templates</artifactId>
71+
<groupId>jakarta.annotation</groupId>
72+
<artifactId>jakarta.annotation-api</artifactId>
73+
<version>2.1.1</version>
10374
</dependency>
75+
<!-- Axon -->
10476
<dependency>
105-
<groupId>org.codehaus.groovy</groupId>
106-
<artifactId>groovy-xml</artifactId>
77+
<groupId>org.axonframework</groupId>
78+
<artifactId>axon-spring-boot-starter</artifactId>
10779
</dependency>
10880
<!-- Data -->
10981
<dependency>
@@ -147,6 +119,10 @@
147119
<groupId>org.springdoc</groupId>
148120
<artifactId>springdoc-openapi-ui</artifactId>
149121
</dependency>
122+
<dependency>
123+
<groupId>org.springdoc</groupId>
124+
<artifactId>springdoc-openapi-kotlin</artifactId>
125+
</dependency>
150126
<dependency>
151127
<groupId>org.openapitools</groupId>
152128
<artifactId>jackson-databind-nullable</artifactId>
@@ -156,28 +132,9 @@
156132
<build>
157133
<plugins>
158134
<plugin>
135+
<groupId>org.apache.maven.plugins</groupId>
159136
<artifactId>maven-resources-plugin</artifactId>
160137
<executions>
161-
<execution>
162-
<id>copy-openapi-ignore</id>
163-
<phase>generate-sources</phase>
164-
<goals>
165-
<goal>copy-resources</goal>
166-
</goals>
167-
<configuration>
168-
<outputDirectory>${project.build.directory}/generated-sources/openapi</outputDirectory>
169-
<resources>
170-
<resource>
171-
<directory>${rest.api.location}</directory>
172-
<includes>
173-
<include>.openapi-generator-ignore</include>
174-
<include>openapi.yml</include>
175-
</includes>
176-
</resource>
177-
</resources>
178-
</configuration>
179-
</execution>
180-
181138
<!-- Enforce resource copy -->
182139
<!-- This is a fix of Kotlin incremental Compiler bug -->
183140
<!-- See https://discuss.kotlinlang.org/t/kotlin-compiler-incremental-not-copying-resources/5640/5 -->
@@ -209,23 +166,29 @@
209166
<goal>generate</goal>
210167
</goals>
211168
<configuration>
212-
<inputSpec>${project.build.directory}/generated-sources/openapi/openapi.yml</inputSpec>
213-
<generatorName>spring</generatorName>
214-
<apiPackage>${rest.api.base-package}.api</apiPackage>
215-
<modelPackage>${rest.api.base-package}.model</modelPackage>
169+
<inputSpec>${project.basedir}/src/main/api/openapi.yml</inputSpec>
170+
<ignoreFileOverride>${basedir}/src/main/api/.openapi-generator-ignore</ignoreFileOverride>
171+
<generatorName>kotlin-spring</generatorName>
172+
<library>spring-boot</library>
216173
<modelNamePrefix/>
217174
<modelNameSuffix>Dto</modelNameSuffix>
175+
<generateApiTests>false</generateApiTests>
176+
<generateModelTests>false</generateModelTests>
177+
<skipIfSpecIsUnchanged>true</skipIfSpecIsUnchanged>
178+
179+
<apiPackage>io.holunda.polyflow.example.process.approval.rest.api</apiPackage>
180+
<modelPackage>io.holunda.polyflow.example.process.approval.rest.model</modelPackage>
218181
<configOptions>
219-
<sourceFolder>src/main/java</sourceFolder>
220-
<basePackage>${rest.api.base-package}</basePackage>
221-
<configPackage>${rest.api.base-package}</configPackage>
222-
<interfaceOnly>true</interfaceOnly>
223-
<dateLibrary>java8</dateLibrary>
224-
<swaggerDocketConfig>false</swaggerDocketConfig>
225-
<reactive>false</reactive>
226-
<bigDecimalAsString>true</bigDecimalAsString>
227-
<useOptional>true</useOptional>
228-
<useBeanValidation>true</useBeanValidation>
182+
<delegatePattern>true</delegatePattern>
183+
<!--
184+
<swaggerAnnotations>true</swaggerAnnotations>
185+
<exceptionHandler>false</exceptionHandler>
186+
<annotationLibrary>swagger2</annotationLibrary>
187+
-->
188+
<gradleBuildFile>false</gradleBuildFile>
189+
<serializationLibrary>jackson</serializationLibrary>
190+
<useTags>true</useTags>
191+
<enumPropertyNaming>UPPERCASE</enumPropertyNaming>
229192
</configOptions>
230193
</configuration>
231194
</execution>
@@ -236,17 +199,17 @@
236199
<!-- kotlin compiler -->
237200
<artifactId>kotlin-maven-plugin</artifactId>
238201
<groupId>org.jetbrains.kotlin</groupId>
239-
<version>${kotlin.version}</version>
240202
<executions>
241203
<execution>
242204
<id>kapt</id>
205+
<phase>process-sources</phase>
243206
<goals>
244207
<goal>kapt</goal>
245208
</goals>
246209
<configuration>
247210
<sourceDirs>
248-
<sourceDir>${project.basedir}/target/generated-sources/openapi/src/main/java</sourceDir>
249-
<sourceDir>src/main/kotlin</sourceDir>
211+
<sourceDir>${project.basedir}/target/generated-sources/openapi/src/main/kotlin</sourceDir>
212+
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
250213
</sourceDirs>
251214
<annotationProcessorPaths>
252215
<annotationProcessorPath>
@@ -257,37 +220,8 @@
257220
</annotationProcessorPaths>
258221
</configuration>
259222
</execution>
260-
<execution>
261-
<id>compile</id>
262-
<goals>
263-
<goal>compile</goal>
264-
</goals>
265-
<configuration>
266-
<sourceDirs>
267-
<sourceDir>${project.basedir}/target/generated-sources/openapi/src/main/java</sourceDir>
268-
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
269-
</sourceDirs>
270-
</configuration>
271-
</execution>
272-
<execution>
273-
<id>test-compile</id>
274-
<goals>
275-
<goal>test-compile</goal>
276-
</goals>
277-
<configuration>
278-
<sourceDirs>
279-
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
280-
</sourceDirs>
281-
</configuration>
282-
</execution>
283223
</executions>
284224
</plugin>
285-
<!-- java compiler -->
286-
<plugin>
287-
<groupId>org.apache.maven.plugins</groupId>
288-
<artifactId>maven-compiler-plugin</artifactId>
289-
</plugin>
290225
</plugins>
291226
</build>
292-
293227
</project>

components/approval/backend/src/main/api/openapi.yml

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ paths:
4444
- Request
4545
requestBody:
4646
description: Request to be approved.
47+
required: true
4748
content:
4849
application/json:
4950
schema:
@@ -101,6 +102,7 @@ paths:
101102
- Request
102103
requestBody:
103104
description: Request to be with modification.
105+
required: true
104106
content:
105107
application/json:
106108
schema:
@@ -109,7 +111,7 @@ paths:
109111
responses:
110112
204:
111113
description: Successful operation.
112-
114+
113115

114116
'/approve-request/id/{id}':
115117
parameters:
@@ -143,6 +145,7 @@ paths:
143145
- User Task Approve Request
144146
requestBody:
145147
description: Payload to be added to the process instance on task completion.
148+
required: true
146149
content:
147150
application/json:
148151
schema:
@@ -184,6 +187,7 @@ paths:
184187
- User Task Amend Request
185188
requestBody:
186189
description: Payload to be added to the process instance on task completion.
190+
required: true
187191
content:
188192
application/json:
189193
schema:
@@ -193,6 +197,37 @@ paths:
193197
201:
194198
description: Successful operation.
195199

200+
'/change-assignment/{taskId}':
201+
parameters:
202+
- in: path
203+
name: taskId
204+
schema:
205+
type: string
206+
description: Task id.
207+
required: true
208+
- in: header
209+
name: X-Current-User-ID
210+
description: Specifies the id of current user.
211+
schema:
212+
type: string
213+
required: true
214+
post:
215+
summary: Change assignment of the task.
216+
tags:
217+
- User Task Assignment
218+
requestBody:
219+
description: Payload to be added to the process instance on task completion.
220+
required: true
221+
content:
222+
application/json:
223+
schema:
224+
$ref: '#/components/schemas/TaskAssignment'
225+
operationId: submitTaskAssignmentChange
226+
responses:
227+
201:
228+
description: Successful operation.
229+
230+
196231
components:
197232
schemas:
198233

@@ -234,8 +269,8 @@ components:
234269
- name
235270
- description
236271
- createTime
237-
- dueDate
238272
- businessKey
273+
- priority
239274

240275
ApprovalRequestDraft:
241276
type: object
@@ -327,6 +362,31 @@ components:
327362
required:
328363
- action
329364

365+
TaskAssignment:
366+
type: object
367+
properties:
368+
deleteCandidateGroups:
369+
type: array
370+
items:
371+
type: string
372+
deleteCandidateUsers:
373+
type: array
374+
items:
375+
type: string
376+
addCandidateGroups:
377+
type: array
378+
items:
379+
type: string
380+
addCandidateUsers:
381+
type: array
382+
items:
383+
type: string
384+
required:
385+
- deleteCandidateGroups
386+
- deleteCandidateUsers
387+
- addCandidateGroups
388+
- addCandidateUsers
389+
330390
Environment:
331391
type: object
332392
required:

components/approval/backend/src/main/kotlin/io/holunda/polyflow/example/process/approval/RequestApprovalProcessConfiguration.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.holunda.polyflow.example.process.approval
22

3-
import io.holixon.axon.gateway.configuration.query.EnableRevisionAwareQueryGateway
3+
import io.holunda.polyflow.client.camunda.EnableCamundaEngineClient
44
import io.holunda.polyflow.example.process.approval.process.RequestApprovalProcess
55
import io.holunda.polyflow.example.process.approval.process.RequestApprovalProcess.Variables.AMOUNT
66
import io.holunda.polyflow.example.process.approval.process.RequestApprovalProcess.Variables.APPLICANT
@@ -16,15 +16,20 @@ import io.holunda.polyflow.taskpool.sender.gateway.LoggingTaskCommandErrorHandle
1616
import mu.KLogging
1717
import org.axonframework.commandhandling.CommandResultMessage
1818
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication
19+
import org.springframework.boot.autoconfigure.domain.EntityScan
1920
import org.springframework.context.annotation.Bean
2021
import org.springframework.context.annotation.Configuration
2122
import org.springframework.context.annotation.Import
2223
import org.springframework.context.annotation.Primary
24+
import org.springframework.data.jpa.repository.config.EnableJpaRepositories
2325

2426
@Configuration
2527
@EnableProcessApplication
2628
@EnableTaskpoolEngineSupport
2729
@EnableExampleUsers
30+
@EnableJpaRepositories
31+
@EntityScan
32+
@EnableCamundaEngineClient
2833
@Import(RequestApprovalProcessRestConfiguration::class, ProcessApproveRequestSPAConfiguration::class)
2934
class RequestApprovalProcessConfiguration {
3035

components/approval/backend/src/main/kotlin/io/holunda/polyflow/example/process/approval/RequestApprovalProcessRestConfiguration.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,9 @@ import org.springframework.web.bind.annotation.ExceptionHandler
88
import org.springframework.web.bind.annotation.ResponseStatus
99

1010
@Configuration
11-
// @EnableSwagger2
1211
@ControllerAdvice
1312
class RequestApprovalProcessRestConfiguration {
1413

15-
// @Bean
16-
// fun requestApprovalRestApi() = Docket(DocumentationType.SWAGGER_2)
17-
// .groupName("example-request-approval")
18-
// .select()
19-
// .apis(RequestHandlerSelectors.any())
20-
// .paths(PathSelectors.any())
21-
// .build()
2214

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

0 commit comments

Comments
 (0)