use of org.activiti.engine.impl.persistence.entity.HistoricIdentityLinkEntity in project Activiti by Activiti.
the class GetHistoricIdentityLinksForTaskCmd method getLinksForTask.
@SuppressWarnings({ "unchecked", "rawtypes" })
protected List<HistoricIdentityLink> getLinksForTask(CommandContext commandContext) {
HistoricTaskInstanceEntity task = commandContext.getHistoricTaskInstanceEntityManager().findHistoricTaskInstanceById(taskId);
if (task == null) {
throw new ActivitiObjectNotFoundException("No historic task exists with the given id: " + taskId, HistoricTaskInstance.class);
}
List<HistoricIdentityLink> identityLinks = (List) commandContext.getHistoricIdentityLinkEntityManager().findHistoricIdentityLinksByTaskId(taskId);
// Similar to GetIdentityLinksForTask, return assignee and owner as identity link
if (task.getAssignee() != null) {
HistoricIdentityLinkEntity identityLink = new HistoricIdentityLinkEntity();
identityLink.setUserId(task.getAssignee());
identityLink.setTaskId(task.getId());
identityLink.setType(IdentityLinkType.ASSIGNEE);
identityLinks.add(identityLink);
}
if (task.getOwner() != null) {
HistoricIdentityLinkEntity identityLink = new HistoricIdentityLinkEntity();
identityLink.setTaskId(task.getId());
identityLink.setUserId(task.getOwner());
identityLink.setType(IdentityLinkType.OWNER);
identityLinks.add(identityLink);
}
return identityLinks;
}
use of org.activiti.engine.impl.persistence.entity.HistoricIdentityLinkEntity in project Activiti by Activiti.
the class DefaultHistoryManager method recordIdentityLinkCreated.
// Identity link related history
/* (non-Javadoc)
* @see org.activiti.engine.impl.history.HistoryManagerInterface#recordIdentityLinkCreated(org.activiti.engine.impl.persistence.entity.IdentityLinkEntity)
*/
@Override
public void recordIdentityLinkCreated(IdentityLinkEntity identityLink) {
// to a process-definition only as this is never kept in history
if (isHistoryLevelAtLeast(HistoryLevel.AUDIT) && (identityLink.getProcessInstanceId() != null || identityLink.getTaskId() != null)) {
HistoricIdentityLinkEntity historicIdentityLinkEntity = new HistoricIdentityLinkEntity(identityLink);
getDbSqlSession().insert(historicIdentityLinkEntity);
}
}
Aggregations