cancel
Showing results for 
Search instead for 
Did you mean: 

Strange results with HistoricTaskInstanceQuery

matthias1
Champ in-the-making
Champ in-the-making
Hey !

So here is what I'm trying to do:

I want to have a list of all tasks, which the current logged-in user has been assigned to in any unfinished process instance.
So my query looks like this:

HistoryService historyService = ProcessEngines.getDefaultProcessEngine().getHistoryService();
String userId = ExplorerApp.get().getLoggedInUser().getId();
List<HistoricTaskInstance> alreadyClaimedTasks =
historyService.createHistoricTaskInstanceQuery().processUnfinished().taskAssignee(userId).list();

The query is nested in the ClaimTaskClickListener, and it gets called before the task is assigned, so I can stop the assignment if I want to, because one of the already claimed tasks is connected to the current task. I need this to implement a Separaton of Duty between Tasks.

When I test this with a small process consisting of 4 user tasks it shows some strange behaviour. If I assign the first task, it gets added properly to the list. On assigning any additional task, the first task gets added again instead of the new task.
To view the content of the list I use tomcat console outputs.
I have been searching my code for an error quite some time now and haven't found a solution, so I hope you can help me out!

Best regards,
Matthias
1 REPLY 1

matthias1
Champ in-the-making
Champ in-the-making
Hey !

Since my post has no answers yet, I will try to specify the issue.

I think the strange behaviour I described is connected to the fact, that my historyService, taskService, etc. are called from within a java ServiceLoader at runtime.

I just tried a query like this: taskService.getTastEvents(taskId), while looking at the database and the output of the query at the same time. I was triggering events and while the database had for example 5 items listed, my query only showed 2 of those…

So I'd like to know how and when the xxService parts get updated data from the database.


Best regards,
Matthias
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.