Examples of HistoricTaskInstance


Examples of org.activiti.engine.history.HistoricTaskInstance

public class TaskEventCollectionResource extends TaskBaseResource {

  @RequestMapping(value="/runtime/tasks/{taskId}/events", method = RequestMethod.GET, produces="application/json")
  public List<EventResponse> getEvents(@PathVariable String taskId, HttpServletRequest request) {
    List<EventResponse> result = new ArrayList<EventResponse>();
    HistoricTaskInstance task = getHistoricTaskFromRequest(taskId);
   
    String serverRootUrl = request.getRequestURL().toString();
    serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/runtime/tasks/"));
   
    for (Event event : taskService.getTaskEvents(task.getId())) {
      result.add(restResponseFactory.createEventResponse(event, serverRootUrl));
    }
   
    return result;
  }
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

    historyService.deleteHistoricTaskInstance(taskId);
    response.setStatus(HttpStatus.NO_CONTENT.value());
  }
 
  protected HistoricTaskInstance getHistoricTaskInstanceFromRequest(String taskId) {
    HistoricTaskInstance taskInstance = historyService.createHistoricTaskInstanceQuery()
           .taskId(taskId).singleResult();
    if (taskInstance == null) {
      throw new ActivitiObjectNotFoundException("Could not find a task instance with id '" + taskId + "'.", HistoricTaskInstance.class);
    }
    return taskInstance;
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

   
    String taskId = runtimeTask.getId();
    String taskDefinitionKey = runtimeTask.getTaskDefinitionKey();
   
    assertEquals(1, historyService.createHistoricTaskInstanceQuery().count());
    HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
    assertEquals(taskId, historicTaskInstance.getId());
    assertEquals(1234, historicTaskInstance.getPriority());
    assertEquals("Clean up", historicTaskInstance.getName());
    assertEquals("Schedule an engineering meeting for next week with the new hire.", historicTaskInstance.getDescription());
    assertEquals(dueDate, historicTaskInstance.getDueDate());
    assertEquals("kermit", historicTaskInstance.getAssignee());
    assertEquals(taskDefinitionKey, historicTaskInstance.getTaskDefinitionKey());
    assertEquals("expressionFormKey", historicTaskInstance.getFormKey());
    assertNull(historicTaskInstance.getEndTime());
    assertNull(historicTaskInstance.getDurationInMillis());
    assertNull(historicTaskInstance.getWorkTimeInMillis());
   
    runtimeService.setVariable(processInstanceId, "deadline", "yesterday");
   
    taskService.claim(taskId, "kermit");
   
    assertEquals(1, historyService.createHistoricTaskInstanceQuery().count());
    historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
    assertNotNull(historicTaskInstance.getClaimTime());
    assertNull(historicTaskInstance.getWorkTimeInMillis());
    assertEquals("expressionFormKey", historicTaskInstance.getFormKey());
   
    taskService.complete(taskId);
   
    assertEquals(1, historyService.createHistoricTaskInstanceQuery().count());

    historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
    assertEquals(taskId, historicTaskInstance.getId());
    assertEquals(1234, historicTaskInstance.getPriority());
    assertEquals("Clean up", historicTaskInstance.getName());
    assertEquals("Schedule an engineering meeting for next week with the new hire.", historicTaskInstance.getDescription());
    assertEquals(dueDate, historicTaskInstance.getDueDate());
    assertEquals("kermit", historicTaskInstance.getAssignee());
    assertEquals(TaskEntity.DELETE_REASON_COMPLETED, historicTaskInstance.getDeleteReason());
    assertEquals(taskDefinitionKey, historicTaskInstance.getTaskDefinitionKey());
    assertEquals("expressionFormKey", historicTaskInstance.getFormKey());
    assertNotNull(historicTaskInstance.getEndTime());
    assertNotNull(historicTaskInstance.getDurationInMillis());
    assertNotNull(historicTaskInstance.getClaimTime());
    assertNotNull(historicTaskInstance.getWorkTimeInMillis());
   
    historyService.deleteHistoricTaskInstance(taskId);

    assertEquals(0, historyService.createHistoricTaskInstanceQuery().count());
  }
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

    // Process definition key
    assertEquals(1, historyService.createHistoricTaskInstanceQuery().processDefinitionKey("HistoricTaskQueryTest").count());
    assertEquals(0, historyService.createHistoricTaskInstanceQuery().processDefinitionKey("unexistingdefinitionkey").count());
   
    // Form key
    HistoricTaskInstance historicTask = historyService.createHistoricTaskInstanceQuery()
        .processInstanceId(finishedInstance.getId()).singleResult();
    assertEquals("testFormKey", historicTask.getFormKey());
   
    // Assignee
    assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskAssignee("kermit").count());
    assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskAssignee("johndoe").count());
    assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskAssigneeLike("%ermit").count());
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

    }
   
    taskService.complete(task.getId());
   
    // Check if all variables have the value for the latest revision
    HistoricTaskInstance taskInstance = historyService.createHistoricTaskInstanceQuery()
        .taskId(task.getId())
        .includeProcessVariables()
        .singleResult();
   
    Object varValue = taskInstance.getProcessVariables().get("procVar");
    assertEquals(9, varValue);
   
    taskInstance = historyService.createHistoricTaskInstanceQuery()
        .taskId(task.getId())
        .includeTaskLocalVariables()
        .singleResult();
   
    varValue = taskInstance.getTaskLocalVariables().get("taskVar");
    assertEquals(9, varValue);
  }
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

      }
    } else {
      taskQuery.includeTaskLocalVariables().includeProcessVariables();
    }
   
    HistoricTaskInstance taskObject = taskQuery.singleResult();
   
    if (taskObject == null) {
      throw new ActivitiObjectNotFoundException("Historic task instance '" + taskId + "' couldn't be found.", HistoricTaskInstanceEntity.class);
    }
   
    Object value = null;
    if (variableScope != null) {
      if (variableScope == RestVariableScope.GLOBAL) {
        value = taskObject.getProcessVariables().get(variableName);
      } else {
        value = taskObject.getTaskLocalVariables().get(variableName);
      }
    } else {
      // look for local task variables first
      if (taskObject.getTaskLocalVariables().containsKey(variableName)) {
        value = taskObject.getTaskLocalVariables().get(variableName);
      } else {
        value = taskObject.getProcessVariables().get(variableName);
      }
    }
   
    if (value == null) {
      throw new ActivitiObjectNotFoundException("Historic task instance '" + taskId + "' variable value for " + variableName + " couldn't be found.", VariableInstanceEntity.class);
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

      task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
      assertNull(task);
     
      if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
        // Check that the historic task has been deleted and delete-reason has been set
        HistoricTaskInstance instance = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
        assertNotNull(instance);
        assertEquals("fortestingpurposes", instance.getDeleteReason());
      }
     
    } finally {
      // Clean adhoc-tasks even if test fails
      List<Task> tasks = taskService.createTaskQuery().list();
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

     
      task = taskService.createTaskQuery().taskId(taskId).singleResult();
      assertNull(task);
     
      if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
        HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
        assertNotNull(historicTaskInstance);
        List<HistoricVariableInstance> updates =  historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).list();
        assertNotNull(updates);
        assertEquals(2, updates.size());
        boolean foundFirst = false;
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

  @RequestMapping(value="/runtime/tasks/{taskId}/comments/{commentId}", method = RequestMethod.GET, produces="application/json")
  public CommentResponse getComment(@PathVariable("taskId") String taskId,
      @PathVariable("commentId") String commentId, HttpServletRequest request) {
   
    HistoricTaskInstance task = getHistoricTaskFromRequest(taskId);
   
    Comment comment = taskService.getComment(commentId);
    if (comment == null || !task.getId().equals(comment.getTaskId())) {
      throw new ActivitiObjectNotFoundException("Task '" + task.getId() +"' doesn't have a comment with id '" + commentId + "'.", Comment.class);
    }
   
    String serverRootUrl = request.getRequestURL().toString();
    serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/runtime/tasks/"));
   
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

   
    // Validate history
    if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
      List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery().orderByTaskAssignee().asc().list();
      for (int i=0; i<historicTaskInstances.size(); i++) {
        HistoricTaskInstance hi = historicTaskInstances.get(i);
        assertNotNull(hi.getStartTime());
        assertNotNull(hi.getEndTime());
        assertEquals("kermit_"+i, hi.getAssignee());
      }
     
      List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityType("userTask").list();
      assertEquals(3, historicActivityInstances.size());
      for (HistoricActivityInstance hai : historicActivityInstances) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.