Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-13787

Workflow filtered-query on task instance with param taskId does not work

    XMLWordPrintable

    Details

    • Target Version/s:
    • Verified Version/s:
    • Story Points:
      1
    • Sprint:
      2020.05 - IDM, 2020.06 - IDM, 2020.07 - IDM
    • Support Ticket IDs:

      Description

      Reproducible on IDM 5.5.1.2 and 7.0 snapshot.

      From IDM 5.5 integrator's guide:
      https://backstage.forgerock.com/docs/idm/5.5/integrators-guide/#managing-workflows-over-REST
      /openidm/workflow/taskinstance?_queryId=filtered-query&filter
      GET
      Lists the tasks according to the specified filter.
      The parameters on which this list can be filtered include: taskId, ..., tenantId, assignee

      But query param taskId does not work as expected. It returns all task instances regardless of the taskId, because:
      1. the query param taskId is not handled (hence this bug).
      2. for filtered queries on workflow, with "unknown" query params, all records are returned. This is a known issue:
      OPENIDM-6931 : Filtered queries on workflows do not behave in the same way as a regular queryFilter

       

      TEST CASE:
      ~~~~~~~~~

      1. Run a sample workflow twice, to create two workflow task instances.

      "_id" : "16",
       "createTime" : "2019-09-19T10:36:54.987+08:00",
       "tenantId" : "",
      ...
       "_id" : "29",
       "createTime" : "2019-09-19T10:37:12.512+08:00",
       "tenantId" : "",
      ...
       "resultCount" : 2,

      2. Querying on workflow task instance with param tenantId works as expected:

      $ curl -u openidm-admin:openidm-admin "http://localhost:8080/openidm/workflow/taskinstance?_queryId=filtered-query&tenantId=1&_prettyPrint=true"
      {
       "result" : [ ],
       "resultCount" : 0,
      ...

      openidm log with FINEST logging shows the JDBC query "WHERE RES.TENANT_ID_ = ...":

      [928] Sep 19, 2019 1:40:45.925 PM org.apache.ibatis.transaction.jdbc.JdbcTransaction setDesiredAutoCommit
      FINE: Setting autocommit to false on JDBC Connection [HikariProxyConnection@1621114581 wrapping conn7: url=jdbc:h2:file:/home/OpenIDM/wy-tmp-43251/openidm5.5.1.2/db/activiti/database user=SA]
      [928] Sep 19, 2019 1:40:45.926 PM org.apache.ibatis.logging.jdbc.BaseJdbcLogger debug
      FINE: ooo Using Connection [HikariProxyConnection@1621114581 wrapping conn7: url=jdbc:h2:file:/home/OpenIDM/wy-tmp-43251/openidm5.5.1.2/db/activiti/database user=SA]
      [928] Sep 19, 2019 1:40:45.926 PM org.apache.ibatis.logging.jdbc.BaseJdbcLogger debug
      FINE: ==> Preparing: select distinct RES.* from ACT_RU_TASK RES WHERE RES.TENANT_ID_ = ? order by RES.ID_ asc LIMIT ? OFFSET ?
      [928] Sep 19, 2019 1:40:45.926 PM org.apache.ibatis.logging.jdbc.BaseJdbcLogger debug
      FINE: ==> Parameters: 1(String), 2147483647(Integer), 0(Integer)
      [928] Sep 19, 2019 1:40:45.927 PM org.apache.ibatis.logging.jdbc.BaseJdbcLogger debug
      FINE: <== Total: 0

      3. Querying on workflow task instance with param taskId does not work. It returns all instances regardless of taskId:

      $ curl -u openidm-admin:openidm-admin "http://localhost:8080/openidm/workflow/taskinstance?_queryId=filtered-query&taskId=16&_prettyPrint=true"
      
       "_id" : "16",
      ...
       "_id" : "29",
      ...
       "resultCount" : 2,
      • openidm log shows the JDBC query without any "WHERE ...":
        [745] Sep 19, 2019 11:03:09.731 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger debug
        FINE: ooo Using Connection [HikariProxyConnection@253247491 wrapping conn1: url=jdbc:h2:file:/home/OpenIDM/wy-tmp-43251/openidm5.5.1.2/db/activiti/database user=SA]
        [745] Sep 19, 2019 11:03:09.731 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger debug
        FINE: ==> Preparing: select distinct RES.* from ACT_RU_TASK RES order by RES.ID_ asc LIMIT ? OFFSET ?
        [745] Sep 19, 2019 11:03:09.732 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger debug
        FINE: ==> Parameters: 2147483647(Integer), 0(Integer)
        [745] Sep 19, 2019 11:03:09.734 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger trace
        FINEST: <== Columns: ID_, REV_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, TASK_DEF_KEY_, OWNER_, ASSIGNEE_, DELEGATION_, PRIORITY_, CREATE_TIME_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_
        [745] Sep 19, 2019 11:03:09.734 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger trace
        FINEST: <== Row: 16, 1, 5, 5, myProcess:1:4, Approve Request, null, null, usertask1, null, null, null, 50, 2019-09-19 10:36:54.987, null, null, 1,
        [745] Sep 19, 2019 11:03:09.736 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger trace
        FINEST: <== Row: 29, 1, 18, 18, myProcess:1:4, Approve Request, null, null, usertask1, null, null, null, 50, 2019-09-19 10:37:12.512, null, null, 1,
        [745] Sep 19, 2019 11:03:09.736 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger debug
        FINE: <== Total: 2

         

        Attachments

          Activity

            People

            Assignee:
            travis.haagen Travis Haagen
            Reporter:
            wei-yee.lum Wei-Yee Lum
            QA Assignee:
            Julian Keller Julian Keller
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: