From: Sasha Sherstnev Date: Fri, 6 Dec 2013 18:20:26 +0000 (+0000) Subject: Rename and merge controllers X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=67ee99b3cfa17f03dbe839f5ab3ec215541330d8;p=proteocache.git Rename and merge controllers --- diff --git a/server/compbio/controllers/HelpController.java b/server/compbio/controllers/DocumentationController.java similarity index 93% rename from server/compbio/controllers/HelpController.java rename to server/compbio/controllers/DocumentationController.java index 96ae042..9e7de42 100644 --- a/server/compbio/controllers/HelpController.java +++ b/server/compbio/controllers/DocumentationController.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 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(); } diff --git a/server/compbio/controllers/IPDataController.java b/server/compbio/controllers/IPDataController.java index 690c57e..a7cd7f0 100644 --- a/server/compbio/controllers/IPDataController.java +++ b/server/compbio/controllers/IPDataController.java @@ -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 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 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"; diff --git a/server/compbio/controllers/JobExecutionTimeController.java b/server/compbio/controllers/JobController.java similarity index 65% rename from server/compbio/controllers/JobExecutionTimeController.java rename to server/compbio/controllers/JobController.java index 71843a9..6bfe4ee 100644 --- a/server/compbio/controllers/JobExecutionTimeController.java +++ b/server/compbio/controllers/JobController.java @@ -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 model, Principal principal) { + public String initFormExecTime(Map 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 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 model, Principal principal) { + public String findExecTimeData(@RequestParam("date1") String date1, @RequestParam("date2") String date2, + @RequestParam(value = "option", required = false) String option, Map 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 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 index 28d6961..0000000 --- a/server/compbio/controllers/JobLogController.java +++ /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 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 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/SequenceController.java b/server/compbio/controllers/SequenceController.java index ee71258..6440d74 100644 --- a/server/compbio/controllers/SequenceController.java +++ b/server/compbio/controllers/SequenceController.java @@ -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 model, Principal principal) { + public String findSequence(@RequestParam("sequence") String sequence, @RequestParam("protein") String flag, Map model, + Principal principal) { model.put("username", principal.getName()); final long startTime = System.currentTimeMillis(); diff --git a/server/compbio/controllers/UserController.java b/server/compbio/controllers/UserController.java index 94be377..513f5bb 100644 --- a/server/compbio/controllers/UserController.java +++ b/server/compbio/controllers/UserController.java @@ -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); } }