Package org.activiti.engine.runtime

Examples of org.activiti.engine.runtime.Execution


      HttpServletRequest request) {
   
    String serverRootUrl = request.getRequestURL().toString();
    serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/runtime/process-instances/"));
   
    Execution execution = getProcessInstanceFromRequest(processInstanceId);
    return getVariableFromRequest(execution, variableName, scope, false, serverRootUrl);
  }
View Full Code Here


   * Test to validate fix for ACT-1399: Boundary-event and event-based auditing
   */
  @Deployment
  public void testEventBasedGateway() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("catchSignal");
    Execution waitingExecution = runtimeService.createExecutionQuery()
        .signalEventSubscriptionName("alert")
        .singleResult();
    assertNotNull(waitingExecution);
    runtimeService.signalEventReceived("alert", waitingExecution.getId());
   
    assertEquals(0L, runtimeService.createProcessInstanceQuery()
        .processInstanceId(processInstance.getId()).count());
   
    HistoricActivityInstance historicActivityInstance = historyService
View Full Code Here

    ProcessInstance instanceUser = runtimeService.startProcessInstanceByKey("DemoPartialDeletion", inputParamsUser);
    assertNotNull(instanceUser);
    log.info("Process instance (of process model " + instanceUser.getProcessDefinitionId() + ") started with id: " + instanceUser.getId() + ".");
   
    //Assert that the process instance is active.
    Execution executionUser = runtimeService.createExecutionQuery().processInstanceId(instanceUser.getProcessInstanceId()).singleResult();
    assertFalse(executionUser.isEnded());
   
    //Assert that a user task is available for claiming.
    Task taskUser = taskService.createTaskQuery().processInstanceId(instanceUser.getProcessInstanceId()).singleResult();
    assertNotNull(taskUser);
   
    //Delete the process instance.
    runtimeService.deleteProcessInstance(instanceUser.getId(), null);
   
    if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
      //Retrieve the HistoricProcessInstance and assert that there is an end time.
      HistoricProcessInstance hInstanceUser = historyService.createHistoricProcessInstanceQuery().processInstanceId(instanceUser.getId()).singleResult();
      assertNotNull(hInstanceUser.getEndTime());
      log.info("End time for the deleted instance of \"Demo Partial Deletion\" that was started with a Task Type of \"user\": " + hInstanceUser.getEndTime() + ".");
      log.info("Successfully deleted the instance of \"Demo Partial Deletion\" that was started with a Task Type of \"user\".");
    }
   
    //Note that the instance with a Task Type of "java" is being started.
    log.info("Starting an instance of \"Demo Partial Deletion\" with a Task Type of \"java\".");
       
    //Set the inputs for the second process instance, which we will NOT be able to completely delete.
    Map<String,Object> inputParamsJava = new HashMap<String,Object>();
    inputParamsJava.put("taskType", "java");
       
    //Start the process instance & ensure it's started.
    ProcessInstance instanceJava = runtimeService.startProcessInstanceByKey("DemoPartialDeletion", inputParamsJava);
    assertNotNull(instanceJava);
    log.info("Process instance (of process model " + instanceJava.getProcessDefinitionId() + ") started with id: " + instanceJava.getId() + ".");
       
    //Assert that the process instance is active.
    Execution executionJava = runtimeService.createExecutionQuery().processInstanceId(instanceJava.getProcessInstanceId()).singleResult();
    assertFalse(executionJava.isEnded());
   
    // Try to execute job 3 times
    Job jobJava = managementService.createJobQuery().processInstanceId(instanceJava.getId()).singleResult();
    assertNotNull(jobJava);
   
View Full Code Here

      HttpServletRequest request) {
   
    String serverRootUrl = request.getRequestURL().toString();
    serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/runtime/executions/"));
   
    Execution execution = getExecutionFromRequest(executionId);
    return getVariableFromRequest(execution, variableName, scope, false, serverRootUrl);
  }
View Full Code Here

  @RequestMapping(value="/runtime/executions/{executionId}/variables/{variableName}", method = RequestMethod.PUT, produces="application/json")
  public RestVariable updateVariable(@PathVariable("executionId") String executionId,
      @PathVariable("variableName") String variableName,
      HttpServletRequest request) {
   
    Execution execution = getExecutionFromRequest(executionId);
   
    String serverRootUrl = request.getRequestURL().toString();
    serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/runtime/executions/"));
   
    RestVariable result = null;
View Full Code Here

  @RequestMapping(value="/runtime/executions/{executionId}/variables/{variableName}", method = RequestMethod.DELETE)
  public void deleteVariable(@PathVariable("executionId") String executionId,
      @PathVariable("variableName") String variableName, @RequestParam(value="scope", required=false) String scope,
      HttpServletResponse response) {
   
    Execution execution = getExecutionFromRequest(executionId);
    // Determine scope
    RestVariableScope variableScope = RestVariableScope.LOCAL;
    if (scope != null) {
      variableScope = RestVariable.getScopeFromString(scope);
    }

    if (!hasVariableOnScope(execution, variableName, variableScope)) {
      throw new ActivitiObjectNotFoundException("Execution '" + execution.getId() + "' doesn't have a variable '" +
          variableName + "' in scope " + variableScope.name().toLowerCase(), VariableInstanceEntity.class);
    }
   
    if (variableScope == RestVariableScope.LOCAL) {
      runtimeService.removeVariableLocal(execution.getId(), variableName);
    } else {
      // Safe to use parentId, as the hasVariableOnScope would have stopped a global-var update on a root-execution
      runtimeService.removeVariable(execution.getParentId(), variableName);
    }
    response.setStatus(HttpStatus.NO_CONTENT.value());
  }
View Full Code Here

 
  @RequestMapping(value="/runtime/process-instances/{processInstanceId}/variables", method = RequestMethod.GET, produces="application/json")
  public List<RestVariable> getVariables(@PathVariable String processInstanceId,
      @RequestParam(value="scope", required=false) String scope, HttpServletRequest request) {
   
    Execution execution = getProcessInstanceFromRequest(processInstanceId);
    return processVariables(execution, scope, RestResponseFactory.VARIABLE_PROCESS, getServerRootUrl(request));
  }
View Full Code Here

 
  @RequestMapping(value="/runtime/process-instances/{processInstanceId}/variables", method = RequestMethod.PUT, produces="application/json")
  public Object createOrUpdateExecutionVariable(@PathVariable String processInstanceId,
      HttpServletRequest request, HttpServletResponse response) {
   
    Execution execution = getProcessInstanceFromRequest(processInstanceId);
    return createExecutionVariable(execution, true, RestResponseFactory.VARIABLE_PROCESS,
        getServerRootUrl(request), request, response);
  }
View Full Code Here

 
  @RequestMapping(value="/runtime/process-instances/{processInstanceId}/variables", method = RequestMethod.POST, produces="application/json")
  public Object createExecutionVariable(@PathVariable String processInstanceId,
      HttpServletRequest request, HttpServletResponse response) {
   
    Execution execution = getProcessInstanceFromRequest(processInstanceId);
    return createExecutionVariable(execution, false, RestResponseFactory.VARIABLE_PROCESS,
        getServerRootUrl(request), request, response);
  }
View Full Code Here

        getServerRootUrl(request), request, response);
  }
 
  @RequestMapping(value="/runtime/process-instances/{processInstanceId}/variables", method = RequestMethod.DELETE)
  public void deleteLocalVariables(@PathVariable String processInstanceId, HttpServletResponse response) {
    Execution execution = getProcessInstanceFromRequest(processInstanceId);
    deleteAllLocalVariables(execution, response);
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.runtime.Execution

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.