* @param sourceConfiguration the source to convert
* @return the converted e-mail configuration
*/
private EmailNotifierConfig createEmailNotifierConfig(
final EmailNotifierConfiguration sourceConfiguration) {
final EmailNotifierConfig config = new EmailNotifierConfig();
boolean enabled = sourceConfiguration.isEnabled();
config.setEnabled(enabled);
if (enabled) {
final String smtpHost = sourceConfiguration.getSmtpHost();
if (smtpHost != null) {
config.setSmtpHost(smtpHost);
}
final int smtpPort = sourceConfiguration.getSmtpPort();
if (smtpPort != 0) {
config.setSmtpPort(smtpPort);
}
final String smtpUserName = sourceConfiguration.getSmtpUserName();
if (smtpUserName != null) {
config.setSmtpUserName(smtpUserName);
}
final String smtpPassword = sourceConfiguration.getSmtpPassword();
if (smtpPassword != null) {
config.setSmtpPassword(smtpPassword);
}
final String fromAddress = sourceConfiguration.getFromAddress();
if (fromAddress != null) {
config.setFromAddress(fromAddress);
}
final String fromName = sourceConfiguration.getFromName();
if (fromName != null) {
config.setFromName(fromName);
}
final String toAddress = sourceConfiguration.getToAddress();
if (toAddress != null) {
config.setToAddress(toAddress);
}
final String toName = sourceConfiguration.getToName();
if (toName != null) {
config.setToName(toName);
}
final String subject = sourceConfiguration.getSubject();
if (subject != null) {
config.setSubject(subject);
}
final String period = sourceConfiguration.getPeriod();
if (period != null) {
config.setPeriod(EmailNotifierPeriodEnum.literal(period));
}
}
return config;
}