Merge branch 'DAO'
authorSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Mon, 20 Jan 2014 15:24:16 +0000 (15:24 +0000)
committerSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Mon, 20 Jan 2014 15:24:16 +0000 (15:24 +0000)
Conflicts:
conf/Proteocache.properties

.settings/org.eclipse.jdt.core.prefs
conf/Proteocache.properties
server/compbio/controllers/DailyStatisticsController.java
server/compbio/controllers/DatabaseController.java
webapp/view/query/JobLog.jsp
webapp/view/query/RemoveJobs.jsp
webapp/view/reports/RemoveDBrecords.jsp [deleted file]
webapp/view/reports/RemoveJobs.jsp [new file with mode: 0644]

index ef1da3f..02430f4 100644 (file)
@@ -1,14 +1,14 @@
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
index b5f588f..6ce13ed 100644 (file)
@@ -1,8 +1,9 @@
 #################################################################################
 # Cassandra host or IP
 # test server is 10.0.115.190
-cassandra.host=localhost
+#cassandra.host=localhost
 #cassandra.host=gjb-www-1.cluster.lifesci.dundee.ac.uk
+cassandra.host=c6100-1.cluster.lifesci.dundee.ac.uk
 
 cassandra.newtables.update=false
 cassandra.version.update=false
index 9cdf874..322f74e 100644 (file)
@@ -28,11 +28,13 @@ import compbio.cassandra.readers.DailyStatisticsReader;
 public class DailyStatisticsController extends BasicController {
 
        /**
-        * form a query page for daily job statistics. The servlet should be
-        * available for users and admins only. By defaults the report time range is
-        * from the earliest day with jobs to today ("Query for all dates" is
-        * ticked). If the user removes the tick the time range is from today - 3
-        * days to today. Currently, the input model is empty.
+        * form a query page for daily job statistics.
+        * 
+        * The servlet should be available for users and admins only. By defaults
+        * the report time range is from the earliest day with jobs to current date
+        * ("Query for all dates" is ticked). If the user removes the tick the time
+        * range is from today - 3 days to today. Currently, the input model is
+        * empty.
         * 
         * @param model
         *            MVC model
index 609ee09..e720a2c 100644 (file)
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import compbio.cassandra.CassandraRemover;
+import compbio.cassandra.DateFormatter;
 
 /**
  * @author Alexander Sherstnev
@@ -41,39 +42,44 @@ public class DatabaseController extends BasicController {
                return "support/Denied";
        }
 
-       @RequestMapping(value = "/database/remove/goreal", method = RequestMethod.GET)
-       public String findIPwithCounter(@RequestParam("byId") String flagId, @RequestParam("id") String jobId,
-                       @RequestParam("byDate") String flagDate, @RequestParam("date1") String date1, @RequestParam("date2") String date2,
-                       @RequestParam("byIp") String flagIp, @RequestParam("ip") String ip, @RequestParam("bySequence") String flagSeq,
-                       @RequestParam("seq") String seq, Map<String, Object> model) {
+       @RequestMapping(value = "/database/remove/go", method = RequestMethod.GET)
+       public String findIPwithCounter(@RequestParam("byId") String byId, @RequestParam("id") String jobid,
+                       @RequestParam("byDate") String byDate, @RequestParam("date1") String date1, @RequestParam("date2") String date2,
+                       @RequestParam("byIp") String byIp, @RequestParam("ip") String ip, @RequestParam("bySequence") String bySequence,
+                       @RequestParam("seq") String sequence, Map<String, Object> model) {
                model.put("username", getPrincipalName());
+
+               model.put("byDate", byDate);
+               model.put("date1", date1);
+               model.put("date2", date2);
+
+               model.put("byId", byId);
+               model.put("id", jobid);
+
+               model.put("byIp", byIp);
+               model.put("ip", ip);
+
+               model.put("bySequence", bySequence);
+               model.put("seq", sequence);
+
                CassandraRemover cr = new CassandraRemover();
-               int numberRemover = 0;
-               if (flagId != null)
-                       numberRemover = cr.RemoveJobById(jobId);
-               if (flagDate != null)
-                       numberRemover = cr.RemoveJobByDate(date1, date2);
-               if (flagIp != null)
-                       numberRemover = cr.RemoveJobByIp(ip);
-               if (flagSeq != null)
-                       numberRemover = cr.RemoveJobBySequence(seq);
-               model.put("result", numberRemover);
-               return "reports/RemoveDBrecords";
-       }
+               int njobs = 0;
+               if (byId.equals("on,off"))
+                       njobs = cr.RemoveJobById(jobid);
+               if (byDate.equals("on,off")) {
+                       long longDate1 = DateFormatter.DateParsing(date1, formaterYYMMDD) / 1000;
+                       long longDate2 = DateFormatter.DateParsing(date2, formaterYYMMDD) / 1000;
+                       int timerange = (int)(longDate2 - longDate1) /24 / 3600 + 1;
+                       model.put("ndays", timerange);
+                       njobs = cr.RemoveJobByDate(date1, date2);
+               }
+               if (byIp.equals("on,off"))
+                       njobs = cr.RemoveJobByIp(ip);
+               if (bySequence.equals("on,off"))
+                       njobs = cr.RemoveJobBySequence(sequence);
+               model.put("njobs", njobs);
 
-       @RequestMapping(value = "/database/remove/go", method = RequestMethod.GET)
-       public String findIPwithCounter(@RequestParam("id") String jobId, @RequestParam("date1") String date1,
-                       @RequestParam("date2") String date2, @RequestParam("ip") String ip, @RequestParam("seq") String seq, Map<String, Object> model) {
-               model.put("username", getPrincipalName());
-               /*
-                * CassandraRemover cr = new CassandraRemover(); int numberRemover = 0;
-                * if (flagId != null) numberRemover = cr.RemoveJobById(jobId); if
-                * (flagDate != null) numberRemover = cr.RemoveJobByDate(date1, date2);
-                * if (flagIp != null) numberRemover = cr.RemoveJobByIp(ip); if (flagSeq
-                * != null) numberRemover = cr.RemoveJobBySequence(seq);
-                * model.put("result", numberRemover); return "reportRemoveData";
-                */
-               return "support/Blocked";
+               return "reports/RemoveJobs";
        }
 
 }
index 2afcf3f..9310f25 100644 (file)
@@ -18,9 +18,9 @@
                </div>
                <div class="panel-body">
                        <form method="get" action="${query}">
-                       <p><input type="text" name="IdJob" value="${value}"></p>
-                       <input type="submit" name="Search" value="Search"/>
-               </form>
+                               <p><input type="text" name="IdJob" value="${value}"></p>
+                               <input type="submit" name="Search" value="Search"/>
+                       </form>
                </div>
        </div>
 
index cf3459f..d5c138f 100644 (file)
@@ -22,6 +22,7 @@
                                <p>
                                        <input type="checkbox" name="byId" onclick="show(this, 'id');" /> Job with the job Id
                                        <div id='id' style="visibility:hidden;">Job Id: <input type="text" name="id" value="${samplejobid}" /></div>
+                                       <input type="hidden" name="byId" value="off" />
                                </p>
 
                                <!-- remove jobs executed on the dates: -->
                                        <div id='date' style="visibility:hidden;">
                                        From <input type="text" name="date1" value = "${date1}" style=" width : 145px;" />
                                        to <input type="text" name="date2" value = "${date2}" /></div>
+                                       <input type="hidden" name="byDate" value="off" />
                                </p>
 
                                <!-- remove jobs executed from particular IP: -->
                                <p>
                                        <input type="checkbox" name="byIp" onclick="show(this, 'ip');" /> Jobs executed from the IP
                                        <div id='ip' style="visibility:hidden;">IP: <input type="text" name="ip" value = '${sampleip}'/></div>
+                                       <input type="hidden" name="byIp" value="off" />
                                </p>
                                
                                <!-- remove jobs with a particular protein subsiquence: -->
                                <p>
                                        <input type="checkbox" name="bySequence"  onclick="show(this, 'seq');"> Jobs with the protein subsequence
                                        <div id='seq' style="visibility:hidden;"> Sequence: <input type="text" name="seq" value = "${sampleseq}"/></div>
+                                       <input type="hidden" name="bySequence" value="off" />
                                </p>
                                
                                <p><input type="submit" name="Delete" value="Delete"/></p>
diff --git a/webapp/view/reports/RemoveDBrecords.jsp b/webapp/view/reports/RemoveDBrecords.jsp
deleted file mode 100644 (file)
index 67e120d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>Jobs have been removed from ProteoCache</title>
-</head>
-<body>
-<h1>ProteoCache removed : ${result} jobs</h1>
-</body>
-</html>
\ No newline at end of file
diff --git a/webapp/view/reports/RemoveJobs.jsp b/webapp/view/reports/RemoveJobs.jsp
new file mode 100644 (file)
index 0000000..b1d62fa
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+
+<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
+
+<html>
+<jsp:include page="../fragments/header.jsp" />
+<body>
+       <div class="container">
+               <jsp:include page="../fragments/mainmenu.jsp" />
+               <spring:url value="/sequence/sequence/results" var="sequence_query" />
+               <spring:url value="/admin/ip/results" var="ip_query" />
+
+               <div class="panel panel-default">
+               <div class="panel-heading">
+                       <p style="font-weight:bold;">Information for removed jobs</p>
+               </div>
+               <div class="panel-body">
+                       <!-- <div class="grid-wrapper-div">-->
+                       <c:if test="${byDate != 'off'}">
+                               <p>${njobs} jobs have been removed for time period: <c:out value="${date1}" /> to <c:out value="${date2}"/> (${ndays} days)</p>
+                       </c:if>
+                       <c:if test="${byId != 'off'}">
+                               <p>Job ${id} has been removed.</p>
+                       </c:if>
+                       <c:if test="${byIp != 'off'}">
+                               <p>Jobs launched from ${ip} have been removed. ${njobs} jobs have been removed.</p>
+                       </c:if>
+                       <c:if test="${bySequence != 'off'}">
+                               <p>Jobs launched with sequence ${seq} have been removed. ${njobs} jobs have been removed.</p>
+                       </c:if>
+                       <!-- </div>-->
+               </div>
+               </div>
+
+               <jsp:include page="../fragments/footer.jsp" />
+       </div>
+</body>
+</html>
\ No newline at end of file