TemplateService.java

  1. package no.nav.data.team.notify;

  2. import lombok.Getter;
  3. import no.nav.data.common.template.FreemarkerConfig.FreemarkerService;
  4. import no.nav.data.team.notify.dto.MailModels.UpdateModel;
  5. import org.springframework.stereotype.Service;

  6. @Service
  7. public class TemplateService {

  8.     private final FreemarkerService freemarkerService;

  9.     public TemplateService(FreemarkerService freemarkerService) {
  10.         this.freemarkerService = freemarkerService;
  11.     }

  12.     public String teamUpdate(UpdateModel model) {
  13.         return freemarkerService.generate(model);
  14.     }

  15.     public enum MailTemplates {
  16.         TEAM_UPDATE("team-update.ftl");

  17.         @Getter
  18.         private final String templateName;

  19.         MailTemplates(String template) {
  20.             templateName = template;
  21.         }

  22.     }
  23. }