Merge branch 'DAO' of https://source.jalview.org/git/proteocache into DAO
[proteocache.git] / server / compbio / controllers / JobController.java
index 0dd39f8..f05234e 100644 (file)
@@ -14,9 +14,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
-import compbio.statistic.CassandraRequester;
 import compbio.beans.DateBean;
 import compbio.beans.ExecutionTimeBean;
+import compbio.beans.JobBean;
 import compbio.beans.TotalExecutionTime;
 import compbio.cassandra.DateFormatter;
 import compbio.cassandra.readers.CassandraReader;
@@ -73,7 +73,7 @@ public class JobController extends BasicController {
        @RequestMapping(value = "/job/query", method = RequestMethod.GET)
        public String initFindForm(Map<String, Object> model) {
                model.put("username", getPrincipalName());
-               CassandraRequester cr = new CassandraRequester();
+               CassandraReader cr = new CassandraReader();
                model.put("value", cr.getExample("jobid"));
                return "query/JobLog";
        }
@@ -99,8 +99,8 @@ public class JobController extends BasicController {
                Calendar loccal = Calendar.getInstance();
                ExecutionTimeReader reader = new ExecutionTimeReader();
                if (alldates.equals("AllDates,off")) {
-                       date1 = theEaerlistDate;
-                       date2 = theCurrentDate;
+                       date1 = getEarliestDate();
+                       date2 = getCurrentDate();
                }
 
                // dates in string format
@@ -109,7 +109,7 @@ public class JobController extends BasicController {
                // dates in long format
                long longDate1 = DateFormatter.DateParsing(date1, formaterYYMMDD);
                long longDate2 = DateFormatter.DateParsing(date2, formaterYYMMDD);
-               String error = DateChecking(trimmeddate1, trimmeddate2, longDate1, longDate2);
+               String error = checkDates(trimmeddate1, trimmeddate2, longDate1, longDate2);
                if (error != null) {
                        model.put("error", error);
                        model.put("date1", date1);
@@ -210,7 +210,12 @@ public class JobController extends BasicController {
                model.put("username", getPrincipalName());
                final long startTime = System.currentTimeMillis();
                JobReader reader = new JobReader();
-               model.put("result", reader.readJobLog(jobid));
+               JobBean job = reader.readJobLog(jobid);
+               if (null == job) {
+                       model.put("jobnotfound", "yes");
+               } else {
+                       model.put("result", job);
+               }
                final long endTime = System.currentTimeMillis();
                model.put("timeExecution", (endTime - startTime));
                model.put("IdJob", jobid);
@@ -223,6 +228,7 @@ public class JobController extends BasicController {
                        log.error("JobController.prepareJobArchiveToWeb: IO exception with job archive file");
                        log.error(e.getLocalizedMessage(), e.getCause());
                }
+
                // add a direct link to the job
                String remotelink = "http://www.compbio.dundee.ac.uk/www-jpred/results/" + jobid + "/" + jobid + ".results.html";
                URL remotelinkurl = new URL(remotelink);