Exemplo n.º 1
0
 public List<VacationInYear> getSummaryDaysCountByYearAndType(
     List<DictionaryItem> vacationTypes,
     int firstYear,
     int lastYear,
     Map<Vacation, Integer> calDays,
     Map<Vacation, Integer> workDays) {
   List<VacationInYear> result = new ArrayList<VacationInYear>();
   for (DictionaryItem vacationType : vacationTypes) {
     for (int year = firstYear; year <= lastYear; year++) {
       Map<Vacation, Integer> calDaysForYearByType =
           getDaysForYearByType(calDays, year, vacationType);
       Map<Vacation, Integer> workDaysForYearByType =
           getDaysForYearByType(workDays, year, vacationType);
       int summaryCalDays = getSummaryDaysCount(calDaysForYearByType);
       int summaryWorkDays = getSummaryDaysCount(workDaysForYearByType);
       result.add(
           new VacationInYear(vacationType.getValue(), year, summaryCalDays, summaryWorkDays));
     }
   }
   return result;
 }
Exemplo n.º 2
0
  // возвращает список отпусков за год определенного типа с указанием количества календарных или
  // рабочих дней
  // в зависимости от того, какой список был передан
  private Map<Vacation, Integer> getDaysForYearByType(
      Map<Vacation, Integer> days, int year, DictionaryItem type) {
    Map<Vacation, Integer> daysForYearByType = new HashMap<Vacation, Integer>();
    for (Map.Entry<Vacation, Integer> entry : days.entrySet()) {
      Vacation vacation = entry.getKey();
      Integer calDaysInVacation = entry.getValue();

      if (vacationStatusInThisYear(vacation, year)
          && type.getId().equals(vacation.getType().getId())) {
        daysForYearByType.put(vacation, calDaysInVacation);
      }
    }
    return daysForYearByType;
  }