public static Result restJobFromJobId(String jobid) {

    if (jobid == null || jobid.isEmpty()) {
      JsonObject parent = new JsonObject();
      parent.add(JsonKeys.JOBS, new JsonObject());
      return notFound(new Gson().toJson(parent));
    }

    JsonArray taskSummaryArray = new JsonArray();

    String jobDefID = jobid;
    long jobResourceUsed = 0;
    long jobResourceWasted = 0;
    long jobRuntime = 0;
    long jobDelay = 0;
    Severity jobSeverity = Severity.NONE;
    long jobStartTime = Long.MAX_VALUE;
    long jobEndTime = 0;
    String username = "";
    String jobtype = "";
    String jobExecutionId = "";
    String jobDefinitionId = "";
    String flowExecutionId = "";
    String flowDefinitionId = "";
    String jobname = "";
    String queueName = "";
    String scheduler = "";

    List<AppResult> results = getRestJobResultsFromJobExecutionId(jobid);

    if (results.isEmpty()) {
      JsonObject parent = new JsonObject();
      parent.add(JsonKeys.JOBS, new JsonObject());
      return notFound(new Gson().toJson(parent));
    }

    Map<Severity, Long> taskSeverityCount = new HashMap<Severity, Long>();

    for (AppResult task : results) {
      username = task.username;
      jobtype = task.jobType;
      jobname = task.jobName;
      jobExecutionId = task.jobExecId;
      jobDefinitionId = task.jobDefId;
      flowExecutionId = task.flowExecId;
      flowDefinitionId = task.flowDefId;
      queueName = task.queueName;
      scheduler = task.scheduler;

      JsonObject taskObject = new JsonObject();
      JsonArray heuristicsArray = new JsonArray();
      List<AppHeuristicResult> appHeuristicResult = task.yarnAppHeuristicResults;
      for (AppHeuristicResult heuristic : appHeuristicResult) {
        JsonObject heuristicObject = new JsonObject();
        heuristicObject.addProperty(JsonKeys.NAME, heuristic.heuristicName);
        heuristicObject.addProperty(JsonKeys.SEVERITY, heuristic.severity.getText());
        heuristicsArray.add(heuristicObject);
      }

      if (task.severity.getValue() > jobSeverity.getValue()) {
        jobSeverity = task.severity;
      }

      if (taskSeverityCount.containsKey(task.severity)) {
        taskSeverityCount.put(task.severity, taskSeverityCount.get(task.severity) + 1L);
      } else {
        taskSeverityCount.put(task.severity, 1L);
      }

      taskObject.addProperty(JsonKeys.ID, task.id);
      taskObject.addProperty(JsonKeys.USERNAME, task.username);
      taskObject.addProperty(JsonKeys.START_TIME, task.startTime);
      taskObject.addProperty(JsonKeys.FINISH_TIME, task.finishTime);
      taskObject.addProperty(JsonKeys.RUNTIME, task.finishTime - task.startTime);
      taskObject.addProperty(JsonKeys.WAITTIME, task.totalDelay);
      taskObject.addProperty(JsonKeys.RESOURCE_USED, task.resourceUsed);
      taskObject.addProperty(JsonKeys.RESOURCE_WASTED, task.resourceWasted);
      taskObject.addProperty(JsonKeys.SEVERITY, task.severity.getText());
      taskObject.addProperty(JsonKeys.QUEUE, task.queueName);
      taskObject.add(JsonKeys.HEURISTICS_SUMMARY, heuristicsArray);
      taskSummaryArray.add(taskObject);

      jobResourceUsed += task.resourceUsed;
      jobResourceWasted += task.resourceWasted;

      if (jobSeverity.getValue() < task.severity.getValue()) {
        jobSeverity = task.severity;
      }
      if (jobStartTime > task.startTime) {
        jobStartTime = task.startTime;
      }

      if (jobEndTime < task.finishTime) {
        jobEndTime = task.finishTime;
      }
    }

    JsonArray taskSeverity = new JsonArray();
    List<Severity> keys = getSortedSeverityKeys(taskSeverityCount.keySet());
    for (Severity key : keys) {
      JsonObject severityObject = new JsonObject();
      severityObject.addProperty(JsonKeys.SEVERITY, key.getText());
      severityObject.addProperty(JsonKeys.COUNT, taskSeverityCount.get(key));
      taskSeverity.add(severityObject);
    }

    jobRuntime = Utils.getTotalRuntime(results);
    jobDelay = Utils.getTotalWaittime(results);
    JsonObject data = new JsonObject();
    data.addProperty(JsonKeys.ID, jobDefID);
    data.addProperty(JsonKeys.USERNAME, username);
    data.addProperty(JsonKeys.JOB_NAME, jobname);
    data.addProperty(JsonKeys.JOB_TYPE, jobtype);
    data.addProperty(JsonKeys.START_TIME, jobStartTime);
    data.addProperty(JsonKeys.FINISH_TIME, jobEndTime);
    data.addProperty(JsonKeys.RUNTIME, jobRuntime);
    data.addProperty(JsonKeys.WAITTIME, jobDelay);
    data.addProperty(JsonKeys.RESOURCE_USED, jobResourceUsed);
    data.addProperty(JsonKeys.RESOURCE_WASTED, jobResourceWasted);
    data.addProperty(JsonKeys.SEVERITY, jobSeverity.getText());
    data.addProperty(JsonKeys.JOB_EXEC_ID, jobExecutionId);
    data.addProperty(JsonKeys.JOB_DEF_ID, jobDefinitionId);
    data.addProperty(JsonKeys.FLOW_EXEC_ID, flowExecutionId);
    data.addProperty(JsonKeys.FLOW_DEF_ID, flowDefinitionId);
    data.addProperty(JsonKeys.QUEUE, queueName);
    data.addProperty(JsonKeys.SCHEDULER, scheduler);
    data.add(JsonKeys.TASKS_SUMMARIES, taskSummaryArray);
    data.add(JsonKeys.TASKS_SEVERITY, taskSeverity);

    JsonObject parent = new JsonObject();
    parent.add(JsonKeys.JOBS, data);
    return ok(new Gson().toJson(parent));
  }
@param jobId
@return
<pre>
*{
 "jobs": {
   "id": "jobid",
   "username": "username",
   "jobname": "jobname",
   "jobtype": "Pig",
   "starttime": 1471910835628,
   "finishtime": 1471911099238,
   "runtime": 263610,
   "waittime": 46234,
   "resourceused": 101382144,
   "resourcewasted": 15993417,
   "severity": "Moderate",
   "jobexecid": "jobexecid",
   "jobdefid": "jobdefid",
   "flowexecid": "flowexecid",
   "flowdefid": "flowdefid",
   "taskssummaries": [
     {
       "id": "application_id",
       "username": "username",
       "starttime": 1471910835628,
       "finishtime": 1471911099238,
       "runtime": 263610,
       "waittime": 46234,
       "resourceused": 101382144,
       "resourcewasted": 15993417,
       "severity": "Moderate",
       "heuristicsummary": [
         {
           "name": "Mapper Data Skew",
           "severity": "None"
         },
         {
           "name": "Mapper GC",
           "severity": "None"
         },
         {
           "name": "Mapper Time",
           "severity": "Moderate"
         },
         {
           "name": "Mapper Speed",
           "severity": "None"
         },
         {
           "name": "Mapper Spill",
           "severity": "None"
         },
         {
           "name": "Mapper Memory",
           "severity": "None"
         },
         {
           "name": "Reducer Data Skew",
           "severity": "None"
         },
         {
           "name": "Reducer GC",
           "severity": "None"
         },
         {
           "name": "Reducer Time",
           "severity": "None"
         },
         {
           "name": "Reducer Memory",
           "severity": "None"
         },
         {
           "name": "Shuffle & Sort",
           "severity": "Low"
         }
       ]
     }
   ],
   "tasksseverity": [
     {
       "severity": "Moderate",
       "count": 1
     }
   ]
 }
}

</pre>
app/controllers/api/v1/Web.java