+
+ Long getPriorId(Analysis analysis) throws SQLException, TypeMismatchException
+ {
+ Column[] columns = { CfbSchema.RUNID };
+ Table[] tables = { CfbSchema.RUNS };
+ Condition[] conditions = { new Condition( CfbSchema.STARTTIME, analysis.getStart(), Operation.LESS_THAN ) };
+ Sort[] sorts = { new Sort( CfbSchema.STARTTIME, Sort.Direction.DESCENDING ) };
+ int limit = 1;
+
+ List<Row> rows = m_driver.select(m_con, columns, tables, conditions, sorts, limit);
+ if (rows.size() < 1) {
+ return null;
+ }
+ return rows.get(0).getLong(0);
+ }
+
+ Analysis getAnalysis(Long priorId) throws SQLException, TypeMismatchException
+ {
+ Column[] columns = { CfbSchema.VERSION, CfbSchema.STARTTIME, CfbSchema.ENDTIME };
+ Table[] tables = { CfbSchema.RUNS };
+ Condition[] conditions = { new Condition( CfbSchema.RUNID, priorId, Operation.EQUAL ) };
+
+ List<Row> rows = m_driver.select(m_con, columns, tables, conditions);
+ if (rows.size() < 1) {
+ return null;
+ }
+
+ Row row = rows.get(0);
+
+ String version = row.getString(0);
+ java.util.Date start= row.getDate(1);
+ java.util.Date end = row.getDate(2);
+
+ Analysis prior = new Analysis(version);
+ prior.setId(priorId.longValue());
+ prior.setStart(start);
+ prior.setEnd(end);
+
+ prior.setBugCollection(getBugCollection(priorId));
+
+ return prior;
+ }
+
+ BugCollection getBugCollection(Long priorId) throws SQLException, TypeMismatchException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }