当前位置: 首页>>代码示例>>Java>>正文


Java HistoricTaskInstance.getEndTime方法代码示例

本文整理汇总了Java中org.activiti.engine.history.HistoricTaskInstance.getEndTime方法的典型用法代码示例。如果您正苦于以下问题:Java HistoricTaskInstance.getEndTime方法的具体用法?Java HistoricTaskInstance.getEndTime怎么用?Java HistoricTaskInstance.getEndTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.history.HistoricTaskInstance的用法示例。


在下文中一共展示了HistoricTaskInstance.getEndTime方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDocApprovalHistory

import org.activiti.engine.history.HistoricTaskInstance; //导入方法依赖的package包/类
/**
 * Returns a list of <strong>completed</strong> Doc Approval Tasks.
 *
 * @param businessKey
 * @return
 */
public List<HistoricTask> getDocApprovalHistory(String businessKey) {
    log.debug("getting historic tasks for doc: " + businessKey);
    HistoricProcessInstance pi = historyService.createHistoricProcessInstanceQuery().
            includeProcessVariables().processInstanceBusinessKey(businessKey).singleResult();

    if (pi == null) {
        return Collections.emptyList();
    }
    log.debug("Duration time in millis: " + pi.getDurationInMillis());
    List<HistoricTaskInstance> hTasks;
    hTasks = historyService.createHistoricTaskInstanceQuery().includeTaskLocalVariables().processInstanceBusinessKey(businessKey).list();
    List<HistoricTask> historicTasks = Lists.newArrayList();
    for (HistoricTaskInstance hti : hTasks) {
        if (StringUtils.startsWith(hti.getProcessDefinitionId(), Workflow.PROCESS_ID_DOC_APPROVAL)
                && hti.getEndTime() != null) {
            historicTasks.add(fromActiviti(hti));
        }
    }
    Collections.sort(historicTasks);
    return historicTasks;
}
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:28,代码来源:LocalTaskService.java

示例2: addTaskList

import org.activiti.engine.history.HistoricTaskInstance; //导入方法依赖的package包/类
private void addTaskList(String processInstanceId, ObjectNode responseJSON) {
  List<HistoricTaskInstance> taskList = ActivitiUtil.getHistoryService()
      .createHistoricTaskInstanceQuery()
      .processInstanceId(processInstanceId)
      .orderByHistoricActivityInstanceStartTime()
      .asc()
      .list();
  
  if(taskList != null && taskList.size() > 0) {
    ArrayNode tasksJSON = new ObjectMapper().createArrayNode();
    responseJSON.put("tasks", tasksJSON);
    for (HistoricTaskInstance historicTaskInstance : taskList) {
      ObjectNode taskJSON = new ObjectMapper().createObjectNode();
      taskJSON.put("taskId", historicTaskInstance.getId());
      taskJSON.put("taskName", historicTaskInstance.getName() != null ? historicTaskInstance.getName() : "null");
      taskJSON.put("owner", historicTaskInstance.getOwner() != null ? historicTaskInstance.getOwner() : "null");
      taskJSON.put("assignee", historicTaskInstance.getAssignee() != null ? historicTaskInstance.getAssignee() : "null");
      taskJSON.put("startTime", RequestUtil.dateToString(historicTaskInstance.getStartTime()));
      if(historicTaskInstance.getEndTime() == null) {
        taskJSON.put("completed", false);
      } else {
        taskJSON.put("completed", true);
        taskJSON.put("endTime", RequestUtil.dateToString(historicTaskInstance.getEndTime()));
        taskJSON.put("duration", historicTaskInstance.getDurationInMillis());
      }
      tasksJSON.add(taskJSON);
    }
  }
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:30,代码来源:ProcessInstanceResource.java

示例3: Task

import org.activiti.engine.history.HistoricTaskInstance; //导入方法依赖的package包/类
public Task(HistoricTaskInstance taskInstance)
{
    this.id = taskInstance.getId();
    this.processId = taskInstance.getProcessInstanceId();
    this.processDefinitionId = taskInstance.getProcessDefinitionId();
    this.activityDefinitionId = taskInstance.getTaskDefinitionKey();
    this.name = taskInstance.getName();
    this.description = taskInstance.getDescription();
    this.dueAt = taskInstance.getDueDate();
    this.startedAt = taskInstance.getStartTime();
    this.endedAt = taskInstance.getEndTime();
    this.durationInMs = taskInstance.getDurationInMillis();
    this.priority = taskInstance.getPriority();
    this.owner = taskInstance.getOwner();
    this.assignee = taskInstance.getAssignee();
    this.formResourceKey = taskInstance.getFormKey();
    if (taskInstance.getEndTime() != null)
    {
    	this.state = TaskStateTransition.COMPLETED.name().toLowerCase();
    }
    else if (taskInstance.getAssignee() != null)
    {
    	this.state = TaskStateTransition.CLAIMED.name().toLowerCase();
    }
    else
    {
    	this.state = TaskStateTransition.UNCLAIMED.name().toLowerCase();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:30,代码来源:Task.java

示例4: addTaskItem

import org.activiti.engine.history.HistoricTaskInstance; //导入方法依赖的package包/类
protected void addTaskItem(HistoricTaskInstance task, Table taskTable) {
  Item item = taskTable.addItem(task.getId());
  
  if(task.getEndTime() != null) {
    item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_FINISHED_22));
  } else {
    item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_22));
  }
  
  item.getItemProperty("name").setValue(task.getName());
  item.getItemProperty("priority").setValue(task.getPriority());
  
  item.getItemProperty("startDate").setValue(new PrettyTimeLabel(task.getStartTime(), true));
  item.getItemProperty("endDate").setValue(new PrettyTimeLabel(task.getEndTime(), true));
  
  if(task.getDueDate() != null) {
    Label dueDateLabel = new PrettyTimeLabel(task.getEndTime(), i18nManager.getMessage(Messages.TASK_NOT_FINISHED_YET), true); 
    item.getItemProperty("dueDate").setValue(dueDateLabel);
  }
  
  if(task.getAssignee() != null) {
    Component taskAssigneeComponent = getTaskAssigneeComponent(task.getAssignee());
    if(taskAssigneeComponent != null) {
      item.getItemProperty("assignee").setValue(taskAssigneeComponent);
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:28,代码来源:ProcessInstanceDetailPanel.java

示例5: getValidHistoricTask

import org.activiti.engine.history.HistoricTaskInstance; //导入方法依赖的package包/类
/**
 * Get a valid {@link HistoricTaskInstance} based on the given task id. Checks if current logged
 * in user is assignee/owner/involved with the task. In case true was passed for "validIfClaimable", 
 * the task is also valid if the current logged in user is a candidate for claiming the task.
 *  
 * @throws EntityNotFoundException when the task was not found
 * @throws PermissionDeniedException when the current logged in user isn't allowed to access task.
 */
protected HistoricTaskInstance getValidHistoricTask(String taskId)
{
    HistoricTaskInstanceQuery query = activitiProcessEngine.getHistoryService()
        .createHistoricTaskInstanceQuery()
        .taskId(taskId);
    
    if (authorityService.isAdminAuthority(AuthenticationUtil.getRunAsUser())) 
    {
        // Admin is allowed to read all tasks in the current tenant
        if (tenantService.isEnabled()) 
        {
            query.processVariableValueEquals(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain());
        }
    }
    else
    {
        // If non-admin user, involvement in the task is required (either owner, assignee or externally involved).
        query.taskInvolvedUser(AuthenticationUtil.getRunAsUser());
    }
    
    HistoricTaskInstance taskInstance = query.singleResult();
    
    if (taskInstance == null) 
    {
        // Either the task doesn't exist or the user is not involved directly. We can differentiate by
        // checking if the task exists without applying the additional filtering
        taskInstance =  activitiProcessEngine.getHistoryService()
            .createHistoricTaskInstanceQuery()
            .taskId(taskId)
            .singleResult();
        
        if (taskInstance == null) 
        {
            // Full error message will be "Task with id: 'id' was not found" 
            throw new EntityNotFoundException(taskId); 
        }
        else
        {
            boolean isTaskClaimable = false;
            if (taskInstance.getEndTime() == null) 
            {
                // Task is not yet finished, so potentially claimable. If user is part of a "candidateGroup", the task is accessible to the
                // user regardless of not being involved/owner/assignee
                isTaskClaimable = activitiProcessEngine.getTaskService()
                        .createTaskQuery()
                        .taskCandidateGroupIn(new ArrayList<String>(authorityService.getAuthoritiesForUser(AuthenticationUtil.getRunAsUser())))
                        .taskId(taskId)
                        .count() == 1;
            }
            
            if (isTaskClaimable == false)
            {
                throw new PermissionDeniedException();
            }
        }
    }
    return taskInstance;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:67,代码来源:TasksImpl.java


注:本文中的org.activiti.engine.history.HistoricTaskInstance.getEndTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。