private String getDictionaryItemsInJson(List<DictionaryItem> items) {
    StringBuilder builder = new StringBuilder();
    builder.append("[");
    for (DictionaryItem item : items) {
      builder.append("{id:'");
      builder.append(item.getId().toString());
      builder.append("', value:'");
      builder.append(item.getValue());
      builder.append("'},");
    }
    if (builder.length() > 1) {
      builder.deleteCharAt(builder.length() - 1);
    }

    builder.append("]");
    return builder.toString();
  }
Example #2
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;
 }