Merge branch 'DAO' of https://source.jalview.org/git/proteocache into DAO
authorNatasha Sherstneva <n.shertneva@gmail.com>
Mon, 20 Jan 2014 11:01:33 +0000 (11:01 +0000)
committerNatasha Sherstneva <n.shertneva@gmail.com>
Mon, 20 Jan 2014 11:01:33 +0000 (11:01 +0000)
server/compbio/controllers/JobController.java
server/compbio/controllers/SequenceController.java
webapp/view/reports/Job.jsp

index 264a5d1..9987bd5 100644 (file)
@@ -1,6 +1,8 @@
 package compbio.controllers;
 
 import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
@@ -121,9 +123,10 @@ public class JobController extends BasicController {
         * @param model
         *            MVC model
         * @return link to the JSP query page
+        * @throws IOException
         */
        @RequestMapping(value = "/job/results", method = RequestMethod.GET)
-       public String findJob(@RequestParam("IdJob") String jobid, Map<String, Object> model) {
+       public String findJob(@RequestParam("IdJob") String jobid, Map<String, Object> model) throws IOException {
                model.put("username", getPrincipalName());
                final long startTime = System.currentTimeMillis();
                JobReader reader = new JobReader();
@@ -139,6 +142,13 @@ 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);
+               HttpURLConnection httpConnection_remotelinkurl = (HttpURLConnection) remotelinkurl.openConnection();
+               if (199 < httpConnection_remotelinkurl.getResponseCode() && httpConnection_remotelinkurl.getResponseCode() < 300) {
+                       model.put("jobremotelink", remotelink);
+               }
                return "reports/Job";
        }
 
index 6db97ef..9e92273 100644 (file)
@@ -109,16 +109,16 @@ public class SequenceController extends BasicController {
                                else
                                        model.put("njobs", result.size());
                                csvline = "\'Job\',\'Annotation\',\'Sequence\'%0A";
-                       }
-                       // form CSV file string
-                       for (ProteinBean entry : result) {
-                               List<String> jobs = entry.getJobid();
-                               String protein = entry.getSequence();
-                               LinkedHashMap<String, String> predictions = entry.getPredictions();
-                               for (String job : jobs) {
-                                       csvline += "\'" + job + "\',\'Sequence\',\'" + protein + "\',\'%0A";
-                                       for (Map.Entry<String, String> pr : predictions.entrySet()) {
-                                               csvline += "\'\',\'" + pr.getKey() + "\',\'" + pr.getValue() + "\'%0A";
+                               // form CSV file string
+                               for (ProteinBean entry : result) {
+                                       List<String> jobs = entry.getJobid();
+                                       String protein = entry.getSequence();
+                                       LinkedHashMap<String, String> predictions = entry.getPredictions();
+                                       for (String job : jobs) {
+                                               csvline += "\'" + job + "\',\'Sequence\',\'" + protein + "\',\'%0A";
+                                               for (Map.Entry<String, String> pr : predictions.entrySet()) {
+                                                       csvline += "\'\',\'" + pr.getKey() + "\',\'" + pr.getValue() + "\'%0A";
+                                               }
                                        }
                                }
                        }
index db8f352..dd0b1dd 100644 (file)
@@ -30,6 +30,9 @@
                                <spring:url value="../${jobarchive}" var="jobarchivefile" />
                                <p>Job archive: <a title="Click to get the file" href="${jobarchivefile}">download</a></p>
                        </c:if>
+                       <c:if test='${jobremotelink != null}'>
+                               <p>Original job link: <a title="Click to go to original job" href="${jobremotelink}">view</a></p>
+                       </c:if>
                        <div class="grid-wrapper-div">
                        <table class="table table-striped table-hover table-bordered">
                        <tbody>