Package org.activiti.rest.service.api.runtime.process

Examples of org.activiti.rest.service.api.runtime.process.ProcessInstanceResponse


    }
    return result ;
  }
 
  public ProcessInstanceResponse createProcessInstanceResponse(ProcessInstance processInstance, String serverRootUrl) {
    ProcessInstanceResponse result = new ProcessInstanceResponse();
    result.setActivityId(processInstance.getActivityId());
    result.setBusinessKey(processInstance.getBusinessKey());
    result.setId(processInstance.getId());
    result.setProcessDefinitionId(processInstance.getProcessDefinitionId());
    result.setProcessDefinitionUrl(formatUrl(serverRootUrl, RestUrls.URL_PROCESS_DEFINITION, processInstance.getProcessDefinitionId()));
    result.setEnded(processInstance.isEnded());
    result.setSuspended(processInstance.isSuspended());
    result.setUrl(formatUrl(serverRootUrl, RestUrls.URL_PROCESS_INSTANCE, processInstance.getId()));
    result.setTenantId(processInstance.getTenantId());
   
    //Added by Ryan Johnston
    if (processInstance.isEnded()) {
      //Process complete. Note the same in the result.
      result.setCompleted(true);
    } else {
      //Process not complete. Note the same in the result.
      result.setCompleted(false);
    }
    //End Added by Ryan Johnston
   
    if (processInstance.getProcessVariables() != null) {
      Map<String, Object> variableMap = processInstance.getProcessVariables();
      for (String name : variableMap.keySet()) {
        result.addVariable(createRestVariable(name, variableMap.get(name),
            RestVariableScope.LOCAL, processInstance.getId(), VARIABLE_PROCESS, false, serverRootUrl));
      }
    }
   
    return result;
View Full Code Here


  }
 
  public ProcessInstanceResponse createProcessInstanceResponse(ProcessInstance processInstance, boolean returnVariables,
      Map<String, Object> runtimeVariableMap, List<HistoricVariableInstance> historicVariableList, String serverRootUrl) {
   
    ProcessInstanceResponse result = new ProcessInstanceResponse();
    result.setActivityId(processInstance.getActivityId());
    result.setBusinessKey(processInstance.getBusinessKey());
    result.setId(processInstance.getId());
    result.setProcessDefinitionId(processInstance.getProcessDefinitionId());
    result.setProcessDefinitionUrl(formatUrl(serverRootUrl, RestUrls.URL_PROCESS_DEFINITION, processInstance.getProcessDefinitionId()));
    result.setEnded(processInstance.isEnded());
    result.setSuspended(processInstance.isSuspended());
    result.setUrl(formatUrl(serverRootUrl, RestUrls.URL_PROCESS_INSTANCE, processInstance.getId()));
    result.setTenantId(processInstance.getTenantId());
   
    //Added by Ryan Johnston
    if (processInstance.isEnded()) {
      //Process complete. Note the same in the result.
      result.setCompleted(true);
    } else {
      //Process not complete. Note the same in the result.
      result.setCompleted(false);
    }
   
    if (returnVariables) {
     
      if (processInstance.isEnded()) {
        if (historicVariableList != null) {
          for (HistoricVariableInstance historicVariable : historicVariableList) {
            result.addVariable(createRestVariable(historicVariable.getVariableName(), historicVariable.getValue(),
                RestVariableScope.LOCAL, processInstance.getId(), VARIABLE_PROCESS, false, serverRootUrl));
          }
        }
       
      } else {
        if (runtimeVariableMap != null) {
          for (String name : runtimeVariableMap.keySet()) {
            result.addVariable(createRestVariable(name, runtimeVariableMap.get(name),
                RestVariableScope.LOCAL, processInstance.getId(), VARIABLE_PROCESS, false, serverRootUrl));
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.activiti.rest.service.api.runtime.process.ProcessInstanceResponse

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.