Uploaded image for project: 'Repository'
  1. Repository
  2. REPO-1926

REST api processes variables MATCHES wildcard % returns everything

    Details

    • Type: Bug
    • Status: Review (View Workflow)
    • Resolution: Unresolved
    • Affects Version/s: Alfresco One 5.1
    • Fix Version/s: None
    • Component/s: REST API
    • Labels:
      None
    • Environment:
      v5.0.2,Tomcat,postgresql,OSX
    • Work Funnel:
      Feature
    • Template:
    • Bug Priority:
      Category 2

      Description

      Based on docs http://docs.alfresco.com/5.0/pra/1/concepts/act-processes-get-processes.html
      we should be able to use wildcard % with MATCHES operator. This fails with the variables parameter.

      example form doc

      where=( startUserId='kermit' AND businessKey='55' AND
         variables/nameB MATCHES('elmo%') ).
      

      Replication Steps

      • start a workflow on two items, set the bpm_description different on each
      • check the variables using the following rest call example:
      http://localhost:8080/alfresco/api/-default-/public/workflow/versions/1/processes?where=(includeVariables=true)
      

      Result example:

      {"list":{"pagination":{"count":2,"hasMoreItems":false,"totalItems":2,"skipCount":0,"maxItems":100},"entries":[{"entry":{"processDefinitionId":"activitiReview:1:8","startUserId":"admin","startActivityId":"start","startedAt":"2015-08-19T20:43:19.543+0000","id":"301","completed":false,"processVariables":[{"name":"bpm_package","type":"bpm:workflowPackage","value":"workspace://SpacesStore/47a04703-dbe6-45da-b190-62a813dfd3e5"},{"name":"bpm_assignee","type":"cm:person","value":"andys"},{"name":"bpm_packageActionGroup","type":"d:text","value":"add_package_item_actions"},{"name":"bpm_workflowDescription","type":"d:text","value":"Snort again it sigh"},{"name":"bpm_reassignable","type":"d:boolean","value":true},{"name":"bpm_packageItemActionGroup","type":"d:text","value":"start_package_item_actions"},{"name":"bpm_priority","type":"d:int","value":2},{"name":"companyhome","type":"d:noderef","value":"workspace://SpacesStore/57a26610-d42e-4d13-9a60-24cdce1d5991"},{"name":"initiator","type":"d:noderef","value":"admin"},{"name":"_startTaskCompleted","type":"d:datetime","value":"2015-08-19T20:43:19.702+0000"},{"name":"bpm_percentComplete","type":"d:int","value":0},{"name":"bpm_sendEMailNotifications","type":"d:boolean","value":true},{"name":"bpm_description","type":"d:text","value":"Snort again it sigh"},{"name":"bpm_workflowPriority","type":"d:int","value":2},{"name":"bpm_hiddenTransitions","type":"d:text","value":""},{"name":"workflowinstanceid","type":"d:text","value":"activiti$301"},{"name":"initiatorhome","type":"d:noderef","value":"workspace://SpacesStore/57a26610-d42e-4d13-9a60-24cdce1d5991"},{"name":"bpm_workflowDueDate","type":"d:date","value":null},{"name":"cm_name","type":"d:text","value":"Task"},{"name":"bpm_status","type":"d:text","value":"Not Yet Started"},{"name":"cancelled","type":"d:boolean","value":false}],"processDefinitionKey":"activitiReview"}},{"entry":{"processDefinitionId":"activitiReview:1:8","startUserId":"admin","startActivityId":"start","startedAt":"2015-08-18T17:47:17.207+0000","id":"101","completed":false,"processVariables":[{"name":"bpm_package","type":"bpm:workflowPackage","value":"workspace://SpacesStore/f686ca19-6403-4fcc-8e0a-496574d32af5"},{"name":"bpm_assignee","type":"cm:person","value":"admin"},{"name":"bpm_packageActionGroup","type":"d:text","value":"add_package_item_actions"},{"name":"bpm_workflowDescription","type":"d:text","value":"Test workflow api calls review and approve"},{"name":"bpm_reassignable","type":"d:boolean","value":true},{"name":"bpm_packageItemActionGroup","type":"d:text","value":"start_package_item_actions"},{"name":"bpm_priority","type":"d:int","value":2},{"name":"companyhome","type":"d:noderef","value":"workspace://SpacesStore/57a26610-d42e-4d13-9a60-24cdce1d5991"},{"name":"initiator","type":"d:noderef","value":"admin"},{"name":"_startTaskCompleted","type":"d:datetime","value":"2015-08-18T17:47:17.382+0000"},{"name":"bpm_percentComplete","type":"d:int","value":0},{"name":"bpm_sendEMailNotifications","type":"d:boolean","value":false},{"name":"bpm_description","type":"d:text","value":"Test workflow api calls review and approve"},{"name":"bpm_workflowPriority","type":"d:int","value":2},{"name":"bpm_hiddenTransitions","type":"d:text","value":""},{"name":"workflowinstanceid","type":"d:text","value":"activiti$101"},{"name":"initiatorhome","type":"d:noderef","value":"workspace://SpacesStore/57a26610-d42e-4d13-9a60-24cdce1d5991"},{"name":"bpm_workflowDueDate","type":"d:date","value":null},{"name":"cm_name","type":"d:text","value":"Task"},{"name":"bpm_status","type":"d:text","value":"Not Yet Started"},{"name":"cancelled","type":"d:boolean","value":false},{"name":"wf_reviewOutcome","type":"d:text","value":"Approve"}],"processDefinitionKey":"activitiReview"}}]}}
      

      Note in the results we see:

      • "id":"301" has processVariables {“name":"bpm_description","type":"d:text","value":"Snort again it sigh"}
      • "id":"101" has processVariables > {"name":"bpm_description","type":"d:text","value":"Test workflow api calls review and approve"}

      Use MATCHES to match value exactly to one of them:

      http://localhost:8080/alfresco/api/-default-/public/workflow/versions/1/processes?where=(variables/bpm_description MATCHES('Snort again it sigh'))
      

      Result:

      {"list":{"pagination":{"count":1,"hasMoreItems":false,"totalItems":1,"skipCount":0,"maxItems":100},"entries":[{"entry":{"processDefinitionId":"activitiReview:1:8","startUserId":"admin","startActivityId":"start","startedAt":"2015-08-19T20:43:19.543+0000","id":"301","completed":false,"processDefinitionKey":"activitiReview"}}]}}
      

      Try using % wildcard

      http://localhost:8080/alfresco/api/-default-/public/workflow/versions/1/processes?where=(variables/bpm_description MATCHES('Snort%'))
      

      Results: (% not working as expected should only match one)

      {"list":{"pagination":{"count":2,"hasMoreItems":false,"totalItems":2,"skipCount":0,"maxItems":100},"entries":[{"entry":{"processDefinitionId":"activitiReview:1:8","startUserId":"admin","startActivityId":"start","startedAt":"2015-08-19T20:43:19.543+0000","id":"301","completed":false,"processDefinitionKey":"activitiReview"}},{"entry":{"processDefinitionId":"activitiReview:1:8","startUserId":"admin","startActivityId":"start","startedAt":"2015-08-18T17:47:17.207+0000","id":"101","completed":false,"processDefinitionKey":"activitiReview"}}]}}
      

      Expected Behaviour

      • when using wildcard % in MATCHES for REST api processes or tasks variables, it returns the filtered matching processes not all

      Actual Behaviour

      • when using wildcard % in MATCHES for REST api processes of tasks variables, it returns all

      Additional Notes
      Tested this with the tasks REST api and MATCHES on variables with same issue example

      http://localhost:8080/alfresco/api/-default-/public/workflow/versions/1/tasks?where=(description MATCHES('Snort%')))
      

      return both not just one match.

        Attachments

          Issue Links

            Structure

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  jsoria Jennie Soria [X] (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:

                    Structure Helper Panel