A new MVC model paramter for "no jobs found"
authorSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Wed, 29 Jan 2014 08:02:28 +0000 (08:02 +0000)
committerSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Wed, 29 Jan 2014 08:02:28 +0000 (08:02 +0000)
server/compbio/controllers/JobController.java

index 314631b..0a00d9b 100644 (file)
@@ -17,6 +17,7 @@ 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;
@@ -210,7 +211,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 +229,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);