Bug 1130070

Summary: CorrelationKey can't be used in AuditLogService queries
Product: [Retired] JBoss BPMS Platform 6 Reporter: Anton Giertli <agiertli>
Component: jBPM CoreAssignee: Alessandro Lazarotti <alazarot>
Status: CLOSED EOL QA Contact: Jakub Schwan <jschwan>
Severity: low Docs Contact:
Priority: medium    
Version: 6.0.2CC: ibek, kverlaen, mbaluch
Target Milestone: DR1   
Target Release: 6.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 20:03:51 UTC Type: Enhancement
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Anton Giertli 2014-08-14 09:20:56 UTC
Description of problem:

As per https://issues.jboss.org/browse/JBPM-3512 the CorrelationKey has been added to jBPM 6.

Users can maintain its value manually and then use this CorrelationKey for querying via method 

ProcessInstance processInstanceCopy = ((CorrelationAwareProcessRuntime)ksession).getProcessInstance(key);


However, when using persistence it's always a best practise to use AuditService for querying process related information - in both cases, for running and for completed processes - this has always been the case.

However, currently the AuditLogService interface is simply not aware of this CorrelationKey

https://github.com/droolsjbpm/jbpm/blob/master/jbpm-audit/src/main/java/org/jbpm/process/audit/AuditLogService.java

So users can't use its value for querying - they would need to stick with the processinstanceid (which is the exact reason why the CorrelationKey was added, so users don't have to use this).

There is one approach how this can be solved but it would require significant extending of the engine - altering JPAWorkingMemoryDBLogger in a way that it sets to the *Log classes externalId to value of CorrelationKey and than also extending JPAAuditLogService in a way that its aware of the correlationkey.

Please implement these 'correlation key aware queries' out of the box.

After discussion with engineering what might be actually nice would be to make AuditLog service "context" aware.

i.e. auditLogService.setCorrelationKey(value);
auditLogService.findProcessInstances(); // result would be filtered only for those processes which includes the correlationkey with the same value


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

BPM Suite 6.0.2
How reproducible:
always

Steps to Reproduce:
1. Try to query process via AuditLogService with CorrelationKey


Actual results:
CorrelationKey can't be used for querying processes using AuditLogService. Only with the custom implementation.

Expected results:
CorrelationKey can be used for querying processes using AuditLogService and there will be out-of-the-box implementations provided.

Additional info:

Comment 1 Maciej Swiderski 2015-03-30 18:12:12 UTC
feature implemented as part of this commit

droolsjbpm-knowledge
master:
https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/3a99ead14e759b982db5073cd6ae75ecf70ae95e

jbpm
master:
https://github.com/droolsjbpm/jbpm/commit/60d6ab0af404cfda38b27d9e14a53a7503325dfc

Comment 3 Jakub Schwan 2015-11-26 13:00:17 UTC
Verified in 6.2.0 CR1