Skip to content

Commit

Permalink
Added new simple example which uses simple polyflow view
Browse files Browse the repository at this point in the history
  • Loading branch information
p-wunderlich committed Jul 2, 2024
1 parent c76960c commit f58dff6
Show file tree
Hide file tree
Showing 36 changed files with 2,655 additions and 10 deletions.
71 changes: 69 additions & 2 deletions components/tasklist-backend/src/main/api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,67 @@ paths:
'404':
description: Task not found.

'/tasks/payload/attribute/names':
parameters:
- $ref: '#/components/parameters/CurrentUserIdParam'
- $ref: '#/components/parameters/FiltersParam'
get:
tags:
- Task
summary: Lists all available attribute names for task payload.
operationId: getTasksAttributeNames
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
title: List of attribute names.
type: array
items:
type: string

headers:
X-ElementCount:
description: Number of elements in total.
schema:
type: integer
'401':
description: Not authenticated.
'403':
description: Not authorized.

'/tasks/payload/attribute/{attributeName}/values':
parameters:
- $ref: '#/components/parameters/CurrentUserIdParam'
- $ref: '#/components/parameters/AttributeNameParam'
- $ref: '#/components/parameters/FiltersParam'
get:
tags:
- Task
summary: Lists all available attribute values for given attribute name.
operationId: getTasksAttributeValues
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
title: List of attribute values.
type: array
items:
type: object

headers:
X-ElementCount:
description: Number of elements in total.
schema:
type: integer
'401':
description: Not authenticated.
'403':
description: Not authorized.

'/business-data-entries':
parameters:
- $ref: '#/components/parameters/CurrentUserIdParam'
Expand Down Expand Up @@ -313,6 +374,14 @@ components:
schema:
type: string

AttributeNameParam:
name: attributeName
in: path
description: Payload Attribute Name.
required: true
schema:
type: string

schemas:
TaskWithDataEntries:
type: object
Expand Down Expand Up @@ -553,5 +622,3 @@ components:
username:
type: string
description: username of currently logged-in user.


Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,33 @@ class TaskResource(
return ResponseEntity.noContent().build()
}

override fun getTasksAttributeNames(
xCurrentUserID: String,
filters: List<String>?
): ResponseEntity<List<String>> {
val user = userService.getUser(xCurrentUserID)
val result = taskServiceGateway.getTaskAttributeNames(user,filters ?: listOf())

return ResponseEntity
.ok()
.headers(HttpHeaders().apply { this[HEADER_ELEMENT_COUNT] = result.totalElementCount.toString() })
.body(result.elements)
}

override fun getTasksAttributeValues(
xCurrentUserID: String,
attributeName: String,
filters: List<String>?
): ResponseEntity<List<Any>> {
val user = userService.getUser(xCurrentUserID)
val result = taskServiceGateway.getTaskAttributeValues(attributeName, user,filters ?: listOf())

return ResponseEntity
.ok()
.headers(HttpHeaders().apply { this[HEADER_ELEMENT_COUNT] = result.totalElementCount.toString() })
.body(result.elements)
}

private fun getAuthorizedTask(taskId: String, user: User): Task = taskServiceGateway
.getTask(taskId)
.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import io.holunda.polyflow.example.tasklist.adapter.rest.ElementNotFoundExceptio
import io.holunda.polyflow.view.Task
import io.holunda.polyflow.view.TaskQueryClient
import io.holunda.polyflow.view.auth.User
import io.holunda.polyflow.view.query.task.TaskForIdQuery
import io.holunda.polyflow.view.query.task.TasksWithDataEntriesForUserQuery
import io.holunda.polyflow.view.query.task.TasksWithDataEntriesQueryResult
import io.holunda.polyflow.view.query.task.*
import mu.KLogging
import org.axonframework.commandhandling.gateway.CommandGateway
import org.axonframework.queryhandling.QueryGateway
Expand Down Expand Up @@ -56,4 +54,30 @@ class TaskServiceGateway(
filters = filters
)
).join() ?: throw ElementNotFoundException()

fun getTaskAttributeNames(
user: User,
filters: List<String>
): TaskAttributeNamesQueryResult = taskQueryClient
.query(
TaskAttributeNamesQuery(
user = user,
assignedToMeOnly = false,
filters = filters
)
).join() ?: throw ElementNotFoundException()

fun getTaskAttributeValues(
attributeName: String,
user: User,
filters: List<String>
): TaskAttributeValuesQueryResult = taskQueryClient
.query(
TaskAttributeValuesQuery(
attributeName = attributeName,
user = user,
assignedToMeOnly = false,
filters = filters
)
).join() ?: throw ElementNotFoundException()
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package io.holunda.polyflow.example.tasklist.adapter.rest.mapper

import io.holunda.polyflow.example.tasklist.adapter.rest.model.DataEntryDto
import io.holunda.polyflow.example.tasklist.adapter.rest.model.ProtocolEntryDto
import io.holunda.polyflow.example.tasklist.adapter.rest.model.TaskDto
import io.holunda.polyflow.example.tasklist.adapter.rest.model.TaskWithDataEntriesDto
import io.holunda.polyflow.example.tasklist.adapter.rest.model.*
import io.holunda.polyflow.view.*
import org.mapstruct.*
import org.springframework.beans.factory.annotation.Autowired
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@


<springboot.version>3.2.6</springboot.version>
<polyflow.version>4.2.0</polyflow.version>
<polyflow.version>4.2.1-SNAPSHOT</polyflow.version>

<camunda-ce.version>7.21.0</camunda-ce.version>
<camunda-ee.version>7.21.0-ee</camunda-ee.version>
Expand Down
1 change: 1 addition & 0 deletions scenarios/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</properties>

<modules>
<module>single-node-simple</module>
<module>single-node-jpa</module>
<module>single-node-jpa-maria</module>
<module>distributed-axon-server</module>
Expand Down
141 changes: 141 additions & 0 deletions scenarios/single-node-simple/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-scenario-root</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>

<artifactId>polyflow-example-scenario-single-node-simple</artifactId>
<name>examples/${project.artifactId}</name>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<dependencies>
<!-- Frontends see below in the profile-->
<!-- Core -->
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-taskpool-core</artifactId>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-datapool-core</artifactId>
</dependency>

<!-- Tasklist -->
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-tasklist-backend</artifactId>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-form-url-resolver</artifactId>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-view-simple</artifactId>
</dependency>

<!-- Process application -->
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-approval-backend</artifactId>
<exclusions>
<exclusion>
<groupId>org.axonframework</groupId>
<artifactId>axon-server-connector</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-infrastructure</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<!-- for packaging springboot application -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<requiresUnpack>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-process-backend</artifactId>
</dependency>
</requiresUnpack>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>frontend</id>
<activation>
<property>
<name>!skipFrontend</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-approval-forms</artifactId>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-tasklist-angular</artifactId>
</dependency>
</dependencies>
</profile>

<profile>
<id>camunda-ce</id>
<activation>
<property>
<name>!camunda-ee</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
</dependency>
</dependencies>
</profile>

<profile>
<id>camunda-ee</id>
<activation>
<property>
<name>camunda-ee</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp-ee</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>


</project>
Loading

0 comments on commit f58dff6

Please sign in to comment.