I have a Case instance where I can see human tasks A, B, C and D using the Flowable UI admin UI while looking at the Case Instance. Task A is a Task that was guarded by a sentry and therefore wasn’t enable immediately when the instance started, however, later on when the sentry condition evaluated to true it activated.
When I execute the caseInstanceIdWithChildren query passing in the case instance ID it only returns tasks B, C and D. The one difference with Task A, aside form the sentry, is that it is not within a stage in the case model while the other tasks are.
I’ve tracked it down to the fact that tasks B,C and D all have entries in the ACT_RU_ENTITYLINK table while Task A does not. I don’t think this is expected. Is anyone aware of any issues with the entityLink service which may prevent a link from getting saved?
Starting in 6.4.2 I’ve explicitly enabled EntityLinks in our engine config in order to ensure tasks from sub-processes called from Case models would get returned when we queried for them. This particular query used to return all 4 tasks as well as any tasks from sub-processes in 6.4.2 but I only just noticed since upgrading to 6.7.2 that task A is no longer coming back. For reference, this is the setting I’m referring to (on a side note, can this be controlled via an application.yml/properties variable in 6.7.2 or do I need to continue using the code approach?)
@Bean
public SpringProcessEngineConfiguration processEngineConfiguration() {
SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
processEngineConfiguration.setEnableEntityLinks(true);
return processEngineConfiguration;
}
@Bean
public SpringCmmnEngineConfiguration cmmnEngineConfiguration() {
SpringCmmnEngineConfiguration cmmnEngineConfiguration = new SpringCmmnEngineConfiguration();
cmmnEngineConfiguration.setEnableEntityLinks(true);
return cmmnEngineConfiguration;
}
In order to try and isolate and reproduce the problem I’ve tried a unit test where I start a simple case model which has one human task in the main model and one within a stage and assert that I have two tasks. Starting the case instance directly in the unit test is successful, however, if I start an instance of the case model using the rest api the method returns no tasks which I’m assuming is because the standalone REST instance does not have the EnableEntityLinks set to true.
@Test
void taskQueryTest() {
// testStages model was deployed manually to the Flowable engine
TaskInfoQueryWrapper taskInfoQueryWrapper;
CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey("testStages")
.tenantId("LOCAL")
.businessKey("testing123")
.start();
TaskQuery taskQuery = cmmnTaskService.createTaskQuery();
taskInfoQueryWrapper = new TaskInfoQueryWrapper(taskQuery);
taskInfoQueryWrapper.getTaskInfoQuery().caseInstanceIdWithChildren(caseInstance.getId());
long numRecords = taskInfoQueryWrapper.getTaskInfoQuery().count();
assertThat(numRecords).isEqualTo(2);
}