How can I query all items claimed/unclaimed by user which belongs to a particular group? So I want to build an API of below format List getAllTasks4Group(String group)
The reason why I want this API is I don't have know all the users which might have acquired tasks and all these tasks belong to same group.
Since the TaskQuery's candidateGroup method only returns unclaimed tasks, the easiest way I know to do this is to use a native query:
String groupId = ...
String taskTable = managementService.getTableName(TaskEntity.class);
String identityLinkTable = managementService.getTableName(IdentityLinkEntity.class);
List<Task> groupTasks = taskService.createNativeTaskQuery()
.sql("select _TASK.*" +
" from " + taskTable + " _TASK" +
" join " + identityLinkTable + " _LINK on _TASK.ID_ = _LINK.TASK_ID_" +
" where _LINK.TYPE_ = 'candidate'" +
" and _LINK.GROUP_ID_ = #{groupId}")
.parameter("groupId", groupId)
.list();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With