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
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.
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
Steps to Reproduce:
1. Try to query process via AuditLogService with CorrelationKey
CorrelationKey can't be used for querying processes using AuditLogService. Only with the custom implementation.
CorrelationKey can be used for querying processes using AuditLogService and there will be out-of-the-box implementations provided.
feature implemented as part of this commit
Verified in 6.2.0 CR1