result.setTenantId(processInstance.getTenantId());
return result;
}
public HistoricTaskInstanceResponse createHistoricTaskInstanceResponse(HistoricTaskInstance taskInstance, String serverRootUrl) {
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(formatUrl(serverRootUrl, RestUrls.URL_PROCESS_DEFINITION, taskInstance.getProcessDefinitionId()));
}
result.setProcessInstanceId(taskInstance.getProcessInstanceId());
if (taskInstance.getProcessInstanceId() != null) {
result.setProcessInstanceUrl(formatUrl(serverRootUrl, RestUrls.URL_HISTORIC_PROCESS_INSTANCE, taskInstance.getProcessInstanceId()));
}
result.setStartTime(taskInstance.getStartTime());
result.setTaskDefinitionKey(taskInstance.getTaskDefinitionKey());
result.setWorkTimeInMillis(taskInstance.getWorkTimeInMillis());
result.setUrl(formatUrl(serverRootUrl, 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, serverRootUrl));
}
}
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, serverRootUrl));
}
}
return result;
}