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;
 }