@Test @Ignore public void testGetTemplate() throws Exception { fail("Not implemented due to interaction with the filesystem."); }
@Override public String getTemplate(String templateName) throws AcmEmailConfigurationException { File templateFolder = getTemplateFolder(); File templateFile = new File(templateFolder, templateName); Lock readLock = lock.readLock(); try { readLock.lock(); if (!templateFile.exists()) { log.warn("Email template {} does not exist.", templateName); throw new AcmEmailConfigurationIOException(String.format("Email template %s does not exist.", templateName)); } return FileUtils.readFileToString(templateFile, "UTF-8"); } catch (IOException e) { log.warn("Error while reading contents of {} email template.", templateName, e); throw new AcmEmailConfigurationIOException(String.format("Error while reading contents of %s email template.", templateName), e); } finally { readLock.unlock(); } }
AcmFilesystemMailTemplateConfigurationService implements AcmMailTemplateConfigurationService { @Override public String getTemplate(String templateName) throws AcmEmailConfigurationException { File templateFolder = getTemplateFolder(); File templateFile = new File(templateFolder, templateName); Lock readLock = lock.readLock(); try { readLock.lock(); if (!templateFile.exists()) { log.warn("Email template {} does not exist.", templateName); throw new AcmEmailConfigurationIOException(String.format("Email template %s does not exist.", templateName)); } return FileUtils.readFileToString(templateFile, "UTF-8"); } catch (IOException e) { log.warn("Error while reading contents of {} email template.", templateName, e); throw new AcmEmailConfigurationIOException(String.format("Error while reading contents of %s email template.", templateName), e); } finally { readLock.unlock(); } } }
AcmFilesystemMailTemplateConfigurationService implements AcmMailTemplateConfigurationService { @Override public String getTemplate(String templateName) throws AcmEmailConfigurationException { File templateFolder = getTemplateFolder(); File templateFile = new File(templateFolder, templateName); Lock readLock = lock.readLock(); try { readLock.lock(); if (!templateFile.exists()) { log.warn("Email template {} does not exist.", templateName); throw new AcmEmailConfigurationIOException(String.format("Email template %s does not exist.", templateName)); } return FileUtils.readFileToString(templateFile, "UTF-8"); } catch (IOException e) { log.warn("Error while reading contents of {} email template.", templateName, e); throw new AcmEmailConfigurationIOException(String.format("Error while reading contents of %s email template.", templateName), e); } finally { readLock.unlock(); } }  }
AcmFilesystemMailTemplateConfigurationService implements AcmMailTemplateConfigurationService { @Override public String getTemplate(String templateName) throws AcmEmailConfigurationException { File templateFolder = getTemplateFolder(); File templateFile = new File(templateFolder, templateName); Lock readLock = lock.readLock(); try { readLock.lock(); if (!templateFile.exists()) { log.warn("Email template {} does not exist.", templateName); throw new AcmEmailConfigurationIOException(String.format("Email template %s does not exist.", templateName)); } return FileUtils.readFileToString(templateFile, "UTF-8"); } catch (IOException e) { log.warn("Error while reading contents of {} email template.", templateName, e); throw new AcmEmailConfigurationIOException(String.format("Error while reading contents of %s email template.", templateName), e); } finally { readLock.unlock(); } }  @Override List<EmailTemplateConfiguration> getTemplateConfigurations(); void setTemplateConfigurations(Resource templateConfigurations); @Override EmailTemplateValidationResponse validateEmailTemplate(EmailTemplateConfiguration templateData); @Override void updateEmailTemplate(EmailTemplateConfiguration templateData, MultipartFile template); @Override List<EmailTemplateConfiguration> getMatchingTemplates(String email, String objectType, EmailSource source, List<String> actions); @Override String getTemplate(String templateName); @Override void deleteTemplate(String templateName); @Override AcmEmailServiceExceptionMapper<ME> getExceptionMapper(AcmEmailServiceException e); void setTemplateFolderPath(String templateFolderPath); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter); }
AcmFilesystemMailTemplateConfigurationService implements AcmMailTemplateConfigurationService { @Override public String getTemplate(String templateName) throws AcmEmailConfigurationException { File templateFolder = getTemplateFolder(); File templateFile = new File(templateFolder, templateName); Lock readLock = lock.readLock(); try { readLock.lock(); if (!templateFile.exists()) { log.warn("Email template {} does not exist.", templateName); throw new AcmEmailConfigurationIOException(String.format("Email template %s does not exist.", templateName)); } return FileUtils.readFileToString(templateFile, "UTF-8"); } catch (IOException e) { log.warn("Error while reading contents of {} email template.", templateName, e); throw new AcmEmailConfigurationIOException(String.format("Error while reading contents of %s email template.", templateName), e); } finally { readLock.unlock(); } }  @Override List<EmailTemplateConfiguration> getTemplateConfigurations(); void setTemplateConfigurations(Resource templateConfigurations); @Override EmailTemplateValidationResponse validateEmailTemplate(EmailTemplateConfiguration templateData); @Override void updateEmailTemplate(EmailTemplateConfiguration templateData, MultipartFile template); @Override List<EmailTemplateConfiguration> getMatchingTemplates(String email, String objectType, EmailSource source, List<String> actions); @Override String getTemplate(String templateName); @Override void deleteTemplate(String templateName); @Override AcmEmailServiceExceptionMapper<ME> getExceptionMapper(AcmEmailServiceException e); void setTemplateFolderPath(String templateFolderPath); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter);  }