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

How to use a "OR" query operator in a custom query in the query-parameters

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • Kie-Server
    • 2020 Week 07-09 (from Feb 10)

      Hi,

      We have registered this custom query in order to search tasks:

      {
      "query-name" : "jbpmHumanTasksPO",
      "query-source" : "${org.kie.server.persistence.ds}",
      "query-expression" : "select t.id as TASKID, t.name as NAME, t.FORMNAME AS FORMNAME, t.subject as SUBJECT, t.actualowner_id as actualowner, po.entity_id as POTOWNER, p.processinstancedescription as PROCESSINSTANCEDESCRIPTION, t.CREATEDON as CREATEDON, t.CREATEDBY_ID as CREATEDBY, t.EXPIRATIONTIME as EXPIRATIONTIME, t.priority as PRIORITY, t.STATUS as STATUS, t.PROCESSINSTANCEID as PROCESSINSTANCEID, t.deploymentid as DEPLOYMENTID, t.PROCESSID as PROCESSID from TASK t inner join PEOPLEASSIGNMENTS_POTOWNERS po on t.id=po.task_id inner join PROCESSINSTANCELOG p on t.processinstanceid = p.processinstanceid",
      "query-target" : "USER_GROUPS_TASK"
      }

      One of the filters that our customers need to use it's: all the task which the logged user is potential owner or is reserved by the logged user, but they don't want to get the tasks which are already reserved by another user even if the task contains as a potential owner the logged user. This is the where clause that we should get with the query:

      select ...... from .... where PROCESSID = 'XXX' and STATUS in ("Ready","Reserved","In-progress") and POTOWNER = 'logged_user' and (ACTUALOWNER = 'logged_user' OR ACTUALOWNER is null)

      Are there any way to set this filter in the payload of a custom query? I mean, how can I use the operator "OR" in a custom query?

      The following body doesn't work fine because all the parameters are translate to "AND" conditions:

      {
      "order-by": "actualOwner",
      "order-asc": false,
      "query-params": [

      {"cond-column":"PROCESSID","cond-operator":"EQUALS_TO","cond-values":["SSI"]}

      ,

      {"cond-column":"POTOWNER","cond-operator":"EQUALS_TO","cond-values":["XE70344"]}

      ,

      {"cond-column":"STATUS","cond-operator":"IN","cond-values":["Ready","Reserved","InProgress"]}

      ,

      {"cond-column":"ACTUALOWNER","cond-operator":"IS NULL","cond-values":["null"]}

      ,

      {"cond-column":"ACTUALOWNER","cond-operator":"EQUALS_TO","cond-values":["XE70344"]}

      ]
      }

      But we need that the last 2 query parameters , related to the actualowner, were an "OR" clause.

              elguardian@gmail.com Enrique González Martínez (Inactive)
              elguardian@gmail.com Enrique González Martínez (Inactive)
              Gonzalo Muñoz Fernández Gonzalo Muñoz Fernández
              Gonzalo Muñoz Fernández Gonzalo Muñoz Fernández
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: