Search in sources :

Example 1 with HistoricTaskInstanceEntity

use of org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity 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;
}
Also used : HistoricIdentityLink(org.activiti.engine.history.HistoricIdentityLink) List(java.util.List) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException) HistoricTaskInstanceEntity(org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity) HistoricIdentityLinkEntity(org.activiti.engine.impl.persistence.entity.HistoricIdentityLinkEntity)

Example 2 with HistoricTaskInstanceEntity

use of org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity in project Activiti by Activiti.

the class DefaultHistoryManager method recordTaskCreated.

// Task related history 
/* (non-Javadoc)
 * @see org.activiti.engine.impl.history.HistoryManagerInterface#recordTaskCreated(org.activiti.engine.impl.persistence.entity.TaskEntity, org.activiti.engine.impl.persistence.entity.ExecutionEntity)
 */
@Override
public void recordTaskCreated(TaskEntity task, ExecutionEntity execution) {
    if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) {
        HistoricTaskInstanceEntity historicTaskInstance = new HistoricTaskInstanceEntity(task, execution);
        getDbSqlSession().insert(historicTaskInstance);
    }
}
Also used : HistoricTaskInstanceEntity(org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity)

Aggregations

HistoricTaskInstanceEntity (org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity)2 List (java.util.List)1 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)1 HistoricIdentityLink (org.activiti.engine.history.HistoricIdentityLink)1 HistoricIdentityLinkEntity (org.activiti.engine.impl.persistence.entity.HistoricIdentityLinkEntity)1