Ejemplo n.º 1
0
  public String getEnrolledSections(Student student) {
    JSONArray ja = new JSONArray();

    StudentDao sd = dataAccess.createStudentDao();
    List<Section> sections = sd.getEnrolledSections(student);

    for (Section s : sections) {
      JSONObject jo = new JSONObject();
      jo.put("sectionNo", s.getSectionNo());
      jo.put("day", s.getDayOfWeek());
      jo.put("time", s.getTimeOfDay());
      jo.put("room", s.getRoom());
      jo.put("sCapacity", s.getSeatingCapacity());
      jo.put("courseName", s.getRepresentedCourse().getCourseName());
      jo.put("professor", s.getInstructor().getName());
      ja.put(jo);
    }
    return ja.toString();
  }