Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-11 Thread via GitHub


pefernan merged PR #4273:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-10 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3389014621


##
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/usertask/RestResourceUserTaskQuarkusTemplate.java:
##
@@ -87,8 +84,49 @@ public void init() {
 
 @GET
 @Produces(MediaType.APPLICATION_JSON)
-public List list(@QueryParam("user") String user, 
@QueryParam("group") List groups) {
-return 
userTaskService.list(identityProviderFactory.getOrImpersonateIdentity(user, 
groups));
+public Object list(

Review Comment:
   comment addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-10 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3389013551


##
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/usertask/RestResourceUserTaskQuarkusTemplate.java:
##
@@ -87,8 +84,49 @@ public void init() {
 
 @GET
 @Produces(MediaType.APPLICATION_JSON)
-public List list(@QueryParam("user") String user, 
@QueryParam("group") List groups) {
-return 
userTaskService.list(identityProviderFactory.getOrImpersonateIdentity(user, 
groups));
+public Object list(
+@QueryParam("user") String user,
+@QueryParam("group") List groups,
+@QueryParam("format") String format,
+@QueryParam("processId") String processId,
+@QueryParam("processInstanceId") String processInstanceId,
+@QueryParam("status") List status,
+@QueryParam("taskName") String taskName) {
+
+// Build filter from query parameters
+UserTaskFilter.Builder filterBuilder = UserTaskFilter.builder()
+.processId(processId)
+.processInstanceId(processInstanceId)
+.taskName(taskName);
+
+// Handle multiple status values
+if (status != null && !status.isEmpty()) {

Review Comment:
   comment addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-09 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3380891174


##
springboot/addons/jbpm-usertask-storage-jpa/pom.xml:
##
@@ -53,5 +53,48 @@
 org.kie
 kie-addons-springboot-flyway
 
+
+
+
+org.springframework.boot
+spring-boot-starter-test
+test
+
+
+com.h2database
+h2
+test
+
+
+org.postgresql
+postgresql
+test
+
+

Review Comment:
   comment addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-09 Thread via GitHub


pefernan commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3378895701


##
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/usertask/RestResourceUserTaskQuarkusTemplate.java:
##
@@ -87,8 +84,49 @@ public void init() {
 
 @GET
 @Produces(MediaType.APPLICATION_JSON)
-public List list(@QueryParam("user") String user, 
@QueryParam("group") List groups) {
-return 
userTaskService.list(identityProviderFactory.getOrImpersonateIdentity(user, 
groups));
+public Object list(

Review Comment:
   I understand the change, but I still think it should return a 
List instead of object, why not using [jackson 
views](https://www.baeldung.com/jackson-json-view-annotation) on top of 
`UserTaskView` to somehow switch between both task presentations. 
   Maybe with this approach we can also simplify [this 
fragment](https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273/changes#diff-3efefca73563302797ac35ae81f359f53ab353d6a23b27d90670e23c60bb35b6R113-R129)
 in both templates.



##
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/usertask/RestResourceUserTaskQuarkusTemplate.java:
##
@@ -87,8 +84,49 @@ public void init() {
 
 @GET
 @Produces(MediaType.APPLICATION_JSON)
-public List list(@QueryParam("user") String user, 
@QueryParam("group") List groups) {
-return 
userTaskService.list(identityProviderFactory.getOrImpersonateIdentity(user, 
groups));
+public Object list(
+@QueryParam("user") String user,
+@QueryParam("group") List groups,
+@QueryParam("format") String format,
+@QueryParam("processId") String processId,
+@QueryParam("processInstanceId") String processInstanceId,
+@QueryParam("status") List status,
+@QueryParam("taskName") String taskName) {
+
+// Build filter from query parameters
+UserTaskFilter.Builder filterBuilder = UserTaskFilter.builder()
+.processId(processId)
+.processInstanceId(processInstanceId)
+.taskName(taskName);
+
+// Handle multiple status values
+if (status != null && !status.isEmpty()) {

Review Comment:
   @GopikaReghunath Considering that you use the UserTaskState name to build 
the query 
[here](https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273/changes#diff-f5872faada1b3bc1899550b79afbd939226b3c39e778fa51ccb370e54195251cR107)
 I think this conversion is not necessary. 
   
   You can directly pass the states collection to the `filterBuilder`, so we 
simplify this and both REST templates are simpler.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-09 Thread via GitHub


jstastny-cz commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3378575288


##
springboot/addons/jbpm-usertask-storage-jpa/pom.xml:
##
@@ -53,5 +53,48 @@
 org.kie
 kie-addons-springboot-flyway
 
+
+
+
+org.springframework.boot
+spring-boot-starter-test
+test
+
+
+com.h2database
+h2
+test
+
+
+org.postgresql
+postgresql
+test
+
+

Review Comment:
   We should rather use 
   ```
   
   org.kie.kogito
   kogito-spring-boot-test-utils
   test
   
   ```
   instead of direct testcontainers dependencies, or why do we not use it?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-08 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3374850223


##
quarkus/integration-tests/integration-tests-quarkus-usertasks/src/test/java/org/jbpm/userTask/jpa/it/UserTaskFilterIT.java:
##
@@ -466,98 +466,7 @@ public void testFilterByStatusCaseInsensitive() {
 .get(USER_TASKS_ENDPOINT)
 .then()
 .statusCode(200)
-.body("$.size()", is(1))
-.body("[0].status.name", is("Reserved"));
-}
-
-@Test
-public void testFilterByStatusUpperCase() {
-// Given - Start a process instance (creates task in Reserved status)
-Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
-new Address("main street", "Boston", "10005", "US"));
-startProcessInstance(traveller);
-
-// When - Query with uppercase status (should match case-insensitively)
-given().contentType(ContentType.JSON)
-.queryParam("user", "manager")
-.queryParam("group", "department-managers")
-.queryParam("status", "RESERVED")
-.when()
-.get(USER_TASKS_ENDPOINT)
-.then()
-.statusCode(200)
-.body("$.size()", is(1))
-.body("[0].status.name", is("Reserved"));
-}
-
-@Test
-public void testFilterByStatusMixedCase() {
-// Given - Start a process instance (creates task in Reserved status)
-Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
-new Address("main street", "Boston", "10005", "US"));
-startProcessInstance(traveller);
-
-// When - Query with mixed case status (should match 
case-insensitively)
-given().contentType(ContentType.JSON)
-.queryParam("user", "manager")
-.queryParam("group", "department-managers")
-.queryParam("status", "ReSeRvEd")
-.when()
-.get(USER_TASKS_ENDPOINT)
-.then()
-.statusCode(200)
-.body("$.size()", is(1))
-.body("[0].status.name", is("Reserved"));
+.body("$.size()", is(0));

Review Comment:
   comment addressed



##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/model/UserTaskInstanceEntity.java:
##
@@ -29,25 +29,33 @@
 import jakarta.persistence.*;
 
 @Entity
-@NamedQuery(name = UserTaskInstanceEntity.GET_INSTANCES_BY_IDENTITY,
-query = "select userTask from UserTaskInstanceEntity userTask " +
-"left join userTask.adminGroups adminGroup " +
-"left join userTask.potentialGroups potentialGroup " +
-"where :userId member of userTask.adminUsers " +
-"or adminGroup in (:roles) " +
-"or userTask.actualOwner = :userId " +
-"or (userTask.actualOwner is null " + // checking if task is 
not reserved, we cannot check by status since lifecycle can be customized
-"and :userId not member of userTask.excludedUsers " +
-"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles)" +
-"))")
 @NamedNativeQuery(
 name = UserTaskInstanceEntity.DELETE_BY_ID,
 query = "delete from jbpm_user_tasks where id = :taskId")
 @Table(name = "jbpm_user_tasks")
 public class UserTaskInstanceEntity {
-public static final String GET_INSTANCES_BY_IDENTITY = 
"UserTaskInstanceEntity.GetInstanceByIdentity";
 public static final String DELETE_BY_ID = 
"UserTaskInstanceEntity.DeleteById";
 
+// Base query for finding instances by identity (without status filter)
+public static final String BASE_IDENTITY_QUERY =
+"select userTask from UserTaskInstanceEntity userTask " +
+"left join userTask.adminGroups adminGroup " +
+"left join userTask.potentialGroups potentialGroup " +
+"where (:userId member of userTask.adminUsers " +
+"or adminGroup in (:roles) " +
+"or userTask.actualOwner = :userId " +
+"or (userTask.actualOwner is null " + // checking if task 
is not reserved, we cannot check by status since lifecycle can be customized
+"and :userId not member of userTask.excludedUsers " +
+"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles " +
+"and (cast(:processId as string) is null or 
userTask.processInfo.processId = :processId) " +

Review Comment:
   comment addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To 

Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-08 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3374852304


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/repository/UserTaskInstanceRepository.java:
##
@@ -36,9 +42,61 @@ public UserTaskInstanceRepository(UserTaskJPAContext 
context) {
 }
 
 public List findByIdentity(IdentityProvider 
identityProvider) {
-TypedQuery query = 
getEntityManager().createNamedQuery(GET_INSTANCES_BY_IDENTITY, 
UserTaskInstanceEntity.class);
-query.setParameter("userId", identityProvider.getName());
-query.setParameter("roles", identityProvider.getRoles());
+return findByIdentity(identityProvider, null);
+}
+
+public List findByIdentity(IdentityProvider 
identityProvider, UserTaskFilter filter) {
+String userId = identityProvider.getName();
+Collection roles = identityProvider.getRoles();
+
+// Build query dynamically - start with base query
+String jpql = BASE_IDENTITY_QUERY;
+
+boolean hasTaskNameFilter = filter != null
+&& filter.taskName() != null
+&& !filter.taskName().isEmpty();
+
+boolean hasStatusFilter = filter != null
+&& filter.statuses() != null
+&& !filter.statuses().isEmpty();
+
+// Conditionally append filter clauses
+if (hasTaskNameFilter) {
+jpql = jpql.concat(TASKNAME_FILTER_CLAUSE);
+}
+
+if (hasStatusFilter) {
+jpql = jpql.concat(STATUS_FILTER_CLAUSE);
+}
+
+// Create typed query with the final JPQL
+TypedQuery query = getEntityManager()
+.createQuery(jpql, UserTaskInstanceEntity.class)
+.setParameter("userId", userId)
+.setParameter("roles", roles);
+
+if (filter != null) {
+query.setParameter("processId", filter.processId());
+query.setParameter("processInstanceId", 
filter.processInstanceId());
+
+// Only set taskName if we added it to the query
+if (hasTaskNameFilter) {
+query.setParameter("taskName", filter.taskName());
+}
+
+// Only set statusFilter if we added it to the query
+if (hasStatusFilter) {
+List statusFilter = filter.statuses().stream()
+.map(UserTaskState::getName)

Review Comment:
   comment addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-08 Thread via GitHub


jstastny-cz commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3373769980


##
quarkus/integration-tests/integration-tests-quarkus-usertasks/src/test/java/org/jbpm/userTask/jpa/it/UserTaskFilterIT.java:
##
@@ -466,98 +466,7 @@ public void testFilterByStatusCaseInsensitive() {
 .get(USER_TASKS_ENDPOINT)
 .then()
 .statusCode(200)
-.body("$.size()", is(1))
-.body("[0].status.name", is("Reserved"));
-}
-
-@Test
-public void testFilterByStatusUpperCase() {
-// Given - Start a process instance (creates task in Reserved status)
-Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
-new Address("main street", "Boston", "10005", "US"));
-startProcessInstance(traveller);
-
-// When - Query with uppercase status (should match case-insensitively)
-given().contentType(ContentType.JSON)
-.queryParam("user", "manager")
-.queryParam("group", "department-managers")
-.queryParam("status", "RESERVED")
-.when()
-.get(USER_TASKS_ENDPOINT)
-.then()
-.statusCode(200)
-.body("$.size()", is(1))
-.body("[0].status.name", is("Reserved"));
-}
-
-@Test
-public void testFilterByStatusMixedCase() {
-// Given - Start a process instance (creates task in Reserved status)
-Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
-new Address("main street", "Boston", "10005", "US"));
-startProcessInstance(traveller);
-
-// When - Query with mixed case status (should match 
case-insensitively)
-given().contentType(ContentType.JSON)
-.queryParam("user", "manager")
-.queryParam("group", "department-managers")
-.queryParam("status", "ReSeRvEd")
-.when()
-.get(USER_TASKS_ENDPOINT)
-.then()
-.statusCode(200)
-.body("$.size()", is(1))
-.body("[0].status.name", is("Reserved"));
+.body("$.size()", is(0));

Review Comment:
   I think this test case either needs renaming or remove? 
`testFilterByStatusCaseInsensitive` - also based on body contents - now it is 
case sensitive.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-08 Thread via GitHub


jstastny-cz commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3371569196


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/repository/UserTaskInstanceRepository.java:
##
@@ -36,9 +42,61 @@ public UserTaskInstanceRepository(UserTaskJPAContext 
context) {
 }
 
 public List findByIdentity(IdentityProvider 
identityProvider) {
-TypedQuery query = 
getEntityManager().createNamedQuery(GET_INSTANCES_BY_IDENTITY, 
UserTaskInstanceEntity.class);
-query.setParameter("userId", identityProvider.getName());
-query.setParameter("roles", identityProvider.getRoles());
+return findByIdentity(identityProvider, null);
+}
+
+public List findByIdentity(IdentityProvider 
identityProvider, UserTaskFilter filter) {
+String userId = identityProvider.getName();
+Collection roles = identityProvider.getRoles();
+
+// Build query dynamically - start with base query
+String jpql = BASE_IDENTITY_QUERY;
+
+boolean hasTaskNameFilter = filter != null
+&& filter.taskName() != null
+&& !filter.taskName().isEmpty();
+
+boolean hasStatusFilter = filter != null
+&& filter.statuses() != null
+&& !filter.statuses().isEmpty();
+
+// Conditionally append filter clauses
+if (hasTaskNameFilter) {
+jpql = jpql.concat(TASKNAME_FILTER_CLAUSE);
+}
+
+if (hasStatusFilter) {
+jpql = jpql.concat(STATUS_FILTER_CLAUSE);
+}
+
+// Create typed query with the final JPQL
+TypedQuery query = getEntityManager()
+.createQuery(jpql, UserTaskInstanceEntity.class)
+.setParameter("userId", userId)
+.setParameter("roles", roles);
+
+if (filter != null) {
+query.setParameter("processId", filter.processId());
+query.setParameter("processInstanceId", 
filter.processInstanceId());
+
+// Only set taskName if we added it to the query
+if (hasTaskNameFilter) {
+query.setParameter("taskName", filter.taskName());
+}
+
+// Only set statusFilter if we added it to the query
+if (hasStatusFilter) {
+List statusFilter = filter.statuses().stream()
+.map(UserTaskState::getName)

Review Comment:
   entity.setStatus(userTaskInstance.getStatus().getName());
   
   Check the mapper - we have full control over the format of the state value - 
it's being persisted via getName() of the enum. We should drop any lower-case 
transformation, especially from the SQL query, and just make sure we pass the 
correctly formatted values.



##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/model/UserTaskInstanceEntity.java:
##
@@ -29,25 +29,33 @@
 import jakarta.persistence.*;
 
 @Entity
-@NamedQuery(name = UserTaskInstanceEntity.GET_INSTANCES_BY_IDENTITY,
-query = "select userTask from UserTaskInstanceEntity userTask " +
-"left join userTask.adminGroups adminGroup " +
-"left join userTask.potentialGroups potentialGroup " +
-"where :userId member of userTask.adminUsers " +
-"or adminGroup in (:roles) " +
-"or userTask.actualOwner = :userId " +
-"or (userTask.actualOwner is null " + // checking if task is 
not reserved, we cannot check by status since lifecycle can be customized
-"and :userId not member of userTask.excludedUsers " +
-"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles)" +
-"))")
 @NamedNativeQuery(
 name = UserTaskInstanceEntity.DELETE_BY_ID,
 query = "delete from jbpm_user_tasks where id = :taskId")
 @Table(name = "jbpm_user_tasks")
 public class UserTaskInstanceEntity {
-public static final String GET_INSTANCES_BY_IDENTITY = 
"UserTaskInstanceEntity.GetInstanceByIdentity";
 public static final String DELETE_BY_ID = 
"UserTaskInstanceEntity.DeleteById";
 
+// Base query for finding instances by identity (without status filter)
+public static final String BASE_IDENTITY_QUERY =
+"select userTask from UserTaskInstanceEntity userTask " +
+"left join userTask.adminGroups adminGroup " +
+"left join userTask.potentialGroups potentialGroup " +
+"where (:userId member of userTask.adminUsers " +
+"or adminGroup in (:roles) " +
+"or userTask.actualOwner = :userId " +
+"or (userTask.actualOwner is null " + // checking if task 
is not reserved, we cannot check by status since lifecycle can be customized
+"and :userId not member of userTask.excludedUsers " +
+   

Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-05 Thread via GitHub


martinweiler commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3363923895


##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskService.java:
##
@@ -34,13 +37,15 @@ public interface UserTaskService {
 
 List list(IdentityProvider identity);
 
+List listTasks(IdentityProvider identity, UserTaskFilter 
filter);
+
 Optional transition(String taskId, String transitionId, 
Map data, IdentityProvider identity);
 
 List allowedTransitions(String taskId, 
IdentityProvider identity);
 
-Optional setOutputs(String taskId, Map data, 
IdentityProvider identity);
+Optional setOutputs(String taskId, Map data, IdentityProvider identity);
 
-Optional setInputs(String taskId, Map data, 
IdentityProvider identity);
+Optional setInputs(String taskId, Map 
data, IdentityProvider identity);

Review Comment:
   @cimbalek thanks for highlighting this! I agree that this is a breaking 
change, but one that has been done intentionally. There are other endpoints 
available which return the full UserTaskView that users can call if needed. 
Returning the new `UserTaskInputsView` / `UserTaskOutputsView` streamlines the 
response for the input/output related endpoints.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-05 Thread via GitHub


cimbalek commented on PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#issuecomment-4631238196

   LGTM. Thanks.
   However, I have one question in the code - questioning change with the views 
that is imo breaking backward compatibility. Is that desirable? @martinweiler 
WDYT?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-05 Thread via GitHub


cimbalek commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3362380213


##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskService.java:
##
@@ -34,13 +37,15 @@ public interface UserTaskService {
 
 List list(IdentityProvider identity);
 
+List listTasks(IdentityProvider identity, UserTaskFilter 
filter);
+
 Optional transition(String taskId, String transitionId, 
Map data, IdentityProvider identity);
 
 List allowedTransitions(String taskId, 
IdentityProvider identity);
 
-Optional setOutputs(String taskId, Map data, 
IdentityProvider identity);
+Optional setOutputs(String taskId, Map data, IdentityProvider identity);
 
-Optional setInputs(String taskId, Map data, 
IdentityProvider identity);
+Optional setInputs(String taskId, Map 
data, IdentityProvider identity);

Review Comment:
   Seems that it was part of assignment, but the question about breaking 
backwards compatibility stays.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-05 Thread via GitHub


cimbalek commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3361773938


##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskService.java:
##
@@ -34,13 +37,15 @@ public interface UserTaskService {
 
 List list(IdentityProvider identity);
 
+List listTasks(IdentityProvider identity, UserTaskFilter 
filter);
+
 Optional transition(String taskId, String transitionId, 
Map data, IdentityProvider identity);
 
 List allowedTransitions(String taskId, 
IdentityProvider identity);
 
-Optional setOutputs(String taskId, Map data, 
IdentityProvider identity);
+Optional setOutputs(String taskId, Map data, IdentityProvider identity);
 
-Optional setInputs(String taskId, Map data, 
IdentityProvider identity);
+Optional setInputs(String taskId, Map 
data, IdentityProvider identity);

Review Comment:
   Aren't these chages breaking backward compatibility? And do we need all 
those new views?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-02 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3342149676


##
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/usertask/RestResourceUserTaskSpringTemplate.java:
##
@@ -92,15 +99,54 @@ public void init() {
 }
 
 @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE, consumes = 
MediaType.ALL_VALUE)
-public List list(
-@RequestParam(value = "user", required = false) String user, 
-@RequestParam(value = "group", required = false) List 
groups) {
-return 
userTaskService.list(identityProviderFactory.getOrImpersonateIdentity(user, 
groups));
+public Object list(
+@RequestParam(value = "user", required = false) String user,
+@RequestParam(value = "group", required = false) List 
groups,
+@RequestParam(value = "format", required = false) String format,
+@RequestParam(value = "processId", required = false) String 
processId,
+@RequestParam(value = "processInstanceId", required = false) 
String processInstanceId,
+@RequestParam(value = "status", required = false) List 
status,
+@RequestParam(value = "taskName", required = false) String 
taskName) {

Review Comment:
   Have made taskname exact match and case sensitive



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-02 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3342144861


##
springboot/integration-tests/integration-tests-springboot-usertasks-it/src/test/java/org/jbpm/userTask/jpa/it/UserTaskFilterIT.java:
##
@@ -0,0 +1,668 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jbpm.userTask.jpa.it;
+
+import java.util.List;
+
+import org.acme.travels.Address;
+import org.acme.travels.Traveller;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.it.KogitoSpringbootApplication;
+import 
org.kie.kogito.testcontainers.springboot.PostgreSqlSpringBootTestResource;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ContextConfiguration;
+
+import io.restassured.http.ContentType;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.hasItem;
+
+/**
+ * Integration test for user task filtering functionality.
+ * Tests the filter query parameters on the /usertasks/instance endpoint.
+ */
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, 
classes = KogitoSpringbootApplication.class)
+@ContextConfiguration(initializers = PostgreSqlSpringBootTestResource.class)
+public class UserTaskFilterIT extends BaseUserTaskIT {

Review Comment:
   comment addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-02 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3342142423


##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskInfo.java:
##
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.usertask;
+
+import java.util.Objects;
+
+import org.kie.kogito.usertask.lifecycle.UserTaskState;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+/**
+ * Lightweight data transfer object for user task list operations.
+ * Contains only essential task information without inputs, outputs, or 
metadata.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class UserTaskInfo {

Review Comment:
   I have moved this class to view package 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-02 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3342131036


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/model/UserTaskInstanceEntity.java:
##
@@ -29,25 +29,33 @@
 import jakarta.persistence.*;
 
 @Entity
-@NamedQuery(name = UserTaskInstanceEntity.GET_INSTANCES_BY_IDENTITY,
-query = "select userTask from UserTaskInstanceEntity userTask " +
-"left join userTask.adminGroups adminGroup " +
-"left join userTask.potentialGroups potentialGroup " +
-"where :userId member of userTask.adminUsers " +
-"or adminGroup in (:roles) " +
-"or userTask.actualOwner = :userId " +
-"or (userTask.actualOwner is null " + // checking if task is 
not reserved, we cannot check by status since lifecycle can be customized
-"and :userId not member of userTask.excludedUsers " +
-"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles)" +
-"))")
 @NamedNativeQuery(
 name = UserTaskInstanceEntity.DELETE_BY_ID,
 query = "delete from jbpm_user_tasks where id = :taskId")
 @Table(name = "jbpm_user_tasks")
 public class UserTaskInstanceEntity {
-public static final String GET_INSTANCES_BY_IDENTITY = 
"UserTaskInstanceEntity.GetInstanceByIdentity";
 public static final String DELETE_BY_ID = 
"UserTaskInstanceEntity.DeleteById";
 
+// Base query for finding instances by identity (without status filter)
+public static final String BASE_IDENTITY_QUERY =
+"select userTask from UserTaskInstanceEntity userTask " +
+"left join userTask.adminGroups adminGroup " +
+"left join userTask.potentialGroups potentialGroup " +
+"where (:userId member of userTask.adminUsers " +
+"or adminGroup in (:roles) " +
+"or userTask.actualOwner = :userId " +
+"or (userTask.actualOwner is null " + // checking if task 
is not reserved, we cannot check by status since lifecycle can be customized
+"and :userId not member of userTask.excludedUsers " +
+"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles " +
+"and (cast(:processId as string) is null or 
userTask.processInfo.processId = :processId) " +
+"and (cast(:processInstanceId as string) is null or 
userTask.processInfo.processInstanceId = :processInstanceId)";
+
+// TaskName filter clause - case-insensitive (conditional to avoid bytea 
issues)
+public static final String TASKNAME_FILTER_CLAUSE = " and 
lower(userTask.taskName) like lower(concat('%', :taskName, '%'))";

Review Comment:
   Made taskname filter case sensitive and exact match 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-02 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3342135001


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/JPAUserTaskInstances.java:
##
@@ -61,6 +62,15 @@ public List 
findByIdentity(IdentityProvider identityProvider)
 .toList();
 }
 
+@Override
+public List findByIdentity(IdentityProvider 
identityProvider, UserTaskFilter filter) {

Review Comment:
   comment addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-02 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3342131036


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/model/UserTaskInstanceEntity.java:
##
@@ -29,25 +29,33 @@
 import jakarta.persistence.*;
 
 @Entity
-@NamedQuery(name = UserTaskInstanceEntity.GET_INSTANCES_BY_IDENTITY,
-query = "select userTask from UserTaskInstanceEntity userTask " +
-"left join userTask.adminGroups adminGroup " +
-"left join userTask.potentialGroups potentialGroup " +
-"where :userId member of userTask.adminUsers " +
-"or adminGroup in (:roles) " +
-"or userTask.actualOwner = :userId " +
-"or (userTask.actualOwner is null " + // checking if task is 
not reserved, we cannot check by status since lifecycle can be customized
-"and :userId not member of userTask.excludedUsers " +
-"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles)" +
-"))")
 @NamedNativeQuery(
 name = UserTaskInstanceEntity.DELETE_BY_ID,
 query = "delete from jbpm_user_tasks where id = :taskId")
 @Table(name = "jbpm_user_tasks")
 public class UserTaskInstanceEntity {
-public static final String GET_INSTANCES_BY_IDENTITY = 
"UserTaskInstanceEntity.GetInstanceByIdentity";
 public static final String DELETE_BY_ID = 
"UserTaskInstanceEntity.DeleteById";
 
+// Base query for finding instances by identity (without status filter)
+public static final String BASE_IDENTITY_QUERY =
+"select userTask from UserTaskInstanceEntity userTask " +
+"left join userTask.adminGroups adminGroup " +
+"left join userTask.potentialGroups potentialGroup " +
+"where (:userId member of userTask.adminUsers " +
+"or adminGroup in (:roles) " +
+"or userTask.actualOwner = :userId " +
+"or (userTask.actualOwner is null " + // checking if task 
is not reserved, we cannot check by status since lifecycle can be customized
+"and :userId not member of userTask.excludedUsers " +
+"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles " +
+"and (cast(:processId as string) is null or 
userTask.processInfo.processId = :processId) " +
+"and (cast(:processInstanceId as string) is null or 
userTask.processInfo.processInstanceId = :processInstanceId)";
+
+// TaskName filter clause - case-insensitive (conditional to avoid bytea 
issues)
+public static final String TASKNAME_FILTER_CLAUSE = " and 
lower(userTask.taskName) like lower(concat('%', :taskName, '%'))";

Review Comment:
   Made taskname filter casensensitive and exact match



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-01 Thread via GitHub


pefernan commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3335609528


##
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/usertask/RestResourceUserTaskSpringTemplate.java:
##
@@ -92,15 +99,54 @@ public void init() {
 }
 
 @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE, consumes = 
MediaType.ALL_VALUE)
-public List list(
-@RequestParam(value = "user", required = false) String user, 
-@RequestParam(value = "group", required = false) List 
groups) {
-return 
userTaskService.list(identityProviderFactory.getOrImpersonateIdentity(user, 
groups));
+public Object list(
+@RequestParam(value = "user", required = false) String user,
+@RequestParam(value = "group", required = false) List 
groups,
+@RequestParam(value = "format", required = false) String format,
+@RequestParam(value = "processId", required = false) String 
processId,
+@RequestParam(value = "processInstanceId", required = false) 
String processInstanceId,
+@RequestParam(value = "status", required = false) List 
status,
+@RequestParam(value = "taskName", required = false) String 
taskName) {

Review Comment:
   Task Name is a business name that the user gives to a task (or tasks), I 
think it is good to have it here. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-01 Thread via GitHub


pefernan commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3335605838


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/model/UserTaskInstanceEntity.java:
##
@@ -29,25 +29,33 @@
 import jakarta.persistence.*;
 
 @Entity
-@NamedQuery(name = UserTaskInstanceEntity.GET_INSTANCES_BY_IDENTITY,
-query = "select userTask from UserTaskInstanceEntity userTask " +
-"left join userTask.adminGroups adminGroup " +
-"left join userTask.potentialGroups potentialGroup " +
-"where :userId member of userTask.adminUsers " +
-"or adminGroup in (:roles) " +
-"or userTask.actualOwner = :userId " +
-"or (userTask.actualOwner is null " + // checking if task is 
not reserved, we cannot check by status since lifecycle can be customized
-"and :userId not member of userTask.excludedUsers " +
-"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles)" +
-"))")
 @NamedNativeQuery(
 name = UserTaskInstanceEntity.DELETE_BY_ID,
 query = "delete from jbpm_user_tasks where id = :taskId")
 @Table(name = "jbpm_user_tasks")
 public class UserTaskInstanceEntity {
-public static final String GET_INSTANCES_BY_IDENTITY = 
"UserTaskInstanceEntity.GetInstanceByIdentity";
 public static final String DELETE_BY_ID = 
"UserTaskInstanceEntity.DeleteById";
 
+// Base query for finding instances by identity (without status filter)
+public static final String BASE_IDENTITY_QUERY =
+"select userTask from UserTaskInstanceEntity userTask " +
+"left join userTask.adminGroups adminGroup " +
+"left join userTask.potentialGroups potentialGroup " +
+"where (:userId member of userTask.adminUsers " +
+"or adminGroup in (:roles) " +
+"or userTask.actualOwner = :userId " +
+"or (userTask.actualOwner is null " + // checking if task 
is not reserved, we cannot check by status since lifecycle can be customized
+"and :userId not member of userTask.excludedUsers " +
+"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles " +
+"and (cast(:processId as string) is null or 
userTask.processInfo.processId = :processId) " +
+"and (cast(:processInstanceId as string) is null or 
userTask.processInfo.processInstanceId = :processInstanceId)";
+
+// TaskName filter clause - case-insensitive (conditional to avoid bytea 
issues)
+public static final String TASKNAME_FILTER_CLAUSE = " and 
lower(userTask.taskName) like lower(concat('%', :taskName, '%'))";

Review Comment:
   maybe we should add more indexes to our schema with this new feature



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-01 Thread via GitHub


pefernan commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3335592605


##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskInfo.java:
##
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.usertask;
+
+import java.util.Objects;
+
+import org.kie.kogito.usertask.lifecycle.UserTaskState;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+/**
+ * Lightweight data transfer object for user task list operations.
+ * Contains only essential task information without inputs, outputs, or 
metadata.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class UserTaskInfo {

Review Comment:
   I think the idea is have a reduced view of the usertask to not return all 
task information unless it is required (metadata, inputs, outputs...)
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-01 Thread via GitHub


pefernan commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3335587901


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/JPAUserTaskInstances.java:
##
@@ -61,6 +62,15 @@ public List 
findByIdentity(IdentityProvider identityProvider)
 .toList();
 }
 
+@Override
+public List findByIdentity(IdentityProvider 
identityProvider, UserTaskFilter filter) {

Review Comment:
   +1



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-01 Thread via GitHub


pefernan commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3335585316


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/model/UserTaskInstanceEntity.java:
##
@@ -29,25 +29,33 @@
 import jakarta.persistence.*;
 
 @Entity
-@NamedQuery(name = UserTaskInstanceEntity.GET_INSTANCES_BY_IDENTITY,
-query = "select userTask from UserTaskInstanceEntity userTask " +
-"left join userTask.adminGroups adminGroup " +
-"left join userTask.potentialGroups potentialGroup " +
-"where :userId member of userTask.adminUsers " +
-"or adminGroup in (:roles) " +
-"or userTask.actualOwner = :userId " +
-"or (userTask.actualOwner is null " + // checking if task is 
not reserved, we cannot check by status since lifecycle can be customized
-"and :userId not member of userTask.excludedUsers " +
-"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles)" +
-"))")
 @NamedNativeQuery(
 name = UserTaskInstanceEntity.DELETE_BY_ID,
 query = "delete from jbpm_user_tasks where id = :taskId")
 @Table(name = "jbpm_user_tasks")
 public class UserTaskInstanceEntity {
-public static final String GET_INSTANCES_BY_IDENTITY = 
"UserTaskInstanceEntity.GetInstanceByIdentity";
 public static final String DELETE_BY_ID = 
"UserTaskInstanceEntity.DeleteById";
 
+// Base query for finding instances by identity (without status filter)
+public static final String BASE_IDENTITY_QUERY =
+"select userTask from UserTaskInstanceEntity userTask " +
+"left join userTask.adminGroups adminGroup " +
+"left join userTask.potentialGroups potentialGroup " +
+"where (:userId member of userTask.adminUsers " +
+"or adminGroup in (:roles) " +
+"or userTask.actualOwner = :userId " +
+"or (userTask.actualOwner is null " + // checking if task 
is not reserved, we cannot check by status since lifecycle can be customized
+"and :userId not member of userTask.excludedUsers " +
+"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles " +
+"and (cast(:processId as string) is null or 
userTask.processInfo.processId = :processId) " +
+"and (cast(:processInstanceId as string) is null or 
userTask.processInfo.processInstanceId = :processInstanceId)";
+
+// TaskName filter clause - case-insensitive (conditional to avoid bytea 
issues)
+public static final String TASKNAME_FILTER_CLAUSE = " and 
lower(userTask.taskName) like lower(concat('%', :taskName, '%'))";

Review Comment:
   To be clear, I'd go with exact matches and would try to rely in DB indexes 
as much as possible



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-01 Thread via GitHub


martinweiler commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3335472147


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/model/UserTaskInstanceEntity.java:
##
@@ -29,25 +29,33 @@
 import jakarta.persistence.*;
 
 @Entity
-@NamedQuery(name = UserTaskInstanceEntity.GET_INSTANCES_BY_IDENTITY,
-query = "select userTask from UserTaskInstanceEntity userTask " +
-"left join userTask.adminGroups adminGroup " +
-"left join userTask.potentialGroups potentialGroup " +
-"where :userId member of userTask.adminUsers " +
-"or adminGroup in (:roles) " +
-"or userTask.actualOwner = :userId " +
-"or (userTask.actualOwner is null " + // checking if task is 
not reserved, we cannot check by status since lifecycle can be customized
-"and :userId not member of userTask.excludedUsers " +
-"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles)" +
-"))")
 @NamedNativeQuery(
 name = UserTaskInstanceEntity.DELETE_BY_ID,
 query = "delete from jbpm_user_tasks where id = :taskId")
 @Table(name = "jbpm_user_tasks")
 public class UserTaskInstanceEntity {
-public static final String GET_INSTANCES_BY_IDENTITY = 
"UserTaskInstanceEntity.GetInstanceByIdentity";
 public static final String DELETE_BY_ID = 
"UserTaskInstanceEntity.DeleteById";
 
+// Base query for finding instances by identity (without status filter)
+public static final String BASE_IDENTITY_QUERY =
+"select userTask from UserTaskInstanceEntity userTask " +
+"left join userTask.adminGroups adminGroup " +
+"left join userTask.potentialGroups potentialGroup " +
+"where (:userId member of userTask.adminUsers " +
+"or adminGroup in (:roles) " +
+"or userTask.actualOwner = :userId " +
+"or (userTask.actualOwner is null " + // checking if task 
is not reserved, we cannot check by status since lifecycle can be customized
+"and :userId not member of userTask.excludedUsers " +
+"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles " +
+"and (cast(:processId as string) is null or 
userTask.processInfo.processId = :processId) " +
+"and (cast(:processInstanceId as string) is null or 
userTask.processInfo.processInstanceId = :processInstanceId)";
+
+// TaskName filter clause - case-insensitive (conditional to avoid bytea 
issues)
+public static final String TASKNAME_FILTER_CLAUSE = " and 
lower(userTask.taskName) like lower(concat('%', :taskName, '%'))";

Review Comment:
   You are raising some valid concerns about potential performance issues. We 
also don't have an actual request to support `like` queries.
   
   @GopikaReghunath please adjust the code accordingly. Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-06-01 Thread via GitHub


pefernan commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3335450529


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/model/UserTaskInstanceEntity.java:
##
@@ -29,25 +29,33 @@
 import jakarta.persistence.*;
 
 @Entity
-@NamedQuery(name = UserTaskInstanceEntity.GET_INSTANCES_BY_IDENTITY,
-query = "select userTask from UserTaskInstanceEntity userTask " +
-"left join userTask.adminGroups adminGroup " +
-"left join userTask.potentialGroups potentialGroup " +
-"where :userId member of userTask.adminUsers " +
-"or adminGroup in (:roles) " +
-"or userTask.actualOwner = :userId " +
-"or (userTask.actualOwner is null " + // checking if task is 
not reserved, we cannot check by status since lifecycle can be customized
-"and :userId not member of userTask.excludedUsers " +
-"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles)" +
-"))")
 @NamedNativeQuery(
 name = UserTaskInstanceEntity.DELETE_BY_ID,
 query = "delete from jbpm_user_tasks where id = :taskId")
 @Table(name = "jbpm_user_tasks")
 public class UserTaskInstanceEntity {
-public static final String GET_INSTANCES_BY_IDENTITY = 
"UserTaskInstanceEntity.GetInstanceByIdentity";
 public static final String DELETE_BY_ID = 
"UserTaskInstanceEntity.DeleteById";
 
+// Base query for finding instances by identity (without status filter)
+public static final String BASE_IDENTITY_QUERY =
+"select userTask from UserTaskInstanceEntity userTask " +
+"left join userTask.adminGroups adminGroup " +
+"left join userTask.potentialGroups potentialGroup " +
+"where (:userId member of userTask.adminUsers " +
+"or adminGroup in (:roles) " +
+"or userTask.actualOwner = :userId " +
+"or (userTask.actualOwner is null " + // checking if task 
is not reserved, we cannot check by status since lifecycle can be customized
+"and :userId not member of userTask.excludedUsers " +
+"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles " +
+"and (cast(:processId as string) is null or 
userTask.processInfo.processId = :processId) " +
+"and (cast(:processInstanceId as string) is null or 
userTask.processInfo.processInstanceId = :processInstanceId)";
+
+// TaskName filter clause - case-insensitive (conditional to avoid bytea 
issues)
+public static final String TASKNAME_FILTER_CLAUSE = " and 
lower(userTask.taskName) like lower(concat('%', :taskName, '%'))";

Review Comment:
   I have some feelings about this too, I'm afraid this will perform very bad 
with a large amount of tasks in DB. I'd prefer use not use partial and 
lowercase here. I think that it's better to go for equality in a first 
iteration and we can see if we need to evolve later if we get feedback on this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-28 Thread via GitHub


jstastny-cz commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3316154726


##
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/usertask/RestResourceUserTaskSpringTemplate.java:
##
@@ -92,15 +99,54 @@ public void init() {
 }
 
 @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE, consumes = 
MediaType.ALL_VALUE)
-public List list(
-@RequestParam(value = "user", required = false) String user, 
-@RequestParam(value = "group", required = false) List 
groups) {
-return 
userTaskService.list(identityProviderFactory.getOrImpersonateIdentity(user, 
groups));
+public Object list(
+@RequestParam(value = "user", required = false) String user,
+@RequestParam(value = "group", required = false) List 
groups,
+@RequestParam(value = "format", required = false) String format,
+@RequestParam(value = "processId", required = false) String 
processId,
+@RequestParam(value = "processInstanceId", required = false) 
String processInstanceId,
+@RequestParam(value = "status", required = false) List 
status,
+@RequestParam(value = "taskName", required = false) String 
taskName) {

Review Comment:
   What is the rationale behind using task name (free form text) as the 
filtering parameter for a task? Why not use user task id instead?
   With this choice and allowing partial match, IMHO you're beating the 
"selling" point calling this performance optimization.
   When checking jbpm_user_tasks table I can see index only on id column and 
user_task_id:
   ```
  "jbpm_user_tasks_pkey" PRIMARY KEY, btree (id)
  "idx_usertasks_tid" btree (user_task_id)
   ```
   So those are IMHO the only ones to be queried in performant and optimized 
way.
   Even if the task name column was indexed - the partial match and concat SQL 
functions might prevent the query from hitting the index at all.
   
   Problem with user_task_id is that the KIE editor might allow only generated 
values - but that's IMHO a room for improvement on that front, I don't think it 
needs to be restricted to that.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-28 Thread via GitHub


jstastny-cz commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3315993957


##
api/kogito-api/src/main/java/org/kie/kogito/usertask/view/UserTaskInputsView.java:
##
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.usertask.view;
+
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+/**
+ * Lightweight view for user task inputs.
+ * Used by PUT /usertasks/instance/{id}/inputs endpoint to return only input 
data.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class UserTaskInputsView {

Review Comment:
   This was an explicit ask during reviews, resolving.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-27 Thread via GitHub


jstastny-cz commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3311434064


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/model/UserTaskInstanceEntity.java:
##
@@ -29,25 +29,33 @@
 import jakarta.persistence.*;
 
 @Entity
-@NamedQuery(name = UserTaskInstanceEntity.GET_INSTANCES_BY_IDENTITY,
-query = "select userTask from UserTaskInstanceEntity userTask " +
-"left join userTask.adminGroups adminGroup " +
-"left join userTask.potentialGroups potentialGroup " +
-"where :userId member of userTask.adminUsers " +
-"or adminGroup in (:roles) " +
-"or userTask.actualOwner = :userId " +
-"or (userTask.actualOwner is null " + // checking if task is 
not reserved, we cannot check by status since lifecycle can be customized
-"and :userId not member of userTask.excludedUsers " +
-"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles)" +
-"))")
 @NamedNativeQuery(
 name = UserTaskInstanceEntity.DELETE_BY_ID,
 query = "delete from jbpm_user_tasks where id = :taskId")
 @Table(name = "jbpm_user_tasks")
 public class UserTaskInstanceEntity {
-public static final String GET_INSTANCES_BY_IDENTITY = 
"UserTaskInstanceEntity.GetInstanceByIdentity";
 public static final String DELETE_BY_ID = 
"UserTaskInstanceEntity.DeleteById";
 
+// Base query for finding instances by identity (without status filter)
+public static final String BASE_IDENTITY_QUERY =
+"select userTask from UserTaskInstanceEntity userTask " +
+"left join userTask.adminGroups adminGroup " +
+"left join userTask.potentialGroups potentialGroup " +
+"where (:userId member of userTask.adminUsers " +
+"or adminGroup in (:roles) " +
+"or userTask.actualOwner = :userId " +
+"or (userTask.actualOwner is null " + // checking if task 
is not reserved, we cannot check by status since lifecycle can be customized
+"and :userId not member of userTask.excludedUsers " +
+"and (:userId member of userTask.potentialUsers or 
potentialGroup in (:roles " +
+"and (cast(:processId as string) is null or 
userTask.processInfo.processId = :processId) " +
+"and (cast(:processInstanceId as string) is null or 
userTask.processInfo.processInstanceId = :processInstanceId)";
+
+// TaskName filter clause - case-insensitive (conditional to avoid bytea 
issues)
+public static final String TASKNAME_FILTER_CLAUSE = " and 
lower(userTask.taskName) like lower(concat('%', :taskName, '%'))";

Review Comment:
   do these TASKNAME and STATUS filters hit DB index or resorts in skipping 
them (concat is always a problem) ?



##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskInfo.java:
##
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.usertask;
+
+import java.util.Objects;
+
+import org.kie.kogito.usertask.lifecycle.UserTaskState;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+/**
+ * Lightweight data transfer object for user task list operations.
+ * Contains only essential task information without inputs, outputs, or 
metadata.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class UserTaskInfo {

Review Comment:
   why isn't existing UserTaskView enough? Seems like we're creating new 
view/dto for each case, this might come out of hands soon.



##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/JPAUserTaskInstances.java:
##
@@ -61,6 +62,15 @@ public List 
findByIdentity(IdentityProvider identityProvider)
 .toList();
 }
 
+@Override
+public List findByIdentity(IdentityProvider 
identityProvider, UserTaskFilter filter) {

Review Comment:
   shouldn't `findByIdentity(IdentityProvider identityProvider)` call this 
overload with null filter parame

Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-27 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3310740352


##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskFilter.java:
##
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.usertask;
+
+import java.util.List;
+
+import org.kie.kogito.usertask.lifecycle.UserTaskState;
+
+/**
+ * Filter criteria for querying user tasks.
+ * All filters are combined using AND logic.
+ * Null filters are ignored (no filtering applied for that criterion).
+ */
+public class UserTaskFilter {

Review Comment:
   comment addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-27 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3310741342


##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskInstances.java:
##
@@ -32,6 +32,8 @@ public interface UserTaskInstances {
 
 List findByIdentity(IdentityProvider identityProvider);
 
+List findByIdentityAndFilter(IdentityProvider 
identityProvider, UserTaskFilter filter);

Review Comment:
   comment addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-27 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3310738015


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/repository/UserTaskInstanceRepository.java:
##
@@ -42,6 +52,73 @@ public List 
findByIdentity(IdentityProvider identityProv
 return query.getResultList();
 }
 
+public List 
findByIdentityAndFilter(IdentityProvider identityProvider, UserTaskFilter 
filter) {
+// If no filter, use the optimized named query
+if (filter == null) {
+return findByIdentity(identityProvider);
+}
+
+// Build single query combining identity and filter predicates using 
Criteria API
+CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
+CriteriaQuery cq = 
cb.createQuery(UserTaskInstanceEntity.class);

Review Comment:
   comment addressed



##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/repository/UserTaskInstanceRepository.java:
##
@@ -42,6 +52,73 @@ public List 
findByIdentity(IdentityProvider identityProv
 return query.getResultList();
 }
 
+public List 
findByIdentityAndFilter(IdentityProvider identityProvider, UserTaskFilter 
filter) {
+// If no filter, use the optimized named query
+if (filter == null) {
+return findByIdentity(identityProvider);

Review Comment:
   comment addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-19 Thread via GitHub


jstastny-cz commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3271458623


##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskFilter.java:
##
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.usertask;
+
+import java.util.List;
+
+import org.kie.kogito.usertask.lifecycle.UserTaskState;
+
+/**
+ * Filter criteria for querying user tasks.
+ * All filters are combined using AND logic.
+ * Null filters are ignored (no filtering applied for that criterion).
+ */
+public class UserTaskFilter {

Review Comment:
   This can be a record instead of class + builder. It does not have any 
additional behavior, just getters and instance creation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-19 Thread via GitHub


jstastny-cz commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3271440610


##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/repository/UserTaskInstanceRepository.java:
##
@@ -42,6 +52,73 @@ public List 
findByIdentity(IdentityProvider identityProv
 return query.getResultList();
 }
 
+public List 
findByIdentityAndFilter(IdentityProvider identityProvider, UserTaskFilter 
filter) {
+// If no filter, use the optimized named query
+if (filter == null) {
+return findByIdentity(identityProvider);
+}
+
+// Build single query combining identity and filter predicates using 
Criteria API
+CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
+CriteriaQuery cq = 
cb.createQuery(UserTaskInstanceEntity.class);

Review Comment:
   I would advice not mixing approaches JPQL and Criteria query. Enough that we 
have such differentiation between components, but bringing it into a single 
class basically means we have to manage duplicate implementations.



##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskFilter.java:
##
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.usertask;
+
+import java.util.List;
+
+import org.kie.kogito.usertask.lifecycle.UserTaskState;
+
+/**
+ * Filter criteria for querying user tasks.
+ * All filters are combined using AND logic.
+ * Null filters are ignored (no filtering applied for that criterion).
+ */
+public class UserTaskFilter {

Review Comment:
   This can be a record instead class + builder. It does not have any 
additional behavior, just getters and instance creation.



##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskInstances.java:
##
@@ -32,6 +32,8 @@ public interface UserTaskInstances {
 
 List findByIdentity(IdentityProvider identityProvider);
 
+List findByIdentityAndFilter(IdentityProvider 
identityProvider, UserTaskFilter filter);

Review Comment:
   As apparent from implementation, isn't this rather overload of 
findByIdentity? As it falls back to call that when filter is not provided.



##
api/kogito-api/src/main/java/org/kie/kogito/usertask/UserTaskInfo.java:
##
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.usertask;
+
+import org.kie.kogito.usertask.lifecycle.UserTaskState;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+/**
+ * Lightweight data transfer object for user task list operations.
+ * Contains only essential task information without inputs, outputs, or 
metadata.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class UserTaskInfo {

Review Comment:
   Don't we need equals and hashcode for DTOs?



##
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/repository/UserTaskInstanceRepository.java:
##
@@ -42,6 +52,73 @@ public List 
findByIdentity(IdentityProvider identityProv
 return query.getResultList();
 }
 
+public List 
findByIdentityAndFilter(IdentityProvider identityProvider, UserTaskFilter 
filter) {
+// If no filter, use the optimized named query
+if (filter == null) {
+return findByIdentity(identityProvider);

Review Comment:
   This seems as if this method should be o

Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-18 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3257414002


##
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/usertask/RestResourceUserTaskQuarkusTemplate.java:
##
@@ -273,4 +333,65 @@ public Attachment getAttachment(
 .orElseThrow(() -> new 
UserTaskInstanceNotFoundException("Attachment " + attachmentId + " not found"));
 }
 
+@GET
+@Path("/{taskName}/schema")
+@Produces(MediaType.APPLICATION_JSON)
+public Map getSchemaByTaskName(
+@PathParam("taskName") String taskName,
+@QueryParam("user") String user,
+@QueryParam("group") List groups) {

Review Comment:
   The schema endpoints has been removed as discussed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-14 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3246338402


##
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/usertask/RestResourceUserTaskQuarkusTemplate.java:
##
@@ -273,4 +333,65 @@ public Attachment getAttachment(
 .orElseThrow(() -> new 
UserTaskInstanceNotFoundException("Attachment " + attachmentId + " not found"));
 }
 
+@GET
+@Path("/{taskName}/schema")
+@Produces(MediaType.APPLICATION_JSON)
+public Map getSchemaByTaskName(
+@PathParam("taskName") String taskName,
+@QueryParam("user") String user,
+@QueryParam("group") List groups) {

Review Comment:
   We tried the scenarios as mentioned by @josedee  and below observations were 
made example used is process-user-tasks-subsystem (hiring.bpmn is the process)
   
   Two different processes with same task name and different schema
created a test process (test.bpmn) with taskName hr_interview 
input: interview_in output: interview_out, while hitting schema endpoint with 
taskName as hr_interview only the schema details from hiring.bpmn process is 
returned and the test process is ignored
   
   Same process with two tasks with same task name
To test this we renamed it_interview to hr_interview in 
hiring.bpmn (The input/output of both these tasks are different the original 
hr_interview has hr_approval while it_interview which is renamed to 
hr_interview has it_approval) and hit the schema endpoint. The response had 
both it_approval and hr_approval, Attaching a sample response for second 
scenario 
   
   `URL : http://localhost:8080/usertasks/hr_interview/schema`

   `{
 "$schema": "https://json-schema.org/draft/2019-09/schema";,
 "$defs": {
   "Candidate": {
 "type": "object",
 "properties": {
   "firstName": {
 "type": "string"
   },
   "lastName": {
 "type": "string"
   },
   "position": {
 "type": "string"
   }
 }
   }
 },
 "type": "object",
 "properties": {
   "candidate": {
 "$ref": "#/$defs/Candidate",
 "input": true
   },
   "it_approval": {
 "type": "boolean",
 "input": true,
 "output": true
   },
   "hr_approval": {
 "type": "boolean",
 "input": true,
 "output": true
   }
 }
   }`
   
   cc: @martinweiler @pefernan 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-14 Thread via GitHub


josedee commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3241249849


##
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/usertask/RestResourceUserTaskQuarkusTemplate.java:
##
@@ -273,4 +333,65 @@ public Attachment getAttachment(
 .orElseThrow(() -> new 
UserTaskInstanceNotFoundException("Attachment " + attachmentId + " not found"));
 }
 
+@GET
+@Path("/{taskName}/schema")
+@Produces(MediaType.APPLICATION_JSON)
+public Map getSchemaByTaskName(
+@PathParam("taskName") String taskName,
+@QueryParam("user") String user,
+@QueryParam("group") List groups) {

Review Comment:
   @GopikaReghunath I have my doubts over this implementation. What happens if 
we have
   - Two different processes with same task name and different schema
   - Same process with two tasks with same task name
   
   Aren't these scenarios possible. Shouldn't we use something unique like task 
definition id
   
   cc: @martinweiler @pefernan Would like to hear your thoughts



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-13 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3239068604


##
quarkus/integration-tests/integration-tests-quarkus-usertasks/src/test/java/org/jbpm/userTask/jpa/it/UserTaskFilterIT.java:
##
@@ -0,0 +1,395 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jbpm.userTask.jpa.it;
+
+import java.util.List;
+
+import org.acme.travels.Address;
+import org.acme.travels.Traveller;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.http.ContentType;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.hasItem;
+
+/**
+ * Integration test for user task filtering functionality.
+ * Tests the filter query parameters on the /usertasks/instance endpoint.
+ */
+@QuarkusIntegrationTest
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class, 
restrictToAnnotatedClass = true)
+public class UserTaskFilterIT extends BaseUserTaskIT {
+
+@AfterEach
+public void cleanUp() {
+// Get all process instances and delete them to ensure test isolation
+List processInstanceIds = given()
+.contentType(ContentType.JSON)
+.when()
+.get("/{processId}", PROCESS_ID)
+.then()
+.extract()
+.jsonPath()
+.getList("id", String.class);
+
+processInstanceIds.forEach(processInstanceId -> {
+given()
+.contentType(ContentType.JSON)
+.when()
+.delete("/{processId}/{processInstanceId}", PROCESS_ID, 
processInstanceId)
+.then()
+.statusCode(200);
+});
+}
+
+@Test
+public void testFilterByProcessId() {
+// Given - Start two process instances
+Traveller traveller1 = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+Traveller traveller2 = new Traveller("Jane", "Smith", 
"[email protected]", "Canadian",
+new Address("second street", "Toronto", "20005", "CA"));
+
+startProcessInstance(traveller1);
+startProcessInstance(traveller2);
+
+// When - Query with processId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processId", PROCESS_ID)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(2))
+.body("[0].processInfo.processId", is(PROCESS_ID))
+.body("[1].processInfo.processId", is(PROCESS_ID));
+}
+
+@Test
+public void testFilterByProcessInstanceId() {
+// Given - Start a process instance
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+String pid = startProcessInstance(traveller);
+
+// When - Query with processInstanceId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processInstanceId", pid)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(1))
+.body("[0].processInfo.processInstanceId", is(pid));
+}
+
+@Test
+public void testFilterByStatus() {
+// Given - Start a process instance (creates task in Reserved status)
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+

Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-13 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3234408068


##
quarkus/integration-tests/integration-tests-quarkus-usertasks/src/test/java/org/jbpm/userTask/jpa/it/UserTaskFilterIT.java:
##
@@ -0,0 +1,395 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jbpm.userTask.jpa.it;
+
+import java.util.List;
+
+import org.acme.travels.Address;
+import org.acme.travels.Traveller;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.http.ContentType;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.hasItem;
+
+/**
+ * Integration test for user task filtering functionality.
+ * Tests the filter query parameters on the /usertasks/instance endpoint.
+ */
+@QuarkusIntegrationTest
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class, 
restrictToAnnotatedClass = true)
+public class UserTaskFilterIT extends BaseUserTaskIT {
+
+@AfterEach
+public void cleanUp() {
+// Get all process instances and delete them to ensure test isolation
+List processInstanceIds = given()
+.contentType(ContentType.JSON)
+.when()
+.get("/{processId}", PROCESS_ID)
+.then()
+.extract()
+.jsonPath()
+.getList("id", String.class);
+
+processInstanceIds.forEach(processInstanceId -> {
+given()
+.contentType(ContentType.JSON)
+.when()
+.delete("/{processId}/{processInstanceId}", PROCESS_ID, 
processInstanceId)
+.then()
+.statusCode(200);
+});
+}
+
+@Test
+public void testFilterByProcessId() {
+// Given - Start two process instances
+Traveller traveller1 = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+Traveller traveller2 = new Traveller("Jane", "Smith", 
"[email protected]", "Canadian",
+new Address("second street", "Toronto", "20005", "CA"));
+
+startProcessInstance(traveller1);
+startProcessInstance(traveller2);
+
+// When - Query with processId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processId", PROCESS_ID)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(2))
+.body("[0].processInfo.processId", is(PROCESS_ID))
+.body("[1].processInfo.processId", is(PROCESS_ID));
+}
+
+@Test
+public void testFilterByProcessInstanceId() {
+// Given - Start a process instance
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+String pid = startProcessInstance(traveller);
+
+// When - Query with processInstanceId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processInstanceId", pid)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(1))
+.body("[0].processInfo.processInstanceId", is(pid));
+}
+
+@Test
+public void testFilterByStatus() {
+// Given - Start a process instance (creates task in Reserved status)
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+

Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-13 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3234408068


##
quarkus/integration-tests/integration-tests-quarkus-usertasks/src/test/java/org/jbpm/userTask/jpa/it/UserTaskFilterIT.java:
##
@@ -0,0 +1,395 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jbpm.userTask.jpa.it;
+
+import java.util.List;
+
+import org.acme.travels.Address;
+import org.acme.travels.Traveller;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.http.ContentType;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.hasItem;
+
+/**
+ * Integration test for user task filtering functionality.
+ * Tests the filter query parameters on the /usertasks/instance endpoint.
+ */
+@QuarkusIntegrationTest
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class, 
restrictToAnnotatedClass = true)
+public class UserTaskFilterIT extends BaseUserTaskIT {
+
+@AfterEach
+public void cleanUp() {
+// Get all process instances and delete them to ensure test isolation
+List processInstanceIds = given()
+.contentType(ContentType.JSON)
+.when()
+.get("/{processId}", PROCESS_ID)
+.then()
+.extract()
+.jsonPath()
+.getList("id", String.class);
+
+processInstanceIds.forEach(processInstanceId -> {
+given()
+.contentType(ContentType.JSON)
+.when()
+.delete("/{processId}/{processInstanceId}", PROCESS_ID, 
processInstanceId)
+.then()
+.statusCode(200);
+});
+}
+
+@Test
+public void testFilterByProcessId() {
+// Given - Start two process instances
+Traveller traveller1 = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+Traveller traveller2 = new Traveller("Jane", "Smith", 
"[email protected]", "Canadian",
+new Address("second street", "Toronto", "20005", "CA"));
+
+startProcessInstance(traveller1);
+startProcessInstance(traveller2);
+
+// When - Query with processId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processId", PROCESS_ID)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(2))
+.body("[0].processInfo.processId", is(PROCESS_ID))
+.body("[1].processInfo.processId", is(PROCESS_ID));
+}
+
+@Test
+public void testFilterByProcessInstanceId() {
+// Given - Start a process instance
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+String pid = startProcessInstance(traveller);
+
+// When - Query with processInstanceId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processInstanceId", pid)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(1))
+.body("[0].processInfo.processInstanceId", is(pid));
+}
+
+@Test
+public void testFilterByStatus() {
+// Given - Start a process instance (creates task in Reserved status)
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+

Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-13 Thread via GitHub


martinweiler commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3234478519


##
quarkus/integration-tests/integration-tests-quarkus-usertasks/src/test/java/org/jbpm/userTask/jpa/it/UserTaskFilterIT.java:
##
@@ -0,0 +1,395 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jbpm.userTask.jpa.it;
+
+import java.util.List;
+
+import org.acme.travels.Address;
+import org.acme.travels.Traveller;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.http.ContentType;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.hasItem;
+
+/**
+ * Integration test for user task filtering functionality.
+ * Tests the filter query parameters on the /usertasks/instance endpoint.
+ */
+@QuarkusIntegrationTest
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class, 
restrictToAnnotatedClass = true)
+public class UserTaskFilterIT extends BaseUserTaskIT {
+
+@AfterEach
+public void cleanUp() {
+// Get all process instances and delete them to ensure test isolation
+List processInstanceIds = given()
+.contentType(ContentType.JSON)
+.when()
+.get("/{processId}", PROCESS_ID)
+.then()
+.extract()
+.jsonPath()
+.getList("id", String.class);
+
+processInstanceIds.forEach(processInstanceId -> {
+given()
+.contentType(ContentType.JSON)
+.when()
+.delete("/{processId}/{processInstanceId}", PROCESS_ID, 
processInstanceId)
+.then()
+.statusCode(200);
+});
+}
+
+@Test
+public void testFilterByProcessId() {
+// Given - Start two process instances
+Traveller traveller1 = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+Traveller traveller2 = new Traveller("Jane", "Smith", 
"[email protected]", "Canadian",
+new Address("second street", "Toronto", "20005", "CA"));
+
+startProcessInstance(traveller1);
+startProcessInstance(traveller2);
+
+// When - Query with processId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processId", PROCESS_ID)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(2))
+.body("[0].processInfo.processId", is(PROCESS_ID))
+.body("[1].processInfo.processId", is(PROCESS_ID));
+}
+
+@Test
+public void testFilterByProcessInstanceId() {
+// Given - Start a process instance
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+String pid = startProcessInstance(traveller);
+
+// When - Query with processInstanceId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processInstanceId", pid)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(1))
+.body("[0].processInfo.processInstanceId", is(pid));
+}
+
+@Test
+public void testFilterByStatus() {
+// Given - Start a process instance (creates task in Reserved status)
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+   

Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-13 Thread via GitHub


GopikaReghunath commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3234408068


##
quarkus/integration-tests/integration-tests-quarkus-usertasks/src/test/java/org/jbpm/userTask/jpa/it/UserTaskFilterIT.java:
##
@@ -0,0 +1,395 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jbpm.userTask.jpa.it;
+
+import java.util.List;
+
+import org.acme.travels.Address;
+import org.acme.travels.Traveller;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.http.ContentType;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.hasItem;
+
+/**
+ * Integration test for user task filtering functionality.
+ * Tests the filter query parameters on the /usertasks/instance endpoint.
+ */
+@QuarkusIntegrationTest
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class, 
restrictToAnnotatedClass = true)
+public class UserTaskFilterIT extends BaseUserTaskIT {
+
+@AfterEach
+public void cleanUp() {
+// Get all process instances and delete them to ensure test isolation
+List processInstanceIds = given()
+.contentType(ContentType.JSON)
+.when()
+.get("/{processId}", PROCESS_ID)
+.then()
+.extract()
+.jsonPath()
+.getList("id", String.class);
+
+processInstanceIds.forEach(processInstanceId -> {
+given()
+.contentType(ContentType.JSON)
+.when()
+.delete("/{processId}/{processInstanceId}", PROCESS_ID, 
processInstanceId)
+.then()
+.statusCode(200);
+});
+}
+
+@Test
+public void testFilterByProcessId() {
+// Given - Start two process instances
+Traveller traveller1 = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+Traveller traveller2 = new Traveller("Jane", "Smith", 
"[email protected]", "Canadian",
+new Address("second street", "Toronto", "20005", "CA"));
+
+startProcessInstance(traveller1);
+startProcessInstance(traveller2);
+
+// When - Query with processId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processId", PROCESS_ID)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(2))
+.body("[0].processInfo.processId", is(PROCESS_ID))
+.body("[1].processInfo.processId", is(PROCESS_ID));
+}
+
+@Test
+public void testFilterByProcessInstanceId() {
+// Given - Start a process instance
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+String pid = startProcessInstance(traveller);
+
+// When - Query with processInstanceId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processInstanceId", pid)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(1))
+.body("[0].processInfo.processInstanceId", is(pid));
+}
+
+@Test
+public void testFilterByStatus() {
+// Given - Start a process instance (creates task in Reserved status)
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+

Re: [PR] [incubator-kie-issues#2308] Improve usertask endpoint [incubator-kie-kogito-runtimes]

2026-05-13 Thread via GitHub


josedee commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3233535231


##
quarkus/integration-tests/integration-tests-quarkus-usertasks/src/test/java/org/jbpm/userTask/jpa/it/UserTaskFilterIT.java:
##
@@ -0,0 +1,395 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jbpm.userTask.jpa.it;
+
+import java.util.List;
+
+import org.acme.travels.Address;
+import org.acme.travels.Traveller;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.http.ContentType;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.hasItem;
+
+/**
+ * Integration test for user task filtering functionality.
+ * Tests the filter query parameters on the /usertasks/instance endpoint.
+ */
+@QuarkusIntegrationTest
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class, 
restrictToAnnotatedClass = true)
+public class UserTaskFilterIT extends BaseUserTaskIT {
+
+@AfterEach
+public void cleanUp() {
+// Get all process instances and delete them to ensure test isolation
+List processInstanceIds = given()
+.contentType(ContentType.JSON)
+.when()
+.get("/{processId}", PROCESS_ID)
+.then()
+.extract()
+.jsonPath()
+.getList("id", String.class);
+
+processInstanceIds.forEach(processInstanceId -> {
+given()
+.contentType(ContentType.JSON)
+.when()
+.delete("/{processId}/{processInstanceId}", PROCESS_ID, 
processInstanceId)
+.then()
+.statusCode(200);
+});
+}
+
+@Test
+public void testFilterByProcessId() {
+// Given - Start two process instances
+Traveller traveller1 = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+Traveller traveller2 = new Traveller("Jane", "Smith", 
"[email protected]", "Canadian",
+new Address("second street", "Toronto", "20005", "CA"));
+
+startProcessInstance(traveller1);
+startProcessInstance(traveller2);
+
+// When - Query with processId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processId", PROCESS_ID)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(2))
+.body("[0].processInfo.processId", is(PROCESS_ID))
+.body("[1].processInfo.processId", is(PROCESS_ID));
+}
+
+@Test
+public void testFilterByProcessInstanceId() {
+// Given - Start a process instance
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+new Address("main street", "Boston", "10005", "US"));
+String pid = startProcessInstance(traveller);
+
+// When - Query with processInstanceId filter
+given().contentType(ContentType.JSON)
+.queryParam("user", "manager")
+.queryParam("group", "department-managers")
+.queryParam("processInstanceId", pid)
+.when()
+.get(USER_TASKS_ENDPOINT)
+.then()
+.statusCode(200)
+.body("$.size()", is(1))
+.body("[0].processInfo.processInstanceId", is(pid));
+}
+
+@Test
+public void testFilterByStatus() {
+// Given - Start a process instance (creates task in Reserved status)
+Traveller traveller = new Traveller("John", "Doe", 
"[email protected]", "American",
+