-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
False
-
False
-
NEW
-
NEW
-
Undefined
-
---
-
---
-
-
2020 Week 40-42 (from Sep 28), 2020 Week 43-45 (from Okt 19)
we have found a bug in query API, it's rather a edge case.
Here is how to reproduce:
- Design a human task with Groups attribute filled and ExcludedOwnerId set as well
Something like this:
https://github.com/DuncanDoyle/jbpm-four-eyes-process/blob/master/four-eyes-principle/src/main/resources/four-eyes-process.bpmn2
Now try to look for this task using following API:
Now, we are looking for tasks only by Groups, so we don't care about User, and therefore we are setting UserId to null and only passing Groups, it looks like this:
tasks = userTaskServicesClient.findTasksAssignedAsPotentialOwner(null,Arrays.asList("SII_CHECKER"),ACTIVE_TASK_STATUSES,0,100);
So for this particular combination, when task has group as a potential owner, excluded owner is not null, and we are searching for this task with userid == null NO results are returned.
This is because of how SQL queries are written:
https://github.com/kiegroup/jbpm/blob/c398d626110d983d7af3c2e95c7e5228cbb34d32/jbpm-human-task/jbpm-human-task-jpa/src/main/resources/META-INF/Taskorm.xml#L205
that particular line will be translated to this:
and null not in
(
select exclOwner.entity_id
from
PeopleAssignments_ExclOwners exlOwner
where
task.id = exlOwner.task_id
)
and null not in ( "someExcludedOwner" )
which is false, because of SQL three valued logic -> this is causing no results.
If I rewrite it to this:
and '' not in ( select exclOwner.entity_id from PeopleAssignments_ExclOwners exlOwner where task.id = exlOwner.task_id )
i.e. I replaced null with empty string, it is evaluated as true, and it does return results - this is one of the possible solution engineering could try..
[NOTE ENG]
affects as well
TasksAssignedAsPotentialOwnerWithGroups
TasksAssignedAsPotentialOwnerByStatusWithGroups
TasksAssignedAsPotentialOwnerStatusByExpirationDate
TasksAssignedAsPotentialOwnerStatusByExpirationDateOptional
SubTasksAssignedAsPotentialOwner
QuickTasksAssignedAsPotentialOwnerWithGroupsByStatus
QuickTasksAssignedAsPotentialOwnerStatusByExpirationDateOptional
QuickTasksAssignedAsPotentialOwnerStatusByExpirationDate
NewTasksAssignedAsPotentialOwner
NewTasksAssignedAsPotentialOwnerByExpirationDateOptional
NewTasksAssignedAsPotentialOwnerByExpirationDate
- is related to
-
JBPM-9462 Stabilize TaskQueryServiceBaseTest added by JBPM-9426
-
- Resolved
-
- relates to
-
RHPAM-3230 No tasks returned when userId == null, exlOwner !=null and groups !=null
-
- Closed
-