cancel
Showing results for 
Search instead for 
Did you mean: 

question about rest service

whdwsl
Champ in-the-making
Champ in-the-making
hi , i have a question about the rest service : Get Process Instance Details, Request: GET /process-instance/{processInstanceId}

through this api, i can get one processinstance detail, but when i watch the tasks in this process instance, i found the assignee is null, but in db, there is a value and not null, when i check the source code ,i found the following:
if (historicTaskInstance.getOwner() != null) {
               taskJSON.put("owner", historicTaskInstance.getOwner());
            } else {
               taskJSON.putNull("owner");
            }
            if (historicTaskInstance.getOwner() != null) {
               taskJSON.put("assignee", historicTaskInstance.getAssignee());
            } else {
               taskJSON.putNull("assignee");
            }


why there must be a owner?  owner can only be setted via api, and i found little about the owner in guide. there must be sth i don`t know suck as what does owner mean?  which business situation  it is  used?  why is there a rule when i get the assignee value a owner must be setted; and when the owner should be setted , etc. i need help,    thanks a lot.
5 REPLIES 5

frederikherema1
Star Contributor
Star Contributor
That seems like an issue, and should use if(assignee != null) instead. Has been fixed in november (presume 5.11, certainly 5.12):


if (historicTaskInstance.getAssignee() != null) {
          taskJSON.put("assignee", historicTaskInstance.getAssignee());
        } else {
          taskJSON.putNull("assignee");
        }

whdwsl
Champ in-the-making
Champ in-the-making
hi, frederikheremans , thanks for replying.  i do use the version 5.10 .   

i still have some questions.  what does the task owner mean? which business situation it is used? and when the owner should be setted in coding? is there a  introduction?

any one can help?

jbarrez
Star Contributor
Star Contributor
i still have some questions. what does the task owner mean? which business situation it is used? and when the owner should be setted in coding? is there a introduction?

The owner is the person responsible for the task. But the owner can delegate to another user to actually do it. When this task is done, the owner is notified.

whdwsl
Champ in-the-making
Champ in-the-making
hi, jbarrez . thanks for your replying.

i searched the source of activiti-engine and found  the task owner can be used as follow:
1. taskServiceImpl. delegateTask(String taskId, String userId)    this method can delegate a task to a user
        delegate :one task can have one owner and one assignee . 
        
The owner is the person responsible for the task. But the owner can delegate to another user to actually do it. When          this task is done, the owner is notified.
        it means we can delegate the task to a user. after this user complete the task,it will be assigned to the owner。here is a tip :when the user complete the task delegated to him, we should use the method:taskServiceImpl. resolveTask(String taskId) instead of
task.complete()
。resolveTask have two steps:
1> update the task status to DelegationState. RESOLVED
2> invoke task. setAssignee(owner)

delegateTask(taskId, userId) can do the follow:
1> query the task through taskId
2>  update the task status to DelegationState.PENDING
3> if the task.getOwner == null ,task.setOwner(assignee)
4> Task.setAssignee(userId);



about involved user of a task:
        when we querying user`s task, involvedUser can be a condition 。in the query sql,   we can see the following snippet:
                  <if test="involvedUser != null">
        And ACT_RU_IDENTITYLINK.USER_ID_ = #{involvedUser}
      </if>
         so Involved   means  assignee,  candidate user, owner



conclusion:
1. Owner  can be used  only(is`t strict? )  in  delegating a task
2. Involved  means related,it contains assignee,  candidate user, owner  but no  candidate group

jbarrez
Star Contributor
Star Contributor
Thats a very good summary indeed 🙂