Bug 1260881

Summary: [QE](6.2.z)REST Query API: startDate and endDate parameters do not work
Product: [Retired] JBoss BPMS Platform 6 Reporter: Tomas Livora <tlivora>
Component: Business CentralAssignee: Shelly McGowan <smcgowan>
Status: CLOSED EOL QA Contact: Radovan Synek <rsynek>
Severity: high Docs Contact:
Priority: medium    
Version: 6.2.0CC: alazarot, kverlaen, lpetrovi, rsynek, smcgowan, tradej
Target Milestone: CR2   
Target Release: 6.2.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
When using the REST API to send a query about a process, using the parameters startDate or endDate yields no results even if there are processes matching the criteria. The workaround is to use the parameter startDate_min in conjunction with startDate_max, or endDate_min and endDate_max, so that they intersect only on the intended date.
Story Points: ---
Clone Of:
: 1295529 (view as bug list) Environment:
Last Closed: 2020-03-27 19:41:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1288023, 1295529    

Description Tomas Livora 2015-09-08 07:09:54 UTC
Description of problem:
When you use a process query containing either startDate or endDate as a single parameter, no process instances will be found.

Version-Release number of selected component (if applicable):
6.2.0 ER1

Steps to Reproduce:
1. Deploy and run a process.
2. Try http://localhost:8080/business-central/rest/query/runtime/process?startDate_min=*ENTER_TODAY_HERE*
3. See that there is a single result.
4. Try http://localhost:8080/business-central/rest/query/runtime/process?startDate=*ENTER_TODAY_HERE*

Actual results:
There is no result.

Expected results:
The process instance started in step 1 should be returned.

Additional info:
Note that all date range parameters (startDate_min, startDate_max, endDate_min, endDate_max) seem to be working as expected.

Comment 1 Marco Rietveld 2015-12-14 20:36:56 UTC
PR submitted: https://github.com/droolsjbpm/droolsjbpm-integration/pull/255

Comment 2 Marco Rietveld 2015-12-18 18:49:42 UTC
Fixed. Commits: 

master: 
https://github.com/droolsjbpm/droolsjbpm-integration/commit/3c098ab7

Comment 4 Marco Rietveld 2016-01-05 13:28:15 UTC
PR Submitted: https://github.com/droolsjbpm/droolsjbpm-integration/pull/258

Comment 5 Marco Rietveld 2016-01-07 13:53:01 UTC
Fixed. Commits: 

6.3.x: 
https://github.com/droolsjbpm/droolsjbpm-integration/commit/bc7b6f41

Comment 6 Radovan Synek 2016-01-19 17:02:39 UTC
Unfortunately, the behaviour is still the same - parameters like startDate_min,startDate_max,endDate_min,endDate_max work and I am able to receive correct results. However, using parameters startDate or endDate results in an empty collection of process instances.

This could be caused by the fact that the startDate parameter has been specified in a format 'yy-MM-dd' - i.e. not providing exact time when the process started ('HH:mm:ss.SSS' part is missing), simple requesting all process instances that have been started in a single day.

Please see a PR with tests:
https://github.com/droolsjbpm/droolsjbpm-integration/pull/268

Additional info:
a format 'yy-MM-dd_HH:mm:ss' results in a bad request error, forcing user to provide also '.SSS' part. Usually, user doesn't care about milliseconds.

Comment 7 Marco Rietveld 2016-01-25 12:03:04 UTC
For 6.2 I'll add an additional fix so that "yy-MM-dd_HH:mm:ss" does not cause a bad result error, but results in the nanoseconds being set to ".000". 

The reason for this is that changing the behavior of the feature is not something we do for established builds. The documentation states the following: 

"Submitting only the date (yy-MM-dd) means that a time of 00:00:00 is used (the beginning of the day). "

(See https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_BPM_Suite/6.2/html/Development_Guide/chap-Remote_API.html#idp14908488) 

For 6.3, which has not yet been released, I will try to change the behaviour to do hat Radovan suggests, which is a much more logical and user-friendly variant (submitting "yy-MM-DD" retrieves _all_ process instances retrieved that day, or in other words, is equivalent to startDate_min="yy-MM-DD"&&startDate_max="yy-MM-DD+1" ).

Comment 8 Marco Rietveld 2016-01-25 15:17:31 UTC
Pull request added: 

https://github.com/droolsjbpm/droolsjbpm-integration/pull/274

Comment 9 Marco Rietveld 2016-01-25 17:08:03 UTC
Fixed. Commits: 

6.3.x: 
https://github.com/droolsjbpm/droolsjbpm-integration/commit/09263cca

Comment 10 Radovan Synek 2016-02-03 09:48:19 UTC
Verified with BPMS-6.2.1.CR2.

However, the behaviour still differs from the expectations in the original description - see details in comment 7.