We have a multi tier (3 tiers for example) report approval system where tier 1 can write reports and are passed on to tier 2 to approve and then passed on to tier 3 for approval. But tier 2 guys can also help write reports and their reports only go to tier 3 for approval. Reports sent to people for approval go to an inbox and stay there until they are claimed to be worked on and these would go to the candidate group. Reports you submit can also be rejected back to you if you did a lousy job writing it and these would go to candidate user. We don't use assigned because we want to distinguish reports between waiting to be worked on (unclaimed) and working on it (claimed). I think I am able to get around this by using a NativeTask query and joining the task table with the identity link table like this:
List<Task> nativeResult = taskService.createNativeTaskQuery().sql("select t.ID_, t.NAME_, t.PROC_INST_ID_, t.PROC_DEF_ID_, t.TASK_DEF_KEY_ from ACT_RU_TASK t INNER JOIN ACT_RU_IDENTITYLINK i on t.ID_ = i.TASK_ID_ where i.TYPE_ = 'candidate' AND i.USER_ID_ = '" + userId + "'").list();
Does this seem right to you? Obviously, an API call would be preferred so that I don't have to worry about missing out on internal logic or changing db structure breaking things. Any input would be greatly appreciated.