import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import compbio.cassandra.DataBase;
-
+import compbio.cassandra.ProteinBean;
+import compbio.cassandra.TotalByCounterBean;
import compbio.statistic.CassandraRequester;
/**
if (0 < trimmedsequence.length()) {
CassandraRequester cr = new CassandraRequester();
- List<DataBase> r = cr.readProteins(trimmedsequence, flag);
+ List<ProteinBean> r = cr.readProteins(trimmedsequence, flag);
model.put("results", r);
if (null != r) {
- System.out.println("result size = " + r.size());
- model.put("njobs", r.size());
+ if (flag.equals("whole"))
+ model.put("njobs",r.get(0).getJobid().size());
+ else
+ model.put("njobs", r.size());
}
}
final long endTime = System.currentTimeMillis();
}
@RequestMapping(value = "/sequence/querycounter", method = RequestMethod.GET)
- public String countSequences(@RequestParam("counterJob") int counter, Map<String, Object> model) {
+ public String countSequences(@RequestParam("counterJob") String counter, Map<String, Object> model) {
final long startTime = System.currentTimeMillis();
- if (counter < 1) {
+ if (counter.equals("")) {
+ model.put("error", "The value must not be empty");
+ model.put("value", counter);
+ return "queryIPStatistics";
+ }
+
+ int realcounter;
+ try {
+ realcounter = Integer.parseInt(counter.trim());
+ } catch (NumberFormatException e) {
+ model.put("error", "The value must be an integer number");
+ model.put("value", counter);
+ return "queryIPStatistics";
+ }
+
+ if (realcounter < 1) {
model.put("error", "The value must be greater than 0");
model.put("value", counter);
- return "queryProteinSequenceCounter";
+ return "queryIPStatistics";
}
CassandraRequester cr = new CassandraRequester();
- List<DataBase> r = cr.readProteinByCounter(counter);
+ List<TotalByCounterBean> r = cr.readProteinByCounter(realcounter);
model.put("results", r);
model.put("njobs", 0);
if (null != r) {
}
final long endTime = System.currentTimeMillis();
model.put("timeExecution", (endTime - startTime));
- model.put("counter", counter);
+ model.put("counter", realcounter);
return "reportProteinSequencesCounter";
}