Merge branch 'servlets'
[proteocache.git] / datadb / compbio / cassandra / CassandraReader.java
index e75f148..9ac0a3b 100644 (file)
@@ -98,7 +98,7 @@ public class CassandraReader {
        /*
         * getting whole protein sequence from the db ProteinRow
         */
-       public List<AnnotatedProteinSequenceBean> ReadWholeSequence(String queryProtein) {
+       public List<ProteinBean> ReadWholeSequence(String queryProtein) {
                final long startTime = System.currentTimeMillis();
                String com = "SELECT JobID, Predictions FROM ProteinRow WHERE Protein = '" + queryProtein + "';";
                System.out.println("Command: " + com);
@@ -107,16 +107,19 @@ public class CassandraReader {
                        return null;
                final long queryTime = System.currentTimeMillis();
                List<Row> rows = results.all();
+               System.out.println("first size : " + rows.size());
                System.out.println("Query time is " + (queryTime - startTime) + " msec");
                System.out.println(" rows analysed,  " + rows.size());
-               List<AnnotatedProteinSequenceBean> res = new ArrayList<AnnotatedProteinSequenceBean>();
+               List<ProteinBean> res = new ArrayList<ProteinBean>();
+               ProteinBean structure = new ProteinBean(queryProtein, rows.get(0).getMap(
+                               "Predictions", String.class, String.class));
+               System.out.println("second size : " + rows.size());
                int c = 0;
                for (Row r : rows) {
-                       AnnotatedProteinSequenceBean structure = new AnnotatedProteinSequenceBean(queryProtein, r.getString("JobID"), r.getMap(
-                                       "Predictions", String.class, String.class));
-                       res.add(structure);
+                       structure.setJobid(r.getString("JobID"));                       
                        ++c;
                }
+               res.add(structure);
                final long endTime = System.currentTimeMillis();
                System.out.println(c + " rows analysed, execution time is " + (endTime - startTime) + " msec");
                return res;
@@ -156,7 +159,7 @@ public class CassandraReader {
        /*
         * getting part of protein sequence from the db ProteinRow
         */
-       public List<AnnotatedProteinSequenceBean> ReadPartOfSequence(String queryProtein) {
+       public List<ProteinBean> ReadPartOfSequence(String queryProtein) {
                final long startTime = System.currentTimeMillis();
                String com = "SELECT * FROM ProteinRow;";
                System.out.println("Command: " + com);
@@ -167,13 +170,13 @@ public class CassandraReader {
                List<Row> rows = results.all();
                System.out.println("Query time is " + (queryTime - startTime) + " msec");
                System.out.println(" rows analysed,  " + rows.size());
-               List<AnnotatedProteinSequenceBean> res = new ArrayList<AnnotatedProteinSequenceBean>();
+               List<ProteinBean> res = new ArrayList<ProteinBean>();
                int c = 0;
                for (Row r : rows) {
                        String prot = r.getString("Protein");
                        if (prot.matches("(.*)" + queryProtein + "(.*)")) {
-                               AnnotatedProteinSequenceBean structure = new AnnotatedProteinSequenceBean(prot, r.getString("JobID"), r.getMap("Predictions",
-                                               String.class, String.class));
+                               ProteinBean structure = new ProteinBean(prot,  r.getMap("Predictions", String.class, String.class));
+                               structure.setJobid(r.getString("JobID"));
                                res.add(structure);
                                ++c;
                        }