Bug 908812

Summary: Please allow REST access to BAM data (PRODMGT-336)
Product: [Retired] JBoss BPMS Platform 6 Reporter: Rick Wagner <rwagner>
Component: jBPM CoreAssignee: Marco Rietveld <mrietvel>
Status: CLOSED CURRENTRELEASE QA Contact: Ivo Bek <ibek>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.0CC: ibek, kverlaen, mbaluch, mrietvel, paradhya, rrajasek, smcgowan, vigoyal
Target Milestone: ER1   
Target Release: 6.0.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: REST in BPM doesn't facilitate to search process instances for arbitrary process variables or even retrieve image data. Consequence: Arbitrary process variables or BAM data can not be accessed or monitored as desired. Fix: ProcessInstanceLog, NodeInstanceLog and VariableInstanceLog are now implemented in the REST api for BPMS. Result: The REST API just mirrors the behaviour of the ksession. The general queries about which process instances are active and what their state is goes to the history log that has all the information about the active process instances. In a way the user gets the information needed in one invocation by using the history log and without impacting the runtime performance.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:04:09 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rick Wagner 2013-02-07 15:18:35 UTC
Per PRODMGT-336, please make allowances in BPM to allow the user to search process instances for arbitrary process variables.  Access should be RESTfull.

Comment 1 Rick Wagner 2013-02-07 15:19:31 UTC
Please note that this BZ is public, the customer wishes to track it.

Rick

Comment 2 Rick Wagner 2013-02-07 15:20:53 UTC
Initial designs for this functionality suggested the following:


-Add a method that will allow users to search process instances based on variable value.
-For basic types (String, Integer, etc) it will work immediately
-For complex types, 'toString' should be implemented in a way that will facilitate the search

Thanks,

Rick

Comment 3 Rick Wagner 2013-02-13 17:03:27 UTC
Additional customer feedback as we work on this RFE/BZ.

If possible, they would like to retreive image data via REST as such:

http://localhost:8080/business-central-server/rs/process/definition/{id}/image/{instance}

Thanks,

Rick

Comment 4 Prakash Aradhya 2013-06-05 16:21:20 UTC
This certainly a good API to expose.  But given the schedule impact we punt this out to post 6.0

Comment 5 Kris Verlaenen 2013-09-23 13:34:30 UTC
Marco, can this one be closed based on what's there currently already?

Comment 6 Marco Rietveld 2013-10-10 11:27:45 UTC
This has been added to the REST api for BPMS: 

6.0.x: 
https://github.com/droolsjbpm/droolsjbpm-integration/commit/9f72787

master: 
https://github.com/droolsjbpm/droolsjbpm-integration/commit/9f72787

Comment 7 Marco Rietveld 2013-10-22 08:43:40 UTC
I've added the following rest operations: 

 /rest/history/variable/{variable-id}
 /rest/history/variable/{variable-id}/value/{variable-value}
 /rest/history/variable/{variable-id}/instances
 /rest/history/variable/{variable-id}/value/{variable-value}/instances

The first 2 operations simply return the list of (JAXB/JSON) VariableInstanceLog instances. These instances contain, among other information, the id of the process instance. 

The second 2 operations return the list of process instances (by first retrieving the list of variable instance logs and then retrieving the process instances based on the process instance id field in the variable instance logs). 

---

With regards to retrieving the image data, I'm not sure I'll have time to do that before the release. I'm doing my best, but can't promise anything.

Comment 8 Marco Rietveld 2013-11-01 08:33:17 UTC
Rick, FYI: 

This feature has been added to the REST api: 

-Add a method that will allow users to search process instances based on variable value.
-For basic types (String, Integer, etc) it will work immediately

For the time being, see: 
https://github.com/droolsjbpm/droolsjbpm-integration/wiki/Rest-API#history-variable-operations

That documentation will eventually be added to both product and community docs.

Comment 10 Jiri Svitak 2014-01-10 16:42:17 UTC
I've tested this with ER7 and written several tests for this feature, see:
http://git.app.eng.bos.redhat.com/jbossqe/brms.git/tree/test-jbpm-integration/src/test/java/org/jboss/qa/bpms/jbpm/integration/remote/VariableHistoryTest.java

However none of them work.

1.) I cannot work with variables correctly. String values are somehow converted to Long and I don't know why:
parameters.put("var1", "30");
produces:
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
Starting the process from business-central manually works well.

2.) In other case JaxbHistoryLogList contains empty internal historyLogList, no variable "myobject" found in the log.

3.) I've also encountered this error:
org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"process-instance-list").
        // Expected elements are <{}log-instance-list>,<{}node-instance-log>,<{}process-instance-log>,<{}variable-instance-log>

All errors are commented in corresponding test methods, which reproduce them.

To reproduce issues listed above:
1.) Download BPMS 6 ER7 (eap6) and setup a db (in my case PostgreSQL).
2.) Add user ibek:
ibek=9143dd65119c7b733e02c5076dcf8f84  (into application-users.properties)
ibek=admin  (into application-roles.properties)
3.) Run the server.
4.) Run the tests: 
git clone git://git.app.eng.bos.redhat.com/jbossqe/brms.git
cd brms
mvn clean test -Pjbpm-integration -Dtest=VariableHistoryTest
(it will install test projects from bpms-assets.git automatically).

I think this should be fixed, as this was requested by a customer.

Comment 13 Lukáš Petrovický 2014-02-07 16:19:44 UTC
This no longer has a target release of 6.0.0.

Comment 14 Ivo Bek 2014-03-03 08:27:05 UTC
Verified in BPMS 6.0.1.ER1

Filed issues: BZ 1069568, BZ 1069622