AnsweredAssumed Answered

task.setAssignee() does not affect ACT_HI_ACTINST

Question asked by naag on Jun 15, 2012
Latest reply on Jun 15, 2012 by naag
Hi all,

it seems that when doing task.setAssignee(), the new assignee is only updated in ACT_RU_TASK and ACT_HI_TASKINST, but not in ACT_HI_ACTINST. This is an excerpt from TaskEntity.java:


  public void setAssignee(String assignee) {
    if (assignee==null && this.assignee==null) {
      return;
    }
    if (assignee!=null && assignee.equals(this.assignee)) {
      return;
    }
    this.assignee = assignee;

    CommandContext commandContext = Context.getCommandContext();
    if (commandContext!=null) {
      commandContext
        .getHistoricTaskInstanceManager()
        .setTaskAssignee(id, assignee);
     
      // if there is no command context, then it means that the user is calling the
      // setAssignee outside a service method.  E.g. while creating a new task.
      if (commandContext!=null) {
        fireEvent(TaskListener.EVENTNAME_ASSIGNMENT);
      }
    }
  }

It's obvious that the HistoricTaskInstance is updated, but why not also the HistoricActivityInstance? Am I doing something wrong? This is happening in a process where the first user task comes right after the process start and has only a candidate set, no assignee. So I claim it manually (via CDI BusinessProcess bean).

Why I need this: I would like to know who made updates to process variables, and since there's no link from ACT_HI_DETAIL to ACT_HI_TASKINST, I have to rely on the information from ACT_HI_ACTINST), see also this thread.

Thanks for your input :-)

Regards,
Peter

Outcomes