From: Natasha Sherstneva Date: Tue, 3 Dec 2013 17:45:52 +0000 (+0000) Subject: create DateBean, UserBean, TotalBean X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=574c70838a48dd41cfadda11a493b04f02de5604;p=proteocache.git create DateBean, UserBean, TotalBean --- diff --git a/datadb/compbio/cassandra/CassandraReader.java b/datadb/compbio/cassandra/CassandraReader.java index 9ac0a3b..69f7c08 100644 --- a/datadb/compbio/cassandra/CassandraReader.java +++ b/datadb/compbio/cassandra/CassandraReader.java @@ -53,7 +53,7 @@ public class CassandraReader { /* * getting data from the db */ - public List> ReadProteinData(long day) { + public DateBean ReadProteinData(long day, String date) { final long startTime = System.currentTimeMillis(); String com = "SELECT JobID, Protein FROM ProteinData WHERE jobtime = " + day + ";"; System.out.println("Command: " + com); @@ -63,11 +63,10 @@ public class CassandraReader { final long queryTime = System.currentTimeMillis(); List rows = results.all(); System.out.println("Query time is " + (queryTime - startTime) + " msec"); - List> res = new ArrayList>(); + DateBean res = new DateBean(date); int c = 0; for (Row r : rows) { - Pair pair = new Pair(r.getString("JobID"), r.getString("Protein")); - res.add(pair); + res.setJobidAndSeq(r.getString("JobID"), r.getString("Protein")); ++c; } final long endTime = System.currentTimeMillis(); @@ -77,17 +76,13 @@ public class CassandraReader { /* * getting data from the db JobDateInfo */ - public List ReadDateTable(long queryDate) { + public Total ReadDateTable(long queryDate) { ResultSet results = session.execute("SELECT * FROM JobDateInfo WHERE jobday = " + queryDate + ";"); if (results.isExhausted()) return null; Row therow = results.one(); - List res = new ArrayList(); - res.add(therow.getLong("Total")); - res.add(therow.getLong("TotalOK")); - res.add(therow.getLong("TotalStopped")); - res.add(therow.getLong("TotalError")); - res.add(therow.getLong("TotalTimeOut")); + Total res = new Total(therow.getLong("Total"), therow.getLong("TotalOK"), therow.getLong("TotalStopped"), + therow.getLong("TotalError"), therow.getLong("TotalTimeOut")); if (!results.isExhausted()) { Date date = new Date (queryDate); log.warn("CassandraReader.ReadDateTable: date row for " + date.toString () + " ("+ queryDate + ") duplicated "); @@ -129,25 +124,23 @@ public class CassandraReader { /* * getting jobs by ip */ - public List> ReadIpWithJobs(String ip) { + public Map ReadIpWithJobs(String ip) { final long startTime = System.currentTimeMillis(); - String com = "SELECT JobID, Protein, FinalStatus FROM ProteinLog WHERE ip = '" + ip + "';"; + String com = "SELECT JobID, Protein, FinalStatus, DataBegin FROM ProteinLog WHERE ip = '" + ip + "';"; System.out.println("Command: " + com); ResultSet results = session.execute(com); if (results.isExhausted()) return null; final long queryTime = System.currentTimeMillis(); List rows = results.all(); - List> res = new ArrayList>(); + Map res = new HashMap(); System.out.println("Query time is " + (queryTime - startTime) + " msec"); System.out.println(" rows analysed, " + rows.size()); int c = 0; for (Row r : rows) { if (r.getString("FinalStatus").equals("OK")) { - Pair pair = new Pair(r.getString("JobID"), r.getString("Protein")); - System.out.println(pair.getElement0()); - System.out.println(pair.getElement1()); - res.add(pair); + String date = r.getString("DataBegin"); + res.put(r.getString("JobID"), new String[] {date.substring(0, date.indexOf(":")), r.getString("Protein")}); ++c; } } @@ -232,12 +225,12 @@ public class CassandraReader { Map res = new HashMap(); int c = 0; for (Row r : rows) { - String protein = r.getString("ip"); + String ip = r.getString("ip"); String id = r.getString("JobID"); - if (res.containsKey(protein)) - res.put(protein, res.get(protein) + 1); + if (res.containsKey(ip)) + res.put(ip, res.get(ip) + 1); else - res.put(protein, 1); + res.put(ip, 1); } final long endTime = System.currentTimeMillis(); System.out.println(c + " rows analysed, execution time is " + (endTime - startTime) + " msec"); @@ -247,7 +240,7 @@ public class CassandraReader { /* * getting log info for jobid */ - public StructureJobLog ReadJobLog(String jobid) { + public JobBean ReadJobLog(String jobid) { final long startTime = System.currentTimeMillis(); String com = "SELECT * FROM ProteinLog WHERE JobID = '" + jobid + "';"; System.out.println("Command: " + com); @@ -262,7 +255,7 @@ public class CassandraReader { if (results1.isExhausted()) return null; Row row1 = results1.one(); - StructureJobLog res = new StructureJobLog(row.getString("Protein"), row.getString("JobID"), row.getString("DataBegin"), + JobBean res = new JobBean(row.getString("Protein"), row.getString("JobID"), row.getString("DataBegin"), row.getString("DataEnd"), row.getString("ip"), row1.getMap("Predictions", String.class, String.class)); System.out.println("Query time is " + (queryTime - startTime) + " msec"); final long endTime = System.currentTimeMillis(); diff --git a/datadb/compbio/cassandra/DataBase.java b/datadb/compbio/cassandra/DataBase.java index ab21e43..57063ec 100644 --- a/datadb/compbio/cassandra/DataBase.java +++ b/datadb/compbio/cassandra/DataBase.java @@ -19,7 +19,7 @@ public class DataBase { private String jpred; private List timeRez; private List timeTotalExec; - private StructureJobLog logInfo; + private JobBean logInfo; private ProteinBean predictions; public DataBase() { @@ -144,11 +144,11 @@ public class DataBase { return timeTotalExec; } - public void setLogInfo(StructureJobLog logInfo){ + public void setLogInfo(JobBean logInfo){ this.logInfo = logInfo; } - public StructureJobLog getLogInfo() { + public JobBean getLogInfo() { return logInfo; } diff --git a/datadb/compbio/cassandra/DateBean.java b/datadb/compbio/cassandra/DateBean.java new file mode 100644 index 0000000..6f4b06a --- /dev/null +++ b/datadb/compbio/cassandra/DateBean.java @@ -0,0 +1,38 @@ +package compbio.cassandra; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +public class DateBean { + private String date; + private Map jobidAndSeq; // Map for jobid and sequence + + public DateBean() { + this.jobidAndSeq = new HashMap(); + } + + public DateBean(String date) { + this.date = date; + this.jobidAndSeq = new HashMap(); + } + + public void setJobidAndSeq(String jobid, String seq) { + if (jobidAndSeq == null) + jobidAndSeq = new HashMap(); + jobidAndSeq.put(jobid, seq); + } + + + public Map getJobidAndSeq() { + return jobidAndSeq; + } + + public void setDate(String date) { + this.date = date; + } + + public String setDate() { + return date; + } +} diff --git a/datadb/compbio/cassandra/StructureJobLog.java b/datadb/compbio/cassandra/JobBean.java similarity index 51% rename from datadb/compbio/cassandra/StructureJobLog.java rename to datadb/compbio/cassandra/JobBean.java index b2d0400..0bfeb2c 100644 --- a/datadb/compbio/cassandra/StructureJobLog.java +++ b/datadb/compbio/cassandra/JobBean.java @@ -1,24 +1,33 @@ package compbio.cassandra; +import java.util.LinkedHashMap; import java.util.Map; -public class StructureJobLog { +public class JobBean implements PredictionIndex { private String jobid; private String dateStart; private String dateEnd; private String sequence; private String ip; - private Map prediction; + private LinkedHashMap predictions; - public StructureJobLog (String seq, String id, String dateStart, String dateEnd, String ip, Map pred) { + public JobBean (String seq, String id, String dateStart, String dateEnd, String ip, Map pred) { this.sequence = seq; this.jobid = id; this.dateStart = dateStart; this.dateEnd = dateEnd; this.ip = ip; - this.prediction = pred; + this.predictions = new LinkedHashMap(); + setPredictions(pred); } + public void setPredictions(Map pred) { + if (predictions == null) + predictions = new LinkedHashMap(); + for (String index : predIndex) { + this.predictions.put(index, pred.get(index)); + } + } public String getSequence () { return sequence; } @@ -40,6 +49,6 @@ public class StructureJobLog { } public Map getPrediction () { - return prediction; + return predictions; } } diff --git a/datadb/compbio/cassandra/ProteinBean.java b/datadb/compbio/cassandra/ProteinBean.java index d2b7cb7..80f111b 100644 --- a/datadb/compbio/cassandra/ProteinBean.java +++ b/datadb/compbio/cassandra/ProteinBean.java @@ -20,6 +20,8 @@ public class ProteinBean implements PredictionIndex{ } public void setPredictions(Map pred) { + if (predictions == null) + predictions = new LinkedHashMap(); for (String index : predIndex) { this.predictions.put(index, pred.get(index)); } diff --git a/datadb/compbio/cassandra/Total.java b/datadb/compbio/cassandra/Total.java new file mode 100644 index 0000000..75cef1f --- /dev/null +++ b/datadb/compbio/cassandra/Total.java @@ -0,0 +1,59 @@ +package compbio.cassandra; + +public class Total { + private long total; // total number of jobs + private long totalOK; // number of jobs with execution status OK + private long totalStopped; // number of jobs with execution status STOPPED + private long totalError; // number of jobs with execution status Jpred ERROR + private long totalTimeOut; // number of jobs with execution status TIMEOUT + + public Total() {} + + public Total(long total, long totalOK, long totalStopped, long totalError, long totalTimeOut) { + this.total = total; + this.totalOK = totalOK; + this.totalStopped = totalStopped; + this.totalError = totalError; + this.totalTimeOut = totalTimeOut; + } + + public void setTotal(long tot) { + this.total = tot; + } + + public long getTotal() { + return total; + } + + public void setTotalOK(long tot) { + this.totalOK = tot; + } + + public long getTotalOK() { + return totalOK; + } + + public void setTotalStopped(long tot) { + this.totalStopped = tot; + } + + public long getTotalStopped() { + return totalStopped; + } + + public void setTotalError(long tot) { + this.totalError = tot; + } + + public long getTotalError() { + return totalError; + } + + public void setTotalTimeOut(long tot) { + this.totalTimeOut = tot; + } + + public long getTotalTimeOut() { + return totalTimeOut; + } +} diff --git a/datadb/compbio/cassandra/TotalByCounterBean.java b/datadb/compbio/cassandra/TotalByCounterBean.java new file mode 100644 index 0000000..5c8f329 --- /dev/null +++ b/datadb/compbio/cassandra/TotalByCounterBean.java @@ -0,0 +1,22 @@ +package compbio.cassandra; + +public class TotalByCounterBean { + private int totaljobs; // total jobs for current condition + private String name; // name for counter condition (ip or sequence) + + public void setTotaljobs(int tot) { + this.totaljobs = tot; + } + + public int getTotaljobs() { + return totaljobs; + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } +} diff --git a/datadb/compbio/cassandra/TotalJobsStatisticBean.java b/datadb/compbio/cassandra/TotalJobsStatisticBean.java new file mode 100644 index 0000000..1df13fd --- /dev/null +++ b/datadb/compbio/cassandra/TotalJobsStatisticBean.java @@ -0,0 +1,33 @@ +package compbio.cassandra; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class TotalJobsStatisticBean extends Total { + private Map dateTotal; + private Total wholeTotal; + + public TotalJobsStatisticBean() { + super(); + this.dateTotal = new LinkedHashMap(); + } + + public void setDateTotal(String dat, Total tot) { + if (this.dateTotal == null) + dateTotal = new LinkedHashMap(); + dateTotal.put(dat, tot); + } + + public Map getDateTotal() { + return dateTotal; + } + + public void setWholeTotal(Total tot) { + this.wholeTotal = tot; + } + + public Total getWholeTotal() { + return wholeTotal; + } +} diff --git a/datadb/compbio/cassandra/UserBean.java b/datadb/compbio/cassandra/UserBean.java new file mode 100644 index 0000000..39cfd21 --- /dev/null +++ b/datadb/compbio/cassandra/UserBean.java @@ -0,0 +1,38 @@ +package compbio.cassandra; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class UserBean { + private String ip; + private Map mainInfo; // store jobid, date start and sequence + + public UserBean(String ip) { + this.ip = ip; + mainInfo = new HashMap(); + } + + public String getIp() { + return ip; + } + + public void setMainInfo(String jobid, String date, String sequence) { + if (mainInfo == null) + mainInfo = new HashMap(); + mainInfo.put(jobid, new String[] {date, sequence}); + } + + public void setMainInfo( Map info) { + if (mainInfo == null) + mainInfo = new HashMap(); + mainInfo = info; + } + + public Map getMainInfo() { + return mainInfo; + } + +} diff --git a/server/compbio/controllers/DailyStatisticsController.java b/server/compbio/controllers/DailyStatisticsController.java index edfe876..b735107 100644 --- a/server/compbio/controllers/DailyStatisticsController.java +++ b/server/compbio/controllers/DailyStatisticsController.java @@ -12,8 +12,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; - import compbio.cassandra.DataBase; +import compbio.cassandra.DateBean; +import compbio.cassandra.TotalJobsStatisticBean; import compbio.statistic.CassandraRequester; import compbio.statistic.StatisticsProt; @@ -50,7 +51,7 @@ public class DailyStatisticsController { } model.put("date1", date1); model.put("date2", date2); - List res = cr.countJobs(date1, date2); + TotalJobsStatisticBean res = cr.countJobs(date1, date2); model.put("result", res); final long endTime = System.currentTimeMillis(); model.put("timeExecution", (endTime - startTime)); @@ -78,9 +79,10 @@ public class DailyStatisticsController { CassandraRequester cr = new CassandraRequester(); // IMPORTANT: input should be suppied in the format: DD/MM/YYYY - List r = cr.readJobByDay(realdate); + DateBean r = cr.readJobByDay(realdate); model.put("results", r); - model.put("njobs", r.size()); + if (r != null) + model.put("njobs", r.getJobidAndSeq().size()); model.put("date", realdate); final long endTime = System.currentTimeMillis(); model.put("timeExecution", (endTime - startTime)); diff --git a/server/compbio/controllers/IPDataController.java b/server/compbio/controllers/IPDataController.java index 7a7e298..424a742 100644 --- a/server/compbio/controllers/IPDataController.java +++ b/server/compbio/controllers/IPDataController.java @@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import compbio.cassandra.DataBase; +import compbio.cassandra.TotalByCounterBean; +import compbio.cassandra.UserBean; import compbio.statistic.CassandraRequester; /** @@ -56,7 +58,7 @@ public class IPDataController { final long startTime = System.currentTimeMillis(); CassandraRequester cr = new CassandraRequester(); - List r = cr.readIpByCounter(realcounter); + List r = cr.readIpByCounter(realcounter); model.put("results", r); model.put("njobs", 0); if (null != r) { @@ -72,11 +74,11 @@ public class IPDataController { public String findIP(@RequestParam("ip") String ip, Map model) { final long startTime = System.currentTimeMillis(); CassandraRequester cr = new CassandraRequester(); - List r = cr.readIp(ip); + UserBean r = cr.readIp(ip); model.put("results", r); model.put("njobs", 0); if (null != r) { - model.put("njobs", r.size()); + model.put("njobs", r.getMainInfo().size()); } final long endTime = System.currentTimeMillis(); model.put("timeExecution", (endTime - startTime)); diff --git a/server/compbio/controllers/SequenceController.java b/server/compbio/controllers/SequenceController.java index 2986312..2008a06 100644 --- a/server/compbio/controllers/SequenceController.java +++ b/server/compbio/controllers/SequenceController.java @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam; import compbio.cassandra.ProteinBean; import compbio.cassandra.DataBase; +import compbio.cassandra.TotalByCounterBean; import compbio.statistic.CassandraRequester; /** @@ -82,7 +83,7 @@ public class SequenceController { } CassandraRequester cr = new CassandraRequester(); - List r = cr.readProteinByCounter(realcounter); + List r = cr.readProteinByCounter(realcounter); model.put("results", r); model.put("njobs", 0); if (null != r) { diff --git a/server/compbio/listeners/ServletIp.java b/server/compbio/listeners/ServletIp.java index 9fb5383..e229176 100644 --- a/server/compbio/listeners/ServletIp.java +++ b/server/compbio/listeners/ServletIp.java @@ -25,8 +25,8 @@ public class ServletIp extends HttpServlet { final long startTime = System.currentTimeMillis(); String ip = request.getParameter("ip"); CassandraRequester cr = new CassandraRequester(); - List r = cr.readIp(ip); - request.setAttribute("results", r); + // List r = cr.readIp(ip); + // request.setAttribute("results", r); final long endTime = System.currentTimeMillis(); request.setAttribute("timeExecution", (endTime - startTime)); request.setAttribute("ip", ip); diff --git a/server/compbio/listeners/ServletJobsByDate.java b/server/compbio/listeners/ServletJobsByDate.java index 39fdf16..8ae389f 100644 --- a/server/compbio/listeners/ServletJobsByDate.java +++ b/server/compbio/listeners/ServletJobsByDate.java @@ -35,8 +35,8 @@ public class ServletJobsByDate extends HttpServlet { } request.setAttribute("data1", date1); request.setAttribute("data2", date2); - List res = cr.countJobs(date1, date2); - request.setAttribute("result", res); +// List res = cr.countJobs(date1, date2); +// request.setAttribute("result", res); final long endTime = System.currentTimeMillis(); request.setAttribute("timeExecution", (endTime - startTime)); // System.out.println ("QueryServlet.doGet: total number of dates = " + res.size()); diff --git a/server/compbio/listeners/ServletJobsByIp.java b/server/compbio/listeners/ServletJobsByIp.java index f8d92b9..bff4a5c 100644 --- a/server/compbio/listeners/ServletJobsByIp.java +++ b/server/compbio/listeners/ServletJobsByIp.java @@ -26,8 +26,8 @@ public class ServletJobsByIp extends HttpServlet { final long startTime = System.currentTimeMillis(); int counter = Integer.parseInt(request.getParameter("counterIp")); CassandraRequester cr = new CassandraRequester(); - List r = cr.readIpByCounter(counter); - request.setAttribute("results", r); + // List r = cr.readIpByCounter(counter); +// request.setAttribute("results", r); final long endTime = System.currentTimeMillis(); request.setAttribute("timeExecution", (endTime - startTime)); request.setAttribute("counter", counter); diff --git a/server/compbio/listeners/ServletSequenceProtein.java b/server/compbio/listeners/ServletSequenceProtein.java index 5515566..6d1316d 100644 --- a/server/compbio/listeners/ServletSequenceProtein.java +++ b/server/compbio/listeners/ServletSequenceProtein.java @@ -33,8 +33,8 @@ public class ServletSequenceProtein extends HttpServlet { int counter = Integer.parseInt(request.getParameter("counterJob")); CassandraRequester cr = new CassandraRequester(); if (search.equals("Search counter")) { - List r = cr.readProteinByCounter(counter); - request.setAttribute("results", r); + // List r = cr.readProteinByCounter(counter); +// request.setAttribute("results", r); // System.out.println ("Search counter: " + r.size() + " proteins found"); } else { // List r = cr.readProteins(prot, flag); diff --git a/server/compbio/statistic/CassandraRequester.java b/server/compbio/statistic/CassandraRequester.java index d82543a..c150d9d 100755 --- a/server/compbio/statistic/CassandraRequester.java +++ b/server/compbio/statistic/CassandraRequester.java @@ -9,12 +9,17 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import compbio.cassandra.DateBean; import compbio.cassandra.ProteinBean; import compbio.cassandra.CassandraNativeConnector; import compbio.cassandra.CassandraReader; import compbio.cassandra.DataBase; import compbio.cassandra.Pair; -import compbio.cassandra.StructureJobLog; +import compbio.cassandra.JobBean; +import compbio.cassandra.Total; +import compbio.cassandra.TotalByCounterBean; +import compbio.cassandra.TotalJobsStatisticBean; +import compbio.cassandra.UserBean; public class CassandraRequester { private CassandraReader db = new CassandraReader(); @@ -115,7 +120,7 @@ public class CassandraRequester { /* * query: total number of jobs for the period from date1 till date2 */ - public List countJobs(String date1, String date2) { + public TotalJobsStatisticBean countJobs(String date1, String date2) { if (null == date1) { date1 = "1970/1/1"; } @@ -140,30 +145,27 @@ public class CassandraRequester { start.setTime(new Date(dateStart)); Calendar end = Calendar.getInstance(); end.setTime(new Date(dateEnd)); - query = new ArrayList(); + TotalJobsStatisticBean query = new TotalJobsStatisticBean(); + Total wholeTotal = new Total(0,0,0,0,0); for (Date date = start.getTime(); !start.after(end); start.add(Calendar.DATE, 1), date = start.getTime()) { - List res = db.ReadDateTable(date.getTime()); + Total res = db.ReadDateTable(date.getTime()); if (res == null) continue; - DataBase bean = new DataBase(); - bean.setTotal((int)(long)res.get(0)); - bean.setTotalOK((int)(long)res.get(1)); - bean.setTotalStopped((int)(long)res.get(2)); - bean.setTotalError((int)(long)res.get(3)); - bean.setTotalTimeOut((int)(long)res.get(4)); - bean.setDate(DateFormat(date.getTime())); - query.add(bean); + query.setDateTotal(DateFormat(date.getTime()), res); + wholeTotal.setTotal(res.getTotal() + wholeTotal.getTotal()); + wholeTotal.setTotalOK(res.getTotalOK() + wholeTotal.getTotalOK()); + wholeTotal.setTotalStopped(res.getTotalStopped() + wholeTotal.getTotalStopped()); + wholeTotal.setTotalError(res.getTotalError() + wholeTotal.getTotalError()); + wholeTotal.setTotalTimeOut(res.getTotalTimeOut() + wholeTotal.getTotalTimeOut()); } + query.setWholeTotal(wholeTotal); return query; } /* * query: jobs and sequence at date */ - public List readJobByDay (String date) { - if (null == date) { - return null; - } + public DateBean readJobByDay (String date) { if (!isThisDateValid(date, formatDDMMYY)) { System.out.println("CassandraRequester.readJobByDay: Wrong date format for " + date); return null; @@ -172,24 +174,13 @@ public class CassandraRequester { long day = DateParsing(date, formatDDMMYY); if (day < earlestDate || day > currentDate) return null; - List> res = db.ReadProteinData(day); - if (res == null) - return null; - query = new ArrayList(); - for (Pair entry : res) { - DataBase bean = new DataBase(); - bean.setDate(date); - bean.setId(entry.getElement0()); - bean.setProt(entry.getElement1()); - query.add(bean); - } - return query; + return db.ReadProteinData(day, date); } /* * query: protein sequence - * */ + **/ public List readProteins(String protIn, String flag) { List result; if (flag.equals("whole")) @@ -211,14 +202,16 @@ public class CassandraRequester { /* * query protein sequences with number of jobs */ - public List readProteinByCounter(int minimalcounter) { - query = new ArrayList(); + public List readProteinByCounter(int minimalcounter) { + List query = new ArrayList(); Map map = db.ReadProteinSequenceByCounter(); + if (map == null) + return null; for (Map.Entry entry : map.entrySet()) { - if (entry.getValue() > minimalcounter && entry.getKey().length() > 0) { - DataBase bean = new DataBase(); - bean.setTotalId(entry.getValue()); - bean.setProt(entry.getKey()); + if (entry.getValue() > minimalcounter) { + TotalByCounterBean bean = new TotalByCounterBean(); + bean.setTotaljobs(entry.getValue()); + bean.setName(entry.getKey()); query.add(bean); } } @@ -228,8 +221,8 @@ public class CassandraRequester { /* * query ip with number of jobs */ - public List readIpByCounter(Integer minimalcounter) { - query = new ArrayList(); + public List readIpByCounter(Integer minimalcounter) { + List query = new ArrayList(); Map map = db.ReadIpByCounter(); if (minimalcounter == null) minimalcounter = 0; @@ -237,9 +230,9 @@ public class CassandraRequester { return null; for (Map.Entry entry : map.entrySet()) { if (entry.getValue() > minimalcounter) { - DataBase bean = new DataBase(); - bean.setTotalId(entry.getValue()); - bean.setIp(entry.getKey()); + TotalByCounterBean bean = new TotalByCounterBean(); + bean.setTotaljobs(entry.getValue()); + bean.setName(entry.getKey()); query.add(bean); } } @@ -248,35 +241,24 @@ public class CassandraRequester { /* * query jobs log info */ - public DataBase readJobLog(String jobid) { + public JobBean readJobLog(String jobid) { if (jobid == null) return null; - StructureJobLog res = db.ReadJobLog(jobid); - if (res == null) - return null; - DataBase query = new DataBase(); - query.setLogInfo(res); - return query; + return db.ReadJobLog(jobid); } /* * query jobs by ipStructureJobLog */ - public List readIp(String ip) { + public UserBean readIp(String ip) { if (ip == null) return null; - List> res = db.ReadIpWithJobs(ip); + Map res = db.ReadIpWithJobs(ip); if (res == null) return null; - query = new ArrayList(); - for (Pair entry : res) { - DataBase bean = new DataBase(); - bean.setIp(ip); - bean.setId(entry.getElement0()); - bean.setProt(entry.getElement1()); - query.add(bean); - } + UserBean query = new UserBean(ip); + query.setMainInfo(res); return query; } diff --git a/webapp/view/reportIP.jsp b/webapp/view/reportIP.jsp index e224de5..dce9db8 100644 --- a/webapp/view/reportIP.jsp +++ b/webapp/view/reportIP.jsp @@ -34,20 +34,25 @@ - + - ${res.id} - - ${res.date} - - - - Alignment job - - - ${res.prot} - - + ${res.key} + + + + ${info} + + + + + Alignment job + + + ${info} + + + + diff --git a/webapp/view/reportIPstatistics.jsp b/webapp/view/reportIPstatistics.jsp index dec24be..8c9a153 100644 --- a/webapp/view/reportIPstatistics.jsp +++ b/webapp/view/reportIPstatistics.jsp @@ -36,8 +36,8 @@ - ${res.totalId} - ${res.ip} + ${res.totaljobs} + ${res.name} diff --git a/webapp/view/reportJobLog.jsp b/webapp/view/reportJobLog.jsp index b886aa9..91b7b8f 100644 --- a/webapp/view/reportJobLog.jsp +++ b/webapp/view/reportJobLog.jsp @@ -19,19 +19,19 @@

Information for the job ${IdJob}

-

Start timestamp : ${result.logInfo.dateStart}

-

End timestamp : ${result.logInfo.dateEnd}

-

IP: ${result.logInfo.ip}

+

Start timestamp : ${result.dateStart}

+

End timestamp : ${result.dateEnd}

+

IP: ${result.ip}

- +
Sequence - ${result.logInfo.sequence} + ${result.sequence}
${pred.key} No jobs for this period

- - - - - - - - - - - - - - - - -
@@ -75,20 +58,22 @@ - - - - - + + + + + + - + - - - - - - + + + + + + + diff --git a/webapp/view/reportJobStatisticsOneDay.jsp b/webapp/view/reportJobStatisticsOneDay.jsp index 719ace8..1194596 100644 --- a/webapp/view/reportJobStatisticsOneDay.jsp +++ b/webapp/view/reportJobStatisticsOneDay.jsp @@ -40,15 +40,15 @@ - + - + - + - + diff --git a/webapp/view/reportProteinSequencesCounter.jsp b/webapp/view/reportProteinSequencesCounter.jsp index 4f38666..7944451 100644 --- a/webapp/view/reportProteinSequencesCounter.jsp +++ b/webapp/view/reportProteinSequencesCounter.jsp @@ -39,9 +39,9 @@ - +
Total:${sum}${sumOK}${sumStopped}${sumError}${sumTimeOut}${total.total}${total.totalOK}${total.totalStopped}${total.totalError}${total.totalTimeOut}
${res.date}${res.total}${res.totalOK}${res.totalStopped}${res.totalError}${res.totalTimeOut}${res.key}${value.total}${value.totalOK}${value.totalStopped}${value.totalError}${value.totalTimeOut}
${res.id}${res.key} Job with alignment ${res.prot}${res.value}
${res.totalId}${res.totaljobs} - ${res.prot} + ${res.name}