Esempio n. 1
0
 @Secured("ROLE_ADMIN")
 public List<NewEntry<City, List<NewEntry<Speciality, List<Group>>>>> getCities() {
   if (cities == null) {
     year = semesterGetter.getCurrentYear();
     List<Object[]> l = groupDao.getAllGroupsAndCities(year);
     City c = null;
     Speciality s = null;
     NewEntry<City, List<NewEntry<Speciality, List<Group>>>> cityEntry = null;
     NewEntry<Speciality, List<Group>> specialityEntry = null;
     List<NewEntry<Speciality, List<Group>>> specList = null;
     List<Group> groupList = null;
     cities = new ArrayList<NewEntry<City, List<NewEntry<Speciality, List<Group>>>>>();
     for (Object[] e : l) {
       Group g = (Group) e[0];
       City city = (City) e[1];
       if (city != c) {
         specList = new ArrayList<NewEntry<Speciality, List<Group>>>();
         cityEntry = new NewEntry(city, specList);
         cities.add(cityEntry);
       }
       if (g.getSpeciality() != s) {
         groupList = new ArrayList<Group>();
         specialityEntry = new NewEntry<Speciality, List<Group>>(g.getSpeciality(), groupList);
         specList.add(specialityEntry);
       }
       groupList.add(g);
       c = city;
       s = g.getSpeciality();
     }
   }
   return cities;
 }
Esempio n. 2
0
 public int[][] getYears() {
   int end = 6;
   if (group.getSpeciality().getName().contains("ускор")
       || group.getSpeciality().getName().contains("сокр")) {
     end = 4;
   }
   int[][] l = new int[end][2];
   for (int k = 1; k <= end; k++) {
     l[k - 1] = new int[] {k, k * 2 - (winter ? 1 : 0)};
   }
   return l;
 }
Esempio n. 3
0
  public List<NewEntry<NewEntry<DeCurriculum, Teacher>, Estimate>> getOldGrades() {
    if (points == null) {
      List<Student> stl = ListUtil.<Student>oneItemList(student);
      Map<DeCurriculum, Teacher> map = null;
      points = new ArrayList<NewEntry<NewEntry<DeCurriculum, Teacher>, Estimate>>();

      //  if(semester != semesterGetter.getCurrentSemester()){
      int year = student.getGroup().getYear() - group.getYear();
      map =
          curriculumDao.<DeCurriculum, Teacher>getTeachersByGroup(
              semester, semesterGetter.getCurrentYear() - year, group);
      //            }else
      //                map = studentSessionBean.getCurriculumAndTeacher(0);

      if (CollectionUtils.isEmpty(map)) return points;
      else map = new HashMap<DeCurriculum, Teacher>(map);

      List<Estimate> l =
          estimateDao.getByStudentsAndCurriculums(new ArrayList(map.keySet()), stl, null);

      if (l == null) return points;

      Iterator<Map.Entry<DeCurriculum, Teacher>> setI = map.entrySet().iterator();

      while (setI.hasNext()) {
        Map.Entry<DeCurriculum, Teacher> entry = setI.next();
        Iterator<Estimate> i = l.iterator();
        while (i.hasNext()) {
          Estimate e = i.next();
          if (e.getCurriculum().equals(entry.getKey())) {
            boolean fl = true;
            for (NewEntry<NewEntry<DeCurriculum, Teacher>, Estimate> p : points) {
              NewEntry<DeCurriculum, Teacher> dt = p.getKey();
              if (dt.getKey().equals(entry.getKey())) {
                fl = false;
              }
            }
            if (fl) {
              NewEntry<DeCurriculum, Teacher> ctE =
                  new NewEntry<DeCurriculum, Teacher>(entry.getKey(), entry.getValue());
              points.add(new NewEntry<NewEntry<DeCurriculum, Teacher>, Estimate>(ctE, e));
            }
            try {
              //                        i.remove();
              //                        setI.remove();

            } catch (Exception ex) {
              System.out.println("bug in old grades");
            }

            continue;
          }
        }
      }
      setI = map.entrySet().iterator();
      //            while(setI.hasNext()){
      //                Map.Entry<DeCurriculum,Teacher> entry = setI.next();
      //                NewEntry<DeCurriculum,Teacher>ctE = new NewEntry<DeCurriculum,
      // Teacher>(entry.getKey(), entry.getValue());
      //                points.add(new NewEntry<NewEntry<DeCurriculum, Teacher>, Estimate>(ctE,
      // null));
      //            }
      calculateParamsAndSliceListMarks();
    }
    return points;
  }