コード例 #1
0
ファイル: SCRSImpl.java プロジェクト: leewc/SCRS-middleware
  /**
   * This method is used to perform class queries or provide information to the GUI.
   *
   * @param courseID can be used by administrator for fast class query
   * @param courseName Mandatory Field
   * @param location Mandatory Field
   * @param term Mandatory Field
   * @param department
   * @param classType
   * @param instructorName
   * @return A list of ArrayList, in the ArrayList, each entry stores one query result in the table
   *     property order. Actual Database operations are delegated to the search class. Empty list
   *     will be returned if the query is failed.
   */
  @Override
  public List<ArrayList<String>> queryClass(
      int courseID,
      String courseName,
      String location,
      String term,
      String department,
      String classType,
      String instructorName) {

    if (location.isEmpty() || courseName.isEmpty() || term.isEmpty()) {
      System.err.println("Location, Course Name and Term fields must not be empty.");
      return _empty;
    }
    search = new Search();
    try {
      return search.searchClasses(
          courseID, courseName, location, term, department, classType, instructorName);
    } catch (ClassNotFoundException | SQLException e) {
      System.err.println("Unable to perform search, please try again.");
      return _empty;
    }
  }