Ejemplo n.º 1
0
  /**
   * @param exam Haluttu koe.
   * @return Tulos-taulukon malli, jossa on kaikki tietorakenteen parametreja osittain vastaavat
   *     yksiköt.
   */
  public DataTableModel<CombinedUnit> getGradeTableModel(Exam exam) {
    FN[] fields = {FN.STUDENT_FIRSTNAME, FN.STUDENT_LASTNAME, FN.STUDENT_ID, FN.GRADE_GRADE};
    Ref ref = exam.getRef();
    List<Grade> grades = manager.getGrades(ref, FN.GRADE_EXAM_REF);
    List<CombinedUnit> gradesAndStudents = manager.joinRefs(grades, FN.GRADE_STUDENT_REF);
    String[] fieldNames = {"etunimi", "sukunimi", "henkilötunnus", "arvosana"};

    return new DataTableModel<>(gradesAndStudents, fields, fieldNames);
  }
Ejemplo n.º 2
0
 /**
  * @param selectedSubject Haluttu aine.
  * @param date Haluttu pvm.
  * @return Koe-taulukon malli, jossa on kaikki tietorakenteen parametreja osittain vastaavat
  *     yksiköt.
  */
 public DataTableModel<CombinedUnit> getExamTableModel(Subject selectedSubject, String date) {
   FN[] fields = {FN.SUBJECT_NAME, FN.EXAM_DATE};
   String[] fieldNames = {"aine", "päivämäärä"};
   String subjectId;
   if (selectedSubject == null) {
     subjectId = "";
   } else {
     subjectId = String.valueOf(selectedSubject.getRef());
   }
   String[] search = {subjectId, date};
   List<Exam> exams = manager.searchExams(search, new FN[] {FN.EXAM_SUBJECT_REF, FN.EXAM_DATE});
   List<CombinedUnit> data = manager.joinRefs(exams, FN.EXAM_SUBJECT_REF);
   DataTableModel<CombinedUnit> model = new DataTableModel<>(data, fields, fieldNames);
   return model;
 }