Apply formatting
[proteocache.git] / datadb / compbio / cassandra / CassandraRemover.java
index d7ebd87..48a5893 100644 (file)
@@ -14,19 +14,19 @@ import com.datastax.driver.core.Session;
 
 public class CassandraRemover {
        private Session session;
-       static SimpleDateFormat dateformatter =  new SimpleDateFormat("yyyy/MM/dd");
+       static SimpleDateFormat dateformatter = new SimpleDateFormat("yyyy/MM/dd");
        private static Logger log = Logger.getLogger(CassandraNativeConnector.class);
 
        public CassandraRemover() {
                Session inis = CassandraNativeConnector.getSession();
-               setSession (inis);
+               setSession(inis);
        }
 
        public void setSession(Session s) {
                assert s != null;
                session = s;
        }
-       
+
        /*
         * delete a record from CF for current jobId
         */
@@ -42,7 +42,7 @@ public class CassandraRemover {
                System.out.println("Command: " + com);
                ResultSet results = session.execute(com);
                Row row = results.one();
-               long njobs = row.getLong("Total") -1 ;
+               long njobs = row.getLong("Total") - 1;
                if (status.equals("OK")) {
                        long njobsOK = row.getLong("TotalOK") - 1;
                        String com1 = "DELETE FROM ProteinRow WHERE JobID = '" + jobid + "';";
@@ -69,24 +69,24 @@ public class CassandraRemover {
                }
                System.out.println("Remove jobs: " + jobid);
        }
-       
+
        private void UpdateJobDateInfo(long date, String ColumnName, long totalcol, long total) {
                String com4 = "UPDATE JobDateInfo SET " + ColumnName + " = " + totalcol + ", Total = " + total + " WHERE jobday = " + date + ";";
                System.out.println("Command: " + com4);
                session.execute(com4);
        }
-       
-       public int RemoveJobById (String jobid) {
-               if (jobid == null) 
+
+       public int RemoveJobById(String jobid) {
+               if (jobid == null)
                        return 0;
                Long date = FindDate(jobid);
                RemoveJob(jobid, date);
                return 1;
        }
-       
-       public int RemoveJobByDate (String date1, String date2) {
+
+       public int RemoveJobByDate(String date1, String date2) {
                int numremover = 0;
-               if (date1 == null || date2 == null) 
+               if (date1 == null || date2 == null)
                        return 0;
                Long dateBegin = convertDate(date1);
                Long dateEnd = convertDate(date2);
@@ -127,11 +127,10 @@ public class CassandraRemover {
                }
                return numremover;
        }
-       
-       
-       public int RemoveJobByIp (String ip) {
+
+       public int RemoveJobByIp(String ip) {
                int numremover = 0;
-               if (ip == null) 
+               if (ip == null)
                        return 0;
                String com = "SELECT databegin, JobID FROM ProteinLog WHERE ip = '" + ip + "';";
                ResultSet results = session.execute(com);
@@ -148,10 +147,10 @@ public class CassandraRemover {
                }
                return numremover;
        }
-       
-       public int RemoveJobBySequence (String seq) {
+
+       public int RemoveJobBySequence(String seq) {
                int numremover = 0;
-               if (seq == null) 
+               if (seq == null)
                        return 0;
                String com = "SELECT JobID FROM ProteinRow WHERE Protein = '" + seq + "';";
                ResultSet results = session.execute(com);
@@ -166,14 +165,14 @@ public class CassandraRemover {
                }
                return numremover;
        }
-        
+
        private Long FindDate(String jobid) {
                String com = "SELECT databegin FROM ProteinLog WHERE JobID = '" + jobid + "';";
                ResultSet results = session.execute(com);
                Long date = convertDate(results.one().getString("databegin"));
                return date;
        }
-       
+
        private String FindStatus(String jobid) {
                String com = "SELECT FinalStatus FROM ProteinLog WHERE JobID = '" + jobid + "';";
                System.out.println("Command: " + com);
@@ -182,8 +181,8 @@ public class CassandraRemover {
                System.out.println("*****status: " + status);
                return status;
        }
-       
-       protected long convertDate (String d) {
+
+       protected long convertDate(String d) {
                try {
                        if (null != d) {
                                Date startdate = dateformatter.parse(d);