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

Examples of org.activiti.rest.service.api.runtime.task.TaskResponse


  public RestResponseFactory() {
    initializeVariableConverters();
  }
 
  public TaskResponse createTaskResponse(Task task, String serverRootUrl) {
    TaskResponse response = new TaskResponse(task);
    response.setUrl(formatUrl(serverRootUrl, RestUrls.URL_TASK, task.getId()));

    // Add references to other resources, if needed
    if (response.getParentTaskId() != null) {
      response.setParentTaskUrl(formatUrl(serverRootUrl, RestUrls.URL_TASK, response.getParentTaskId()));
    }
    if (response.getProcessDefinitionId() != null) {
      response.setProcessDefinitionUrl(formatUrl(serverRootUrl, RestUrls.URL_PROCESS_DEFINITION, response.getProcessDefinitionId()));
    }
    if (response.getExecutionId() != null) {
      response.setExecutionUrl(formatUrl(serverRootUrl, RestUrls.URL_EXECUTION, response.getExecutionId()));
    }
    if (response.getProcessInstanceId() != null) {
      response.setProcessInstanceUrl(formatUrl(serverRootUrl, RestUrls.URL_PROCESS_INSTANCE, response.getProcessInstanceId()));
    }
   
    if (task.getProcessVariables() != null) {
      Map<String, Object> variableMap = task.getProcessVariables();
      for (String name : variableMap.keySet()) {
        response.addVariable(createRestVariable(name, variableMap.get(name),
            RestVariableScope.GLOBAL, task.getId(), VARIABLE_TASK, false, serverRootUrl));
      }
    }
    if (task.getTaskLocalVariables() != null) {
      Map<String, Object> variableMap = task.getTaskLocalVariables();
      for (String name : variableMap.keySet()) {
        response.addVariable(createRestVariable(name, variableMap.get(name),
            RestVariableScope.LOCAL, task.getId(), VARIABLE_TASK, false, serverRootUrl));
      }
    }
   
    return response;
View Full Code Here

TOP

Related Classes of org.activiti.rest.service.api.runtime.task.TaskResponse

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.