use of io.datarouter.email.html.J2HtmlDatarouterEmailBuilder in project datarouter by hotpads.
the class ClusterSettingsHandler method sendEmail.
private void sendEmail(ClusterSettingLog log, String oldValue) {
if (!settings.sendUpdateEmail.get()) {
return;
}
Optional<String> user = getSessionInfo().findNonEmptyUsername();
if (user.isEmpty()) {
return;
}
String title = "Setting Update";
String primaryHref = completeLink(datarouterHtmlEmailService.startLinkBuilder(), log).build();
boolean displayValue = !settings.isExcludedOldSettingString(log.getKey().getName());
J2HtmlDatarouterEmailBuilder emailBuilder = datarouterHtmlEmailService.startEmailBuilder().withTitle(title).withTitleHref(primaryHref).withContent(new ClusterSettingChangeEmailContent(log, oldValue, displayValue).build()).fromAdmin().to(clusterSettingEmailType.tos, serverTypeDetector.mightBeProduction()).to(user.get());
datarouterHtmlEmailService.trySendJ2Html(emailBuilder);
}
use of io.datarouter.email.html.J2HtmlDatarouterEmailBuilder in project datarouter by hotpads.
the class LongRunningTaskFailureAlertJob method sendEmail.
private void sendEmail(List<LongRunningTask> longRunningTaskList) {
if (longRunningTaskList.size() > 0) {
String primaryHref = emailService.startLinkBuilder().withLocalPath(paths.datarouter.triggers).build();
ContainerTag<?> content = buildEmail(serverName.get(), longRunningTaskList);
J2HtmlDatarouterEmailBuilder emailBuilder = emailService.startEmailBuilder().withTitle("LongRunningTaskFailure").withTitleHref(primaryHref).withContent(content).fromAdmin().toSubscribers(serverTypeDetector.mightBeProduction()).to(longRunningTaskFailureAlertEmailType.tos, serverTypeDetector.mightBeProduction()).toAdmin(!serverTypeDetector.mightBeProduction());
emailService.trySendJ2Html(emailBuilder);
}
}
use of io.datarouter.email.html.J2HtmlDatarouterEmailBuilder in project datarouter by hotpads.
the class IDatarouterEmailService method startEmailBuilderWithLogo.
public J2HtmlDatarouterEmailBuilder startEmailBuilderWithLogo(String hostPort, String contextPath, String serviceName, String environmentName, String configuredLogoHref) {
String logoImgSrc;
if (StringTool.notEmpty(configuredLogoHref)) {
logoImgSrc = configuredLogoHref;
} else {
logoImgSrc = startLinkBuilder(hostPort, contextPath).withLocalPath(files.jeeAssets.datarouterLogoPng).build();
}
String logoHref = startLinkBuilder(hostPort, contextPath).withLocalPath(paths.datarouter).build();
return new J2HtmlDatarouterEmailBuilder().withWebappName(serviceName).withEnvironment(environmentName).withIncludeLogo(true).withLogoImgSrc(logoImgSrc).withLogoHref(logoHref);
}
use of io.datarouter.email.html.J2HtmlDatarouterEmailBuilder in project datarouter by hotpads.
the class TableSizeMonitoringService method sendEmail.
private void sendEmail(List<CountStat> aboveThresholdList, List<CountStat> abovePercentageList, List<LatestTableCount> staleList) {
String primaryHref = emailService.startLinkBuilder().withLocalPath(paths.datarouter.nodewatch.tableCount).build();
ContainerTag<?> content = emailBuilder.build(aboveThresholdList, PERCENTAGE_THRESHOLD, abovePercentageList, staleList);
J2HtmlDatarouterEmailBuilder emailBuilder = emailService.startEmailBuilder().withTitle("Nodewatch").withTitleHref(primaryHref).withContent(content).fromAdmin().to(nodewatchEmailType.tos);
emailService.trySendJ2Html(emailBuilder);
}
Aggregations