1 package compbio.cassandra.readers;
3 import java.util.HashMap;
7 import com.datastax.driver.core.ResultSet;
8 import com.datastax.driver.core.Row;
10 import compbio.beans.UserBean;
12 public class IpReader extends CassandraReader {
23 * @return UserBean to the controller IPDataController
25 public UserBean readIp(String ip) {
26 ResultSet results = CassandraQuery("SELECT JobID, Protein, FinalStatus, DataBegin FROM ProteinLog WHERE ip = '" + ip + "';");
27 if (results.isExhausted())
29 List<Row> rows = results.all();
30 Map<String, String[]> res = new HashMap<String, String[]>();
32 if (r.getString("FinalStatus").equals("OK")) {
33 String date = r.getString("DataBegin");
34 res.put(r.getString("JobID"), new String[] { date.substring(0, date.indexOf(":")), r.getString("Protein") });
37 UserBean query = new UserBean(ip);
38 query.setMainInfo(res);