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 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]

Reply via email to