public static Result restJobSummariesForUser(String username) {

    JsonArray jobSummaryArray = new JsonArray();

    List<AppResult> results = null;
    if (username == null || username.isEmpty()) {
      results = getSchedulerApplications(MAX_APPLICATIONS_IN_WORKFLOW);
    } else {
      results = getSchedulerApplications(username, MAX_APPLICATIONS_IN_WORKFLOW);
    }

    Map<IdUrlPair, List<AppResult>> jobExecIdToJobsMap = ControllerUtil
        .limitHistoryResults(ControllerUtil.groupJobs(results, ControllerUtil.GroupBy.JOB_EXECUTION_ID), results.size(),
            MAX_JOB_LIMIT);

    for (IdUrlPair jobDefPair : jobExecIdToJobsMap.keySet()) {
      long totalJobMemoryUsed = 0L;
      long totalJobMemoryWasted = 0L;
      long totalJobDelay = 0L;
      long totalJobRuntime = 0L;
      long jobStartTime = Long.MAX_VALUE;
      long jobEndTime = 0;
      Severity jobSeverity = Severity.NONE;
      String jobType = null;
      String jobId = jobDefPair.getId();
      String jobName = "";
      String user = null;
      String queueName = "";
      String scheduler = "";
      String jobDefId = "";
      String jobExecId = "";

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

      for (AppResult application : jobExecIdToJobsMap.get(jobDefPair)) {

        totalJobMemoryUsed += application.resourceUsed;
        totalJobMemoryWasted += application.resourceWasted;

        jobType = application.jobType;
        jobName = application.jobName;
        jobDefId = application.jobDefId;
        jobExecId = application.jobExecId;

        queueName = application.queueName;
        scheduler = application.scheduler;

        if (application.startTime < jobStartTime) {
          jobStartTime = application.startTime;
        }

        if (application.finishTime > jobEndTime) {
          jobEndTime = application.finishTime;
        }

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

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

        user = application.username;
      }

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

      totalJobDelay = Utils.getTotalWaittime(jobExecIdToJobsMap.get(jobDefPair));
      totalJobRuntime = Utils.getTotalRuntime(jobExecIdToJobsMap.get(jobDefPair));

      JsonObject jobObject = new JsonObject();
      jobObject.addProperty(JsonKeys.ID, jobId);
      jobObject.addProperty(JsonKeys.JOB_NAME, jobName);
      jobObject.addProperty(JsonKeys.JOB_TYPE, jobType);
      jobObject.addProperty(JsonKeys.USERNAME, user);
      jobObject.addProperty(JsonKeys.START_TIME, jobStartTime);
      jobObject.addProperty(JsonKeys.FINISH_TIME, jobEndTime);
      jobObject.addProperty(JsonKeys.RUNTIME, totalJobRuntime);
      jobObject.addProperty(JsonKeys.WAITTIME, totalJobDelay);
      jobObject.addProperty(JsonKeys.RESOURCE_USED, totalJobMemoryUsed);
      jobObject.addProperty(JsonKeys.RESOURCE_WASTED, totalJobMemoryWasted);
      jobObject.addProperty(JsonKeys.QUEUE, queueName);
      jobObject.addProperty(JsonKeys.SCHEDULER, scheduler);
      jobObject.addProperty(JsonKeys.SEVERITY, jobSeverity.getText());
      jobObject.addProperty(JsonKeys.JOB_DEF_ID, jobDefId);
      jobObject.addProperty(JsonKeys.JOB_EXEC_ID, jobExecId);

      jobObject.add(JsonKeys.TASKS_SEVERITY, applicationSeverity);

      jobSummaryArray.add(jobObject);
    }

    JsonArray sortedJobSummaryArray = getSortedJsonArrayByFinishTime(jobSummaryArray);

    JsonObject parent = new JsonObject();
    parent.add(JsonKeys.JOB_SUMMARIES, sortedJobSummaryArray);
    return ok(new Gson().toJson(parent));
  }
This method returns the json object for job-summaries for the given user
@param username The given username for which job-summaries json object should be returned
@return The job-summaries json object for the given username
response object:
<pre>
{
 "job-summaries": [
 {
   "id": "job-exec-id",
     "jobname": "jobname",
     "jobtype": "Pig",
     "username": "username",
     "starttime": 1471910835628,
     "finishtime": 1471911099238,
     "runtime": 263610,
     "waittime": 46234,
     "resourceused": 101382144,
     "resourcewasted": 15993417,
     "severity": "Moderate",
     "scheduler": "azkaban",
     "tasksseverity": [
   {
     "severity": "Moderate",
       "count": 1
   }
   ]
 }
 ]
}
</pre>
app/controllers/api/v1/Web.java