Bug 1130070 - CorrelationKey can't be used in AuditLogService queries
Summary: CorrelationKey can't be used in AuditLogService queries
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss BPMS Platform 6
Classification: Retired
Component: jBPM Core
Version: 6.0.2
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: DR1
: 6.2.0
Assignee: Maciej Swiderski
QA Contact: Jakub Schwan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-14 09:20 UTC by Anton Giertli
Modified: 2018-12-06 17:45 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Enhancement


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 1169113 None None None Never

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


Note You need to log in before you can comment on or make changes to this bug.