[MNT-15774] CLONE - REST Processes and Tasks API for parameters/variables allowed MATCHES operator, operator is not case-insensitive Created: 01-Mar-16  Updated: 03-Oct-16  Resolved: 10-Mar-16

Status: Closed
Project: Service Packs and Hot Fixes
Component/s: ACS REST API, Workflow
Affects Version/s: 5.0.1, 5.0
Fix Version/s: 5.0.4

Type: Service Pack Request
Reporter: Harlin Seritt Assignee: Closed Bugs (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0 minutes
Time Spent: 3 hours, 30 minutes
Original Estimate: Not Specified

Issue Links:
Blocks
Cloners
is clone of MNT-14631 REST Processes and Tasks API for para... Closed
Dependency
Related
is related to by REPO-1926 REST api processes variables MATCHES ... Review
Bug Priority:
Category 2
ACT Numbers:

00458326 Premier

Build Location: https://releases.alfresco.com/Enterprise-5.0/5.0.4/build-00030/ALL/

 Description   

According to http://docs.alfresco.com/5.0/pra/1/concepts/act-processes-get-processes.html there is a sample filtering of data:

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

This is case sensitive, request is to make the MATCHES operator case insensitive.
This would be change applicable to any REST api's that afford the use of the MATCHES operator for parameters which are string values.

Replication steps

  • Using Share UI, start a workflow (this example I only had one in so simple test)
  • Using basic FF RestClient
  • get a process or task to test with for example:
GET http://localhost:8080/alfresco/api/-default-/public/workflow/versions/1/processes?where=(includeVariables=true)

results show

{"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-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"}}]}}
  • Using one of the string variables from the "processVariables" in json response to specifically search for case match
    (if using tasks you can use any of the parameters that allows MATCHES operator):
GET http://localhost:8080/alfresco/api/-default-/public/workflow/versions/1/processes?where=(variables/bpm_workflowDescription MATCHES ('Test workflow api calls review and approve'))

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-18T17:47:17.207+0000","id":"101","completed":false,"processDefinitionKey":"activitiReview"}}]}}
  • Search the same "processVariables" test case insensitive match:
GET http://localhost:8080/alfresco/api/-default-/public/workflow/versions/1/processes?where=(variables/bpm_workflowDescription MATCHES ('test workflow api calls review and approve'))

result

{"list":{"pagination":{"count":0,"hasMoreItems":false,"totalItems":0,"skipCount":0,"maxItems":100},"entries":[]}}

Expected Behaviour

  • Regardless of case, the MATCHES clause should match

[MER 10/03/2016 - Please note that this expected behaviour is not correct. The expected behaviour is that the query is case sensitive. Instead a new prefix was added to the query to enable a case insensitive search. Please see the linked issue for further details]

Actual Behaviour

  • MATCHES clause is case sensitive

Additional Information

  • MATCHES can only be used for string values

Ref:

Alex Strachan noted that when looking through the code, the class org.alfresco.rest.workflow.api.impl.ProcessesImpl calls a generic class called WhereClauseParser(). This parser class seems to do a direct comparison of objects (there is no toLower() or anything called before comparisons).

  • /root/projects/remote-api/source/java/org/alfresco/rest/workflow/api/impl/ProcessesImpl.java
  • /root/projects/remote-api/source/generated/org/alfresco/rest/antlr/WhereClauseParser.java

Generated at Sun Oct 25 17:00:17 GMT 2020 using Jira 7.13.15#713015-sha1:7c5ddd2c3e1709974ae9c48c17df8edd3919fe2c.