Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-3230

No tasks returned when userId == null, exlOwner !=null and groups !=null

    XMLWordPrintable

Details

    • Bug
    • Status: Verified (View Workflow)
    • Major
    • Resolution: Done
    • None
    • 7.10.0.GA
    • jBPM Core
    • None
    • Red Hat Process Automation Manager
      7.8.1

    • CR1
    • Hide

      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:

      https://github.com/kiegroup/droolsjbpm-integration/blob/master/kie-server-parent/kie-server-remote/kie-server-client/src/main/java/org/kie/server/client/UserTaskServicesClient.java#L127

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

      Show
      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: https://github.com/kiegroup/droolsjbpm-integration/blob/master/kie-server-parent/kie-server-remote/kie-server-client/src/main/java/org/kie/server/client/UserTaskServicesClient.java#L127 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..
    • 2020 Week 40-42 (from Sep 28), 2020 Week 43-45 (from Okt 19)
    • +

    Description

      No tasks returned when userId == null, exlOwner !=null and groups !=null

      affects as well to:
      [NOTE ENG]
      affects as well
      TasksAssignedAsPotentialOwnerWithGroups
      TasksAssignedAsPotentialOwnerByStatusWithGroups
      TasksAssignedAsPotentialOwnerStatusByExpirationDate
      TasksAssignedAsPotentialOwnerStatusByExpirationDateOptional
      SubTasksAssignedAsPotentialOwner
      QuickTasksAssignedAsPotentialOwnerWithGroupsByStatus
      QuickTasksAssignedAsPotentialOwnerStatusByExpirationDateOptional
      QuickTasksAssignedAsPotentialOwnerStatusByExpirationDate
      NewTasksAssignedAsPotentialOwner
      NewTasksAssignedAsPotentialOwnerByExpirationDateOptional
      NewTasksAssignedAsPotentialOwnerByExpirationDate

      Attachments

        Issue Links

          Activity

            People

              elguardian@gmail.com Enrique González Martínez
              rhn-support-mpessanh Marcell Pessanha Cruz
              Gonzalo Muñoz Fernández Gonzalo Muñoz Fernández
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: