Do you have support to trace history when changing assignee or candidate?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2014 10:39 PM
Well, hi all.
As my topic tittle, I wonder if Activiti support us tracing history when changing assignee or candidate? Or I have to have separate logging when do those actions?
As my topic tittle, I wonder if Activiti support us tracing history when changing assignee or candidate? Or I have to have separate logging when do those actions?
Labels:
- Labels:
-
Archive
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2014 02:22 AM
Hi,
Claim event is recorded
Regards
Martin
Claim event is recorded
public void recordTaskClaim(String taskId) {
if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) {
HistoricTaskInstanceEntity historicTaskInstance = getDbSqlSession().selectById(HistoricTaskInstanceEntity.class, taskId);
if (historicTaskInstance != null) {
historicTaskInstance.setClaimTime( ClockUtil.getCurrentTime());
}
}
}
Regards
Martin
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2014 03:23 AM
Thanks. It is helpful for me. However, I think it is time for someone claimed task, it does not really relate to time I change assignee/group, isn't it?
I have one more question. I use this method to change candidate group, is it okay?
<code>
processEngine.getTaskService().addCandidateGroup(taskId, newGroupID);
processEngine.getTaskService().deleteCandidateGroup(taskId, oldGroup);
</code>
If using this way, how can I track history by using Activiti API?
And when I set assignee using "processEngine.getTaskService().setAssignee(taskId, userId)" for someone, is he/her set up default claimTime?
I have one more question. I use this method to change candidate group, is it okay?
<code>
processEngine.getTaskService().addCandidateGroup(taskId, newGroupID);
processEngine.getTaskService().deleteCandidateGroup(taskId, oldGroup);
</code>
If using this way, how can I track history by using Activiti API?
And when I set assignee using "processEngine.getTaskService().setAssignee(taskId, userId)" for someone, is he/her set up default claimTime?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2014 10:01 AM
You can track the history of identity links with the HistoryService.
So setAssignee doesn't set the claim time, that's only done when you execute the claim method.
Best regards,
So setAssignee doesn't set the claim time, that's only done when you execute the claim method.
Best regards,
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2014 09:53 PM
I try to trace the history of changing assignee. Here are my steps:
- start process instance
- change assignee of one task : for example
<code>
processEngine.getTaskService().setAssignee("69", "kermit");
processEngine.getTaskService().claim("69", "kermit");
</code>
- then change again
<code>
processEngine.getTaskService().setAssignee("69", "gonzo");
processEngine.getTaskService().claim("69", "gonzo");
</code>
- try to trace identifyLink
<code>
List<HistoricTaskInstance> listTask = null;
listTask = processEngine.getHistoryService().createHistoricTaskInstanceQuery().finished().list();
for (HistoricTaskInstance historicTaskInstance : listTask) {
List<HistoricIdentityLink> identityLinks = processEngine.getHistoryService().getHistoricIdentityLinksForTask(historicTaskInstance.getId());
for(HistoricIdentityLink historicIdentityLink:identityLinks){
System.out.println(historicTaskInstance.getId()+"/"+historicTaskInstance.getAssignee()+"/"+historicIdentityLink.getUserId()+"/"+historicTaskInstance.getClaimTime()+"/"+historicTaskInstance.getStartTime());
}
}
</code>
I though that the identityLinks would record the change from gonzo–> kermit–> gonzo. However, it only recorded the newest change: information of the gonzo. So using this way, I can not trace the changing assignee history. Do I mistake somewhere?
- start process instance
- change assignee of one task : for example
<code>
processEngine.getTaskService().setAssignee("69", "kermit");
processEngine.getTaskService().claim("69", "kermit");
</code>
- then change again
<code>
processEngine.getTaskService().setAssignee("69", "gonzo");
processEngine.getTaskService().claim("69", "gonzo");
</code>
- try to trace identifyLink
<code>
List<HistoricTaskInstance> listTask = null;
listTask = processEngine.getHistoryService().createHistoricTaskInstanceQuery().finished().list();
for (HistoricTaskInstance historicTaskInstance : listTask) {
List<HistoricIdentityLink> identityLinks = processEngine.getHistoryService().getHistoricIdentityLinksForTask(historicTaskInstance.getId());
for(HistoricIdentityLink historicIdentityLink:identityLinks){
System.out.println(historicTaskInstance.getId()+"/"+historicTaskInstance.getAssignee()+"/"+historicIdentityLink.getUserId()+"/"+historicTaskInstance.getClaimTime()+"/"+historicTaskInstance.getStartTime());
}
}
</code>
I though that the identityLinks would record the change from gonzo–> kermit–> gonzo. However, it only recorded the newest change: information of the gonzo. So using this way, I can not trace the changing assignee history. Do I mistake somewhere?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2014 01:01 PM
Ah ok now I understand your question. No that's not being stored in the Activiti tables currently. Of course it's possible to maintain an audit list yourself using the Task listeners. We are thinking about adding an additional history table with exactly this information.
Best regards,
Best regards,
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2014 08:36 PM
Thank trademak. I'm waiting for your great Activiti