Esempio n. 1
0
 private Map getYearLookup() {
   Map<Long, Integer> lookupData = new LinkedHashMap<>();
   List<Year> yearList = yearService.findAlls();
   for (Year year : yearList) {
     lookupData.put(year.getId(), year.getValue());
   }
   return lookupData;
 }
Esempio n. 2
0
  private void saveTMAForm(Long id, TinggiMukaAirForm form, Long dasId) throws IOException {
    TinggiMukaAir tma = (id == null ? new TinggiMukaAir() : tinggiMukaAirService.findById(id));

    tma.setDescription(form.getDescription());

    Year year = yearService.findById(form.getYear());
    tma.setYear(year);

    Das das = dasService.findById(dasId);
    tma.setDas(das);

    if (form.getFile() == null || form.getFile().isEmpty()) {
      tinggiMukaAirService.save(tma);
    } else {
      tma.setFilename(form.getFile().getOriginalFilename());
      tinggiMukaAirService.save(tma, form.getFile().getInputStream());
    }
  }