- String csvline = "";
- if (0 < res.size()) {
- csvline = "\'Date\',\'Total\',\'0-30 sec\',\'30-60 sec\',\'1-2 min\',\'2-10 min\',\'more 10 min\'%0A";
- for (DataBase entry : res) {
- List<Integer> counts = entry.getTimeRez();
- int total = 0;
- for (int i = 0; i < counts.size(); ++i) {
- total += counts.get(i);
- }
- csvline += "\'" + entry.getDate() + "\',\'" + total;
- for (int i = 0; i < counts.size(); ++i) {
- csvline += "\',\'" + counts.get(i);
- }
- csvline += "\'%0A";
+ Map<String, TotalExecutionTime> results = res.getDateTotal();
+ StringBuilder csvline = new StringBuilder("");
+ if (0 < res.getDateTotal().size()) {
+ csvline.append("\'Date\',\'Total\',\'0-30 sec\',\'30-60 sec\',\'1-2 min\',\'2-10 min\',\'more 10 min\'%0A");
+ for (Map.Entry<String, TotalExecutionTime> entry : results.entrySet()) {
+ csvline.append("\'" + entry.getKey() + "\',\'" + entry.getValue().getTotal() + "\',\'" + entry.getValue().getTotal0_30s()
+ + "\',\'" + entry.getValue().getTotal30_60s() + "\',\'" + entry.getValue().getTotal1_2m() + "\',\'"
+ + entry.getValue().getTotal2_10m() + "\',\'" + entry.getValue().getTotal10m() + "\'%0A");
+ }
+ }
+ model.put("csvfile", csvline.toString());
+ model.put("ndays", res.getDateTotal().size() - 1);
+ final long endTime = System.currentTimeMillis();
+ model.put("timeExecution", (endTime - startTime));
+ return "/reports/TimeExecution";
+ }
+
+ /**
+ * form a report page for job statistics for one day only.
+ *
+ * @param model
+ * MVC model object
+ * @param date
+ * date for the report
+ * @param status
+ *
+ * @return link to the report JSP page
+ */
+ @RequestMapping(value = "/stat/jobsoneday/executionTime", method = RequestMethod.GET)
+ public String findJobsInOneDay(@RequestParam("date") String date, @RequestParam("interval") String interval, Map<String, Object> model)
+ throws ParseException {
+ model.put("username", getPrincipalName());
+ final long startTime = System.currentTimeMillis();
+
+ String realdate;
+ long thetime = 0;
+ try {
+ thetime = formaterYYMMDD.parse(date).getTime();
+ if (thetime < 0) {
+ realdate = date;
+ } else {
+ realdate = formaterDDMMYY.format(new Date(thetime));