+ if (finalstatus.equals("OK")) {
+ String com2 = "INSERT INTO ProteinData " + "(jobtime, JobID, ExecTime, Protein)" + " VALUES (" + job.getStartingDate()
+ + ",'" + id + "'," + job.getExecutionTime() + ",'" + protein + "');";
+ if (null == execute(com2)) {
+ System.out.println("CassandraWriter.FormQueryTables: couldn't insert into ProteinData");
+ // return 0;
+ }
+
+ String allpredictions = "";
+ List<FastaSequence> pr = job.getPredictions();
+ for (FastaSequence pred : pr) {
+ String predictionname = pred.getId();
+ String prediction = pred.getSequence().replaceAll("\n", "");
+ allpredictions += "'" + predictionname + "':'" + prediction + "',";
+ }
+ String final_prediction = "";
+ if (!allpredictions.equals("")) {
+ final_prediction = allpredictions.substring(0, allpredictions.length() - 1);
+ }
+
+ ResultSet results2 = execute("SELECT * FROM ProteinRow WHERE JobID = '" + job.getJobID() + "';");
+ if (null != results2 && results2.isExhausted()) {
+ String com3 = "INSERT INTO ProteinRow (Protein, JobID, Predictions) VALUES ('" + protein + "','" + id + "',{"
+ + final_prediction + "});";
+ if (null == execute(com3)) {
+ System.out.println("CassandraWriter.FormQueryTables: couldn't insert into ProteinRow");
+ return 0;
+ }
+ }
+ } else {
+ String com5 = "INSERT INTO FailLog (jobtime, JobID, ExecTime, ip, FinalStatus) VALUES (" + job.getStartingDate() + ",'"
+ + id + "'," + job.getExecutionTime() + ",'" + job.getIP() + "', '" + finalstatus + "');";
+ if (null == execute(com5)) {
+ System.out.println("CassandraWriter.FormQueryTables: couldn't insert into FailLog");
+ return 0;
+ }