Search in sources :

Example 1 with HistoricTaskInstanceResponse

use of org.activiti.rest.service.api.history.HistoricTaskInstanceResponse in project Activiti by Activiti.

the class RestResponseFactory method createHistoricTaskInstanceResponse.

public HistoricTaskInstanceResponse createHistoricTaskInstanceResponse(HistoricTaskInstance taskInstance, RestUrlBuilder urlBuilder) {
    HistoricTaskInstanceResponse result = new HistoricTaskInstanceResponse();
    result.setAssignee(taskInstance.getAssignee());
    result.setClaimTime(taskInstance.getClaimTime());
    result.setDeleteReason(taskInstance.getDeleteReason());
    result.setDescription(taskInstance.getDescription());
    result.setDueDate(taskInstance.getDueDate());
    result.setDurationInMillis(taskInstance.getDurationInMillis());
    result.setEndTime(taskInstance.getEndTime());
    result.setExecutionId(taskInstance.getExecutionId());
    result.setFormKey(taskInstance.getFormKey());
    result.setId(taskInstance.getId());
    result.setName(taskInstance.getName());
    result.setOwner(taskInstance.getOwner());
    result.setParentTaskId(taskInstance.getParentTaskId());
    result.setPriority(taskInstance.getPriority());
    result.setProcessDefinitionId(taskInstance.getProcessDefinitionId());
    result.setTenantId(taskInstance.getTenantId());
    result.setCategory(taskInstance.getCategory());
    if (taskInstance.getProcessDefinitionId() != null) {
        result.setProcessDefinitionUrl(urlBuilder.buildUrl(RestUrls.URL_PROCESS_DEFINITION, taskInstance.getProcessDefinitionId()));
    }
    result.setProcessInstanceId(taskInstance.getProcessInstanceId());
    if (taskInstance.getProcessInstanceId() != null) {
        result.setProcessInstanceUrl(urlBuilder.buildUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE, taskInstance.getProcessInstanceId()));
    }
    result.setStartTime(taskInstance.getStartTime());
    result.setTaskDefinitionKey(taskInstance.getTaskDefinitionKey());
    result.setWorkTimeInMillis(taskInstance.getWorkTimeInMillis());
    result.setUrl(urlBuilder.buildUrl(RestUrls.URL_HISTORIC_TASK_INSTANCE, taskInstance.getId()));
    if (taskInstance.getProcessVariables() != null) {
        Map<String, Object> variableMap = taskInstance.getProcessVariables();
        for (String name : variableMap.keySet()) {
            result.addVariable(createRestVariable(name, variableMap.get(name), RestVariableScope.GLOBAL, taskInstance.getId(), VARIABLE_HISTORY_TASK, false, urlBuilder));
        }
    }
    if (taskInstance.getTaskLocalVariables() != null) {
        Map<String, Object> variableMap = taskInstance.getTaskLocalVariables();
        for (String name : variableMap.keySet()) {
            result.addVariable(createRestVariable(name, variableMap.get(name), RestVariableScope.LOCAL, taskInstance.getId(), VARIABLE_HISTORY_TASK, false, urlBuilder));
        }
    }
    return result;
}
Also used : HistoricTaskInstanceResponse(org.activiti.rest.service.api.history.HistoricTaskInstanceResponse)

Example 2 with HistoricTaskInstanceResponse

use of org.activiti.rest.service.api.history.HistoricTaskInstanceResponse in project Activiti by Activiti.

the class RestResponseFactory method createHistoricTaskInstanceResponseList.

public List<HistoricTaskInstanceResponse> createHistoricTaskInstanceResponseList(List<HistoricTaskInstance> taskInstances) {
    RestUrlBuilder urlBuilder = createUrlBuilder();
    List<HistoricTaskInstanceResponse> responseList = new ArrayList<HistoricTaskInstanceResponse>();
    for (HistoricTaskInstance instance : taskInstances) {
        responseList.add(createHistoricTaskInstanceResponse(instance, urlBuilder));
    }
    return responseList;
}
Also used : HistoricTaskInstance(org.activiti.engine.history.HistoricTaskInstance) HistoricTaskInstanceResponse(org.activiti.rest.service.api.history.HistoricTaskInstanceResponse) ArrayList(java.util.ArrayList)

Aggregations

HistoricTaskInstanceResponse (org.activiti.rest.service.api.history.HistoricTaskInstanceResponse)2 ArrayList (java.util.ArrayList)1 HistoricTaskInstance (org.activiti.engine.history.HistoricTaskInstance)1