Rename and merge controllers
authorSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Fri, 6 Dec 2013 18:20:26 +0000 (18:20 +0000)
committerSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Fri, 6 Dec 2013 18:20:26 +0000 (18:20 +0000)
server/compbio/controllers/DocumentationController.java [moved from server/compbio/controllers/HelpController.java with 93% similarity]
server/compbio/controllers/IPDataController.java
server/compbio/controllers/JobController.java [moved from server/compbio/controllers/JobExecutionTimeController.java with 65% similarity]
server/compbio/controllers/JobLogController.java [deleted file]
server/compbio/controllers/SequenceController.java
server/compbio/controllers/UserController.java

@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
  * @author Natasha Sherstneva
  */
 @Controller
-public class HelpController {
+public class DocumentationController {
 
        @RequestMapping(value = "/help/overview", method = RequestMethod.GET)
        public String formOverviewPage(Map<String, Object> model, Principal principal) {
@@ -39,8 +39,8 @@ public class HelpController {
                model.put("username", getPrincipleName(principal));
                return "support/Notimplemented";
        }
-       
-       private String getPrincipleName (Principal principal) {
+
+       private String getPrincipleName(Principal principal) {
                if (null != principal.getName()) {
                        return principal.getName();
                }
index 690c57e..a7cd7f0 100644 (file)
@@ -33,7 +33,7 @@ public class IPDataController {
                model.put("value", "127.0.0.1");
                return "queryIP";
        }
-       
+
        @RequestMapping(value = "/admin/ip/counts/results", method = RequestMethod.GET)
        public String findIPwithCounter(@RequestParam("JobCounter") String counter, Map<String, Object> model, Principal principal) {
                model.put("username", principal.getName());
@@ -42,7 +42,7 @@ public class IPDataController {
                        model.put("value", counter);
                        return "queryIPStatistics";
                }
-       
+
                int realcounter;
                try {
                        realcounter = Integer.parseInt(counter.trim());
@@ -61,12 +61,12 @@ public class IPDataController {
                final long startTime = System.currentTimeMillis();
                CassandraRequester cr = new CassandraRequester();
                List<TotalByCounterBean> r = cr.readIpByCounter(realcounter);
-               model.put("results", r);
+               model.put("results", r);
                model.put("njobs", 0);
                if (null != r) {
                        model.put("njobs", r.size());
                }
-               final long endTime = System.currentTimeMillis();
+               final long endTime = System.currentTimeMillis();
                model.put("timeExecution", (endTime - startTime));
                model.put("counter", realcounter);
                return "reportIPstatistics";
@@ -78,12 +78,12 @@ public class IPDataController {
                final long startTime = System.currentTimeMillis();
                CassandraRequester cr = new CassandraRequester();
                UserBean r = cr.readIp(ip);
-               model.put("results", r);
+               model.put("results", r);
                model.put("njobs", 0);
                if (null != r) {
                        model.put("njobs", r.getMainInfo().size());
                }
-               final long endTime = System.currentTimeMillis();
+               final long endTime = System.currentTimeMillis();
                model.put("timeExecution", (endTime - startTime));
                model.put("ip", ip);
                return "reportIP";
@@ -10,7 +10,6 @@ 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.cassandra.DataBase;
 import compbio.statistic.StatisticsProt;
@@ -20,10 +19,10 @@ import compbio.statistic.StatisticsProt;
  * @author Natasha Sherstneva
  */
 @Controller
-public class JobExecutionTimeController {
+public class JobController {
 
        @RequestMapping(value = "/stat/exectime/query", method = RequestMethod.GET)
-       public String initFindForm(Map<String, Object> model, Principal principal) {
+       public String initFormExecTime(Map<String, Object> model, Principal principal) {
                model.put("username", principal.getName());
                Calendar cal = Calendar.getInstance();
                String date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DATE);
@@ -35,9 +34,16 @@ public class JobExecutionTimeController {
                return "queryTimeExecution";
        }
 
+       @RequestMapping(value = "/job/query", method = RequestMethod.GET)
+       public String initFindForm(Map<String, Object> model, Principal principal) {
+               model.put("username", principal.getName());
+               model.put("value", "jp_NzBOJKo");
+               return "queryJobLog";
+       }
+
        @RequestMapping(value = "/stat/exectime/results", method = RequestMethod.GET)
-       public String findSequence(@RequestParam("date1") String date1, @RequestParam("date2") String date2,
-                       @RequestParam(value="option", required=false) String option, Map<String, Object> model, Principal principal) {
+       public String findExecTimeData(@RequestParam("date1") String date1, @RequestParam("date2") String date2,
+                       @RequestParam(value = "option", required = false) String option, Map<String, Object> model, Principal principal) {
                model.put("username", principal.getName());
                final long startTime = System.currentTimeMillis();
 
@@ -57,4 +63,17 @@ public class JobExecutionTimeController {
                model.put("timeExecution", (endTime - startTime));
                return "/reportTimeExecution";
        }
+
+       @RequestMapping(value = "/job/results", method = RequestMethod.GET)
+       public String findJob(@RequestParam("IdJob") String jobid, Map<String, Object> model, Principal principal) {
+               model.put("username", principal.getName());
+               final long startTime = System.currentTimeMillis();
+               CassandraRequester cr = new CassandraRequester();
+               model.put("result", cr.readJobLog(jobid));
+               final long endTime = System.currentTimeMillis();
+               model.put("timeExecution", (endTime - startTime));
+               model.put("IdJob", jobid);
+               return "reportJobLog";
+       }
+       
 }
diff --git a/server/compbio/controllers/JobLogController.java b/server/compbio/controllers/JobLogController.java
deleted file mode 100644 (file)
index 28d6961..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package compbio.controllers;
-
-import java.security.Principal;
-import java.util.Map;
-
-import org.springframework.stereotype.Controller;
-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;
-
-/**
- * @author Alexander Sherstnev
- * @author Natasha Sherstneva
- */
-@Controller
-public class JobLogController {
-
-       @RequestMapping(value = "/job/query", method = RequestMethod.GET)
-       public String initFindForm(Map<String, Object> model, Principal principal) {
-               model.put("username", principal.getName());
-               model.put("value", "jp_NzBOJKo");
-               return "queryJobLog";
-       }
-
-       @RequestMapping(value = "/job/results", method = RequestMethod.GET)
-       public String findJob(@RequestParam("IdJob") String jobid, Map<String, Object> model, Principal principal) {
-               model.put("username", principal.getName());
-               final long startTime = System.currentTimeMillis();
-               CassandraRequester cr = new CassandraRequester();
-               model.put("result", cr.readJobLog(jobid));
-               final long endTime = System.currentTimeMillis();
-               model.put("timeExecution", (endTime - startTime));
-               model.put("IdJob", jobid);
-               return "reportJobLog";
-       }
-}
index ee71258..6440d74 100644 (file)
@@ -48,7 +48,8 @@ public class SequenceController {
        }
 
        @RequestMapping(value = "sequence/results", method = RequestMethod.GET)
-       public String findSequence(@RequestParam("sequence") String sequence, @RequestParam("protein") String flag, Map<String, Object> model, Principal principal) {
+       public String findSequence(@RequestParam("sequence") String sequence, @RequestParam("protein") String flag, Map<String, Object> model,
+                       Principal principal) {
                model.put("username", principal.getName());
                final long startTime = System.currentTimeMillis();
 
index 94be377..513f5bb 100644 (file)
@@ -24,8 +24,8 @@ import compbio.cassandra.CassandraUserManager;
 @Controller
 public class UserController {
 
-       //@Inject
-       //JavaMailSender mailSender;
+       // @Inject
+       // JavaMailSender mailSender;
        private final Pattern EMAIL = Pattern.compile("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}");
 
        @RequestMapping(value = "/register/query", method = RequestMethod.GET)
@@ -72,7 +72,7 @@ public class UserController {
                }
 
                user.setRegistrationDate(new Date());
-               UserManager cm = new CassandraUserManager(); 
+               UserManager cm = new CassandraUserManager();
                try {
                        cm.addUser(user);
                } catch (DataIntegrityViolationException e) {
@@ -84,8 +84,8 @@ public class UserController {
                        subscribeToList(user.getEmail());
                }
                /*
-               Account.autoLogin(user, request, authenticationManager);
-               */
+                * Account.autoLogin(user, request, authenticationManager);
+                */
                return "redirect:/index";
        }
 
@@ -95,9 +95,9 @@ public class UserController {
                if (bindingResult.hasErrors()) {
                        return "Register";
                }
-               
+
                user.setRegistrationDate(new Date());
-               UserManager cm = new CassandraUserManager(); 
+               UserManager cm = new CassandraUserManager();
                try {
                        cm.addUser(user);
                } catch (DataIntegrityViolationException e) {
@@ -117,7 +117,7 @@ public class UserController {
                message.setTo("proteocache-discuss-subscribe@compbio.dundee.ac.uk");
                message.setSubject("ProteoCache mailing list subscription");
                message.setText("testing " + email);
-               //mailSender.send(message);
+               // mailSender.send(message);
        }
 
 }