Package org.activiti.engine.history

Examples of org.activiti.engine.history.HistoricProcessInstance


 
  @RequestMapping(value="/history/historic-process-instances/{processInstanceId}/comments", method = RequestMethod.POST, produces = "application/json")
  public CommentResponse createComment(@PathVariable String processInstanceId, @RequestBody CommentResponse comment,
      HttpServletRequest request, HttpServletResponse response) {
   
    HistoricProcessInstance instance = getHistoricProcessInstanceFromRequest(processInstanceId);
   
    if (comment.getMessage() == null) {
      throw new ActivitiIllegalArgumentException("Comment text is required.");
    }
   
    Comment createdComment = taskService.addComment(null, instance.getId(), comment.getMessage());
    response.setStatus(HttpStatus.CREATED.value());
   
    String serverRootUrl = request.getRequestURL().toString();
    serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/history/historic-process-instances/"));
    return restResponseFactory.createRestComment(createdComment, serverRootUrl);
View Full Code Here


    serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/history/historic-process-instances/"));
    return restResponseFactory.createRestComment(createdComment, serverRootUrl);
  }
  
   protected HistoricProcessInstance getHistoricProcessInstanceFromRequest(String processInstanceId) {
      HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
             .processInstanceId(processInstanceId).singleResult();
      if (processInstance == null) {
        throw new ActivitiObjectNotFoundException("Could not find a process instance with id '" + processInstanceId + "'.", HistoricProcessInstance.class);
      }
      return processInstance;
View Full Code Here

 
  @RequestMapping(value="/history/historic-process-instances/{processInstanceId}/comments/{commentId}", method = RequestMethod.GET, produces = "application/json")
  public CommentResponse getComment(@PathVariable("processInstanceId") String processInstanceId,
      @PathVariable("commentId") String commentId, HttpServletRequest request) {
    
    HistoricProcessInstance instance = getHistoricProcessInstanceFromRequest(processInstanceId);
    
    Comment comment = taskService.getComment(commentId);
    if (comment == null || comment.getProcessInstanceId() == null || !comment.getProcessInstanceId().equals(instance.getId())) {
      throw new ActivitiObjectNotFoundException("Process instance '" + instance.getId() + "' doesn't have a comment with id '" + commentId + "'.", Comment.class);
    }
   
    String serverRootUrl = request.getRequestURL().toString();
    serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/history/historic-process-instances/"));
    return restResponseFactory.createRestComment(comment, serverRootUrl);
View Full Code Here

 
  @RequestMapping(value="/history/historic-process-instances/{processInstanceId}/comments/{commentId}", method = RequestMethod.DELETE)
  public void deleteComment(@PathVariable("processInstanceId") String processInstanceId,
      @PathVariable("commentId") String commentId, HttpServletRequest request, HttpServletResponse response) {
   
    HistoricProcessInstance instance = getHistoricProcessInstanceFromRequest(processInstanceId);
   
    Comment comment = taskService.getComment(commentId);
    if (comment == null || comment.getProcessInstanceId() == null || !comment.getProcessInstanceId().equals(instance.getId())) {
      throw new ActivitiObjectNotFoundException("Process instance '" + instance.getId() + "' doesn't have a comment with id '" + commentId + "'.", Comment.class);
    }
   
    taskService.deleteComment(commentId);
    response.setStatus(HttpStatus.NO_CONTENT.value());
  }
View Full Code Here

    taskService.deleteComment(commentId);
    response.setStatus(HttpStatus.NO_CONTENT.value());
  }
 
protected HistoricProcessInstance getHistoricProcessInstanceFromRequest(String processInstanceId) {
    HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
           .processInstanceId(processInstanceId).singleResult();
    if (processInstance == null) {
      throw new ActivitiObjectNotFoundException("Could not find a process instance with id '" + processInstanceId + "'.", HistoricProcessInstance.class);
    }
    return processInstance;
View Full Code Here

 
  @RequestMapping(value="/history/historic-process-instances/{processInstanceId}/comments", method = RequestMethod.GET, produces = "application/json")
  public List<CommentResponse> getComments(@PathVariable String processInstanceId, HttpServletRequest request) {
    List<CommentResponse> result = new ArrayList<CommentResponse>();
   
    HistoricProcessInstance instance = getHistoricProcessInstanceFromRequest(processInstanceId);
   
    String serverRootUrl = request.getRequestURL().toString();
    serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/history/historic-process-instances/"));
    for (Comment comment : taskService.getProcessInstanceComments(instance.getId())) {
      result.add(restResponseFactory.createRestComment(comment, serverRootUrl));
    }
   
    return result;
  }
View Full Code Here

    historyService.deleteHistoricProcessInstance(processInstanceId);
    response.setStatus(HttpStatus.NO_CONTENT.value());
  }
 
  protected HistoricProcessInstance getHistoricProcessInstanceFromRequest(String processInstanceId) {
    HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
           .processInstanceId(processInstanceId).singleResult();
    if (processInstance == null) {
      throw new ActivitiObjectNotFoundException("Could not find a process instance with id '" + processInstanceId + "'.", HistoricProcessInstance.class);
    }
    return processInstance;
View Full Code Here

    }
  }
 
  public RestVariable getVariableFromRequest(boolean includeBinary, String processInstanceId, String variableName, HttpServletRequest request) {
   
    HistoricProcessInstance processObject = historyService.createHistoricProcessInstanceQuery()
        .processInstanceId(processInstanceId).includeProcessVariables().singleResult();
   
    if (processObject == null) {
      throw new ActivitiObjectNotFoundException("Historic process instance '" + processInstanceId + "' couldn't be found.", HistoricProcessInstanceEntity.class);
    }
   
    Object value = processObject.getProcessVariables().get(variableName);
   
    if (value == null) {
        throw new ActivitiObjectNotFoundException("Historic process instance '" + processInstanceId + "' variable value for " + variableName + " couldn't be found.", VariableInstanceEntity.class);
    } else {
      String serverRootUrl = request.getRequestURL().toString();
View Full Code Here

    ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().singleResult();
    assertEquals("bzKey", processInstance.getBusinessKey());

    if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
      HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().singleResult();
      assertEquals("bzKey", historicProcessInstance.getBusinessKey());
    }
  }
View Full Code Here

    ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().singleResult();
    assertEquals("testKey", processInstance.getBusinessKey());

    if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
      HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().singleResult();
      assertEquals("testKey", historicProcessInstance.getBusinessKey());
    }
   
    runtimeService.updateBusinessKey(processInstance.getId(), "newKey");
   
    processInstance = runtimeService.createProcessInstanceQuery().singleResult();
    assertEquals("newKey", processInstance.getBusinessKey());
   
    if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
      HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().singleResult();
      assertEquals("newKey", historicProcessInstance.getBusinessKey());
    }
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.history.HistoricProcessInstance

Copyright © 2018 www.massapicom. 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.