package compbio.controllers;
-import java.security.Principal;
+import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import compbio.statistic.CassandraRequester;
import compbio.cassandra.DataBase;
+import compbio.engine.archive.ArchivedJob;
/**
* @author Alexander Sherstnev
* @author Natasha Sherstneva
+ * @version 1.0 Dec 2013
*/
@Controller
public class JobController extends BasicController {
+ /**
+ * form a query page for job execution time statistics. The servlet should be
+ * available for users and admins only. By defaults the report time range is
+ * from the earliest day with jobs to today ("Query for all dates" is
+ * ticked). If the user removes the tick the time range is from today - 3
+ * days to today. Currently, the input model is empty.
+ *
+ * @param model
+ * MVC model
+ * @return link to the JSP query page
+ */
@RequestMapping(value = "/stat/exectime/query", method = RequestMethod.GET)
public String initFormExecTime(Map<String, Object> model) {
model.put("username", getPrincipalName());
return "query/JobTimeExecution";
}
+ /**
+ * form a query page for a job. The servlet should no be visible to users at all.
+ *
+ * @param model
+ * MVC model
+ * @return link to the JSP query page
+ */
@RequestMapping(value = "/job/query", method = RequestMethod.GET)
public String initFindForm(Map<String, Object> model) {
model.put("username", getPrincipalName());
final long endTime = System.currentTimeMillis();
model.put("timeExecution", (endTime - startTime));
model.put("IdJob", jobid);
+
+ ArchivedJob aj = new ArchivedJob(jobid);
+ try {
+ model.put("jobarchive", aj.prepareJobArchiveToWeb());
+ } catch (IOException e) {
+ //TODO. what should we do if job is not available???
+ }
return "reportJobLog";
}
-
+
/*
* convert ???
*/
String dateString = datformat.format(new Date(indate));
return dateString;
}
-
+
}