private Builder() { instance = new EmailLinksList(); }
public static Builder from(EmailLinksList value) { return new Builder(value); }
/** * This will be the default implementation that will listen to all the changes * and send emails accordingly. * * @param event the event which occurred. */ @Override public void postEvent(EventLogEvent event) { String subject = emailTextProcessor.getSubject(event); String msg = emailTextProcessor.getMessage(event); Set<String> addressees = emailTextProcessor.getAddressees(event); LOGGER.info("Sending email with subject:{}, message:{}, addressees:{}", subject, msg, addressees); emailService.doSend(subject, msg, addressees.toArray(new String[addressees.size()])); } }
/** * {@inheritDoc} */ @Override public void sendEmailForUserPermission(Application.Name appName, UserInfo.Username user, EmailLinksList links) { LOGGER.debug("Sending an email to the administrators of " + appName + " for user " + user + "with links" + links.toString()); String subject = emailTextProcessor.getSubject(appName); String msg = emailTextProcessor.getMessage(appName, user, links); Set<String> addressees = emailTextProcessor.getAddressees(appName); doSend(subject, msg, addressees.toArray(new String[addressees.size()])); }
/** * {@inheritDoc} */ @Override public String getMessage(Application.Name app, UserInfo.Username username, EmailLinksList links) { ST appAccess = new ST(APP_ACCESS); Map<String, String> variables = new HashMap<>(); put(variables, APPLICATION_NAME, String.valueOf(app)); put(variables, USER_NAME, String.valueOf(username)); put(variables, EMAIL_LINKS, links.toString()); return replaceVariablesInTemplate(variables, appAccess); }
@Override public void sendEmailForUserPermission(Application.Name appName, UserInfo.Username user, EmailLinksList links) { LOGGER.info("EMAIL IS GETTING SEND FOR USER: \"" + user + "\" FOR THE APPLICATION \" " + appName.toString() + "\""); try { String subject = emailTextProcessor.getSubject(appName); String msg = emailTextProcessor.getMessage(appName, user, links); Set<String> addressees = emailTextProcessor.getAddressees(appName); doSend(subject, msg, addressees.toArray(new String[addressees.size()])); } catch (NullPointerException npe) { LOGGER.info("No EmailTextProcessor set in NoopImplementation", npe); } }
String message; if (emailService.isActive()) { emailService.sendEmailForUserPermission(applicationName, user, emails); + user + " with links " + emails.toString(); return httpHeader.headers().entity(message).build(); } else {
install(new EventLogModule()); install(new CassandraRepositoryModule()); bind(Boolean.class).annotatedWith(named(EMAIL_SERVICE_ENABLED)) .toInstance(Boolean.valueOf(getProperty("email.service.enabled", properties, FALSE.toString()))); bind(String.class).annotatedWith(named(EMAIL_SERVICE_HOST)) .toInstance(getProperty("email.service.host", properties, "")); bind(String.class).annotatedWith(named(EMAIL_SERVICE_FROM)) .toInstance(getProperty("email.service.from", properties, "")); bind(String.class).annotatedWith(named(EMAIL_SERVICE_SUBJECT_PREFIX)) .toInstance(getProperty("email.service.subject.prefix", properties, "")); bind(String.class).annotatedWith(named(EMAIL_SERVICE_USERNAME)) .toInstance(getProperty("email.service.username", properties, "")); bind(String.class).annotatedWith(named(EMAIL_SERVICE_PASSWORD)) .toInstance(getProperty("email.service.password", properties, "")); bind(String.class).annotatedWith(named(EMAIL_SERVICE_AUTHENTICATION_ENABLED)) .toInstance(getProperty("email.service.authentication.enabled", properties, FALSE.toString())); bind(String.class).annotatedWith(named(EMAIL_SERVICE_SSL_ENABLED)) .toInstance(getProperty("email.service.ssl.enabled", properties, FALSE.toString())); bind(EmailTextProcessor.class).to(EmailTextProcessorImpl.class).in(SINGLETON); bind(EmailEventLogListener.class).asEagerSingleton(); bind(EmailService.class).to(emailServiceClass).in(SINGLETON); } catch (ClassNotFoundException e) { LOGGER.error("unable to find class: {}", emailServiceClassName, e);
public static WasabiEmailFields getByEmailValue(String emailValue) { WasabiEmailFields result = NO_SUCH_VALUE; for (WasabiEmailFields val : WasabiEmailFields.values()) { if (val.emailValue.equalsIgnoreCase(emailValue)) { result = val; break; } } return result; }
@Override public String toString() { StringBuilder allLinks = new StringBuilder(); for (String link : getEmailLinks()) { allLinks.append(link); allLinks.append(LINE_SEPARATOR); } return allLinks.toString(); }
protected void installEmailModule() { install(new EmailModule());}
public static Builder newInstance() { return new Builder(); }
public static Builder withEmailLinksList(List<String> emailLinks) { return new Builder(emailLinks); }