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

Workflow processinstance history filtered-query on var-* returns duplicates

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 6.5.0, 6.5.0.3, 6.5.0.4
    • Fix Version/s: None
    • Component/s: Module - Workflow
    • Labels:
    • Support Ticket IDs:

      Description

      Reproducible on IDM 6.5.0.3.
      Not reproducible on IDM 7.0.0-SNAPSHOT (build: 20200608083929, revision: ca359bb).

      Using a filtered-query with var-<process-variable> on workflow/processinstance/history, duplicates are returned for processinstances that have been accepted or rejected.

      TEST CASE:
      ~~~~~~~~

      1. IDM 6.5.0.3.
      (I used MySQL as repo, but this is also reproducible with Activiti's default H2 db.)

      2. Enable workflow.

      3. Copy workflow from samples/provisioning-with-workflow/workflow.

      4. Login to end-user UI, start workflow.

      5. In admin UI, assign the workflow to a user.

      At this point, filtered-query "var-mail=..." returns one processinstance, as expected:

      $ curl -u openidm-admin:openidm-admin "http://localhost:8080/openidm/workflow/processinstance/history?_queryId=filtered-query&var-mail=test1@example.com" | jq .

       

      6. In end-user UI, process the task, either "accept" or reject" the request.

      Now, filtered-query "var-mail=..." returns the processinstance, duplicated:

      $ curl -u openidm-admin:openidm-admin "http://localhost:8080openidm/workflow/processinstance/history?_queryId=filtered-query&var-mail=test1@example.com" | jq .
      
      {
        "result": [
          {
            "_id": "6",
            "businessKey": null,
            "deleteReason": null,
            "durationInMillis": 2079670,
            "endActivityId": "end",
            "endTime": "2020-06-24T11:23:31.000Z",
            "processDefinitionId": "contractorOnboarding:1:5",
            "processInstanceId": "6",
            "processVariables": {},
            "queryVariables": null,
            "startActivityId": "start",
            "startTime": "2020-06-24T10:48:52.000Z",
            "startUserId": "openidm-admin",
            "superProcessInstanceId": null,
            "tenantId": "",
            "processDefinitionResourceName": "Contractor onboarding process"
          },
          {
            "_id": "6",
            "businessKey": null,
            "deleteReason": null,
            "durationInMillis": 2079670,
            "endActivityId": "end",
            "endTime": "2020-06-24T11:23:31.000Z",
            "processDefinitionId": "contractorOnboarding:1:5",
            "processInstanceId": "6",
            "processVariables": {},
            "queryVariables": null,
            "startActivityId": "start",
            "startTime": "2020-06-24T10:48:52.000Z",
            "startUserId": "openidm-admin",
            "superProcessInstanceId": null,
            "tenantId": "",
            "processDefinitionResourceName": "Contractor onboarding process"
          }
        ],
        "resultCount": 2

       

      openidm0.log.0:

      [143] Jun 24, 2020 11:34:46.808 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger debug
      FINE: ==> Preparing: select RES.* from ACT_HI_PROCINST RES inner join ACT_HI_VARINST A0 on RES.PROC_INST_ID_ = A0.PROC_INST_ID_ WHERE A0.NAME_= ? and A0.VAR_TYPE_ = ? and A0.TEXT_ = ? order by RES.ID_ asc LIMIT ? OFFSET ?
      [143] Jun 24, 2020 11:34:46.808 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger debug
      FINE: ==> Parameters: mail(String), string(String), test1@example.com(String), 2147483647(Integer), 0(Integer)
      [143] Jun 24, 2020 11:34:46.809 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger trace
      FINEST: <== Columns: ID_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, START_TIME_, END_TIME_, DURATION_, START_USER_ID_, START_ACT_ID_, END_ACT_ID_, SUPER_PROCESS_INSTANCE_ID_, DELETE_REASON_, TENANT_ID_
      [143] Jun 24, 2020 11:34:46.809 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger trace
      FINEST: <== Row: 6, 6, null, contractorOnboarding:1:5, 2020-06-24 10:48:52.0, 2020-06-24 11:23:31.0, 2079670, openidm-admin, start, end, null, null,
      [143] Jun 24, 2020 11:34:46.810 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger trace
      FINEST: <== Row: 6, 6, null, contractorOnboarding:1:5, 2020-06-24 10:48:52.0, 2020-06-24 11:23:31.0, 2079670, openidm-admin, start, end, null, null,
      [143] Jun 24, 2020 11:34:46.811 AM org.apache.ibatis.logging.jdbc.BaseJdbcLogger debug
      FINE: <== Total: 2

       

      Looking at Activiti tables in repo:

      mysql> select * from ACT_HI_PROCINST;
      +-----+---------------+---------------+--------------------------+---------------------+---------------------+-----------+----------------+---------------+-------------+----------------------------+----------------+------------+
      | ID_ | PROC_INST_ID_ | BUSINESS_KEY_ | PROC_DEF_ID_ | START_TIME_ | END_TIME_ | DURATION_ | START_USER_ID_ | START_ACT_ID_ | END_ACT_ID_ | SUPER_PROCESS_INSTANCE_ID_ | DELETE_REASON_ | TENANT_ID_ |
      +-----+---------------+---------------+--------------------------+---------------------+---------------------+-----------+----------------+---------------+-------------+----------------------------+----------------+------------+
      | 34 | 34 | NULL | contractorOnboarding:1:5 | 2020-06-24 11:21:43 | NULL | NULL | openidm-admin | start | NULL | NULL | NULL | | 
      mysql> select * from ACT_HI_VARINST;
      +-----+---------------+---------------+----------+-------------------+--------------+------+---------------+---------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+---------------------+---------------------+
      | ID_ | PROC_INST_ID_ | EXECUTION_ID_ | TASK_ID_ | NAME_ | VAR_TYPE_ | REV_ | BYTEARRAY_ID_ | DOUBLE_ | LONG_ | TEXT_ | TEXT2_ | CREATE_TIME_ | LAST_UPDATED_TIME_ |
      ...
      | 11 | 6 | 6 | NULL | mail | string | 1 | NULL | NULL | NULL | test1@example.com | NULL | 2020-06-24 10:48:52 | 2020-06-24 11:23:31 |
      ...
      | 69 | 6 | 6 | 32 | mail| string | 0 | NULL | NULL | NULL | test1@example.com | NULL   | 2020-06-24 11:23:31 | 2020-06-24 11:23:31 |
      ...
      | 74  | 6 | 6 | 32 | decision | string | 0 | NULL | NULL | NULL | reject                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | NULL   | 2020-06-24 11:23:31 | 2020-06-24 11:23:31 |
      | 75  | 6 | 6 | NULL | decision | string | 0 | NULL | NULL | NULL | reject | NULL | 2020-06-24 11:23:31 | 2020-06-24 11:23:31 |

       

       

       

        Attachments

          Activity

            People

            Assignee:
            ramya.srinivassan Ramya Srinivassan
            Reporter:
            wei-yee.lum Wei-Yee Lum
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: