Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/843 provide task list filter criteria #335

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no filters in the api anymore

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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No filters in the API

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>? // FIXME -> no filters needed?
): ResponseEntity<List<String>> {
val user = userService.getUser(xCurrentUserID)
val result = taskServiceGateway.getTaskAttributeNames(user)

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>? // FIXME -> no filters needed?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you see, the generated method signature is not matching the API call in line 169

): ResponseEntity<List<Any>> {
val user = userService.getUser(xCurrentUserID)
val result = taskServiceGateway.getTaskAttributeValues(attributeName, user)

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,26 @@ class TaskServiceGateway(
filters = filters
)
).join() ?: throw ElementNotFoundException()

fun getTaskAttributeNames(
user: User,
): TaskAttributeNamesQueryResult = taskQueryClient
.query(
TaskAttributeNamesQuery(
user = user,
assignedToMeOnly = false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because there are no filters in the query object

)
).join() ?: throw ElementNotFoundException()

fun getTaskAttributeValues(
attributeName: String,
user: User,
): TaskAttributeValuesQueryResult = taskQueryClient
.query(
TaskAttributeValuesQuery(
attributeName = attributeName,
user = user,
assignedToMeOnly = false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because there are no filters in the query object

)
).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
8 changes: 1 addition & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@
Use the system property: -Dcamunda-ee to enable EE
-->



<springboot.version>3.4.2</springboot.version>
<polyflow.version>4.2.2</polyflow.version>


<camunda-ce.version>7.21.0</camunda-ce.version>
<camunda-ee.version>7.21.0-ee</camunda-ee.version>
<camunda-springboot.version>${camunda-ce.version}</camunda-springboot.version>
Expand Down Expand Up @@ -154,11 +153,6 @@
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-common</artifactId>
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
Loading