|
From: fredrik <fre...@us...> - 2005-04-28 11:51:16
|
Update of /cvsroot/test-manager/main/src/testmanager/database/views In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14164/src/testmanager/database/views Added Files: TestCaseListView.java Log Message: Reorganizing servlets & adding bug tracking --- NEW FILE: TestCaseListView.java --- package testmanager.database.views; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; /** * @author Fredrik Fornwall */ public class TestCaseListView { private static final String query = "SELECT TestCase.ID, TestCase.title, TestCase.Type, TestCase.Status, TestCaseArea.Name, Tester.FullName, Tester.ID " + "FROM TestCase, TestCaseArea, Tester " + "WHERE TestCase.AreaID = TestCaseArea.ID AND TestCase.ResponsibleID = Tester.ID"; public static void call(Connection connection, RowHandler rowHandler) throws SQLException { ResultSet resultSet = connection.createStatement().executeQuery(query); if (!resultSet.next()) { rowHandler.noRows(); return; } rowHandler.start(); while (resultSet.next()) { rowHandler.handleTestCaseListRow(resultSet.getInt(1), resultSet.getString(2), resultSet.getInt(3), resultSet.getInt(4), resultSet.getString(5), resultSet.getString(6), resultSet .getInt(7)); } rowHandler.finish(); } public static interface RowHandler { /** * Called if the query returned no rows. In that case this is the only method called. */ public void noRows(); public void start(); /** * Will be called after each. */ public void finish(); public void handleTestCaseListRow(int testCaseID, String testCaseTitle, int testCaseType, int testCaseStatus, String testCaseAreaName, String responsibleTesterFullName, int responsibleTesterID); } } |