diff --git a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/constants/I18nMgtConstants.java b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/constants/I18nMgtConstants.java index c6df9315..00a45e09 100644 --- a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/constants/I18nMgtConstants.java +++ b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/constants/I18nMgtConstants.java @@ -65,8 +65,6 @@ private I18nMgtConstants() {} public static final String NOTIFICATION_TEMPLATES_STORAGE_CONFIG = "DataStorageType.NotificationTemplates"; public static final String NOTIFICATION_TEMPLATES_LEGACY_TENANTS = "NotificationTemplates.LegacyTenants.Tenant"; public static final String NOTIFICATION_TEMPLATES_DEBUG_TENANTS = "NotificationTemplates.DebugTenants.Tenant"; - public static final String NOTIFICATION_TEMPLATES_ENABLE_UNICODE_SUPPORT = - "NotificationTemplates.EnableUnicodeSupport"; public static final String SERVICE_PROPERTY_KEY_SERVICE_NAME = "service.name"; public static final String SERVICE_PROPERTY_VAL_EMAIL_TEMPLATE_MANAGER = "EmailTemplateManager"; @@ -164,9 +162,6 @@ public static class NotificationTableColumns { public static final String TENANT_ID = "TENANT_ID"; public static final String TEMPLATE_KEY = "TEMPLATE_KEY"; public static final String LOCALE = "LOCALE"; - public static final String SUBJECT = "SUBJECT"; - public static final String BODY = "BODY"; - public static final String FOOTER = "FOOTER"; public static final String CONTENT = "CONTENT"; public static final String CONTENT_TYPE = "CONTENT_TYPE"; public static final String TYPE_ID = "TYPE_ID"; diff --git a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/constants/SQLConstants.java b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/constants/SQLConstants.java index 6791f0f1..c37161c1 100644 --- a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/constants/SQLConstants.java +++ b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/constants/SQLConstants.java @@ -47,55 +47,21 @@ public class SQLConstants { "(TEMPLATE_KEY, LOCALE, CONTENT, CONTENT_TYPE, TYPE_ID, TENANT_ID, VERSION, CREATED_AT, UPDATED_AT) " + "VALUES (:TEMPLATE_KEY;, :LOCALE;, :CONTENT;, :CONTENT_TYPE;, (" + GET_NOTIFICATION_TYPE_ID_SQL + "), :TENANT_ID;, :VERSION;, :CREATED_AT;, :UPDATED_AT;)"; - public static final String INSERT_ORG_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL = - "INSERT INTO IDN_NOTIFICATION_ORG_TEMPLATE " + - "(TEMPLATE_KEY, LOCALE, SUBJECT, BODY, FOOTER, CONTENT_TYPE, TYPE_ID, TENANT_ID) " + - "VALUES (:TEMPLATE_KEY;, :LOCALE;, :SUBJECT;, :BODY;, :FOOTER;, :CONTENT_TYPE;, (" + - GET_NOTIFICATION_TYPE_ID_SQL + "), :TENANT_ID;)"; - public static final String INSERT_ORG_NOTIFICATION_TEMPLATE_HYBRID_SQL = - "INSERT INTO IDN_NOTIFICATION_ORG_TEMPLATE " + - "(TEMPLATE_KEY, LOCALE, CONTENT, SUBJECT, BODY, FOOTER, CONTENT_TYPE, TYPE_ID, TENANT_ID) " + - "VALUES (:TEMPLATE_KEY;, :LOCALE;, :CONTENT;, :SUBJECT;, :BODY;, :FOOTER;, :CONTENT_TYPE;, (" + - GET_NOTIFICATION_TYPE_ID_SQL + "), :TENANT_ID;)"; public static final String GET_ORG_NOTIFICATION_TEMPLATE_SQL = "SELECT CONTENT, CONTENT_TYPE FROM IDN_NOTIFICATION_ORG_TEMPLATE " + "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + ") AND TENANT_ID = :TENANT_ID;"; - public static final String GET_ORG_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL = - "SELECT SUBJECT, BODY, FOOTER, CONTENT_TYPE FROM IDN_NOTIFICATION_ORG_TEMPLATE " + - "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + - ") AND TENANT_ID = :TENANT_ID;"; - public static final String GET_ORG_NOTIFICATION_TEMPLATE_HYBRID_SQL = - "SELECT CONTENT, SUBJECT, BODY, FOOTER, CONTENT_TYPE FROM IDN_NOTIFICATION_ORG_TEMPLATE " + - "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + - ") AND TENANT_ID = :TENANT_ID;"; public static final String IS_ORG_NOTIFICATION_TEMPLATE_EXISTS_SQL = "SELECT ID FROM IDN_NOTIFICATION_ORG_TEMPLATE " + "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = :TYPE_ID; AND TENANT_ID = :TENANT_ID;"; public static final String LIST_ORG_NOTIFICATION_TEMPLATES_BY_TYPE_SQL = "SELECT CONTENT, CONTENT_TYPE, LOCALE FROM IDN_NOTIFICATION_ORG_TEMPLATE " + "WHERE TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + ") AND TENANT_ID = :TENANT_ID;"; - public static final String LIST_ORG_NOTIFICATION_TEMPLATES_BY_TYPE_WITHOUT_UNICODE_SQL = - "SELECT SUBJECT, BODY, FOOTER, CONTENT_TYPE, LOCALE FROM IDN_NOTIFICATION_ORG_TEMPLATE " + - "WHERE TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + ") AND TENANT_ID = :TENANT_ID;"; - public static final String LIST_ORG_NOTIFICATION_TEMPLATES_BY_TYPE_HYBRID_SQL = - "SELECT CONTENT, SUBJECT, BODY, FOOTER, CONTENT_TYPE, LOCALE FROM IDN_NOTIFICATION_ORG_TEMPLATE " + - "WHERE TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + ") AND TENANT_ID = :TENANT_ID;"; public static final String UPDATE_ORG_NOTIFICATION_TEMPLATE_SQL = "UPDATE IDN_NOTIFICATION_ORG_TEMPLATE " + "SET CONTENT = :CONTENT;, CONTENT_TYPE = :CONTENT_TYPE;, UPDATED_AT = :UPDATED_AT; " + "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + ") AND TENANT_ID = :TENANT_ID;"; - public static final String UPDATE_ORG_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL = - "UPDATE IDN_NOTIFICATION_ORG_TEMPLATE " + - "SET SUBJECT = :SUBJECT;, BODY = :BODY;, FOOTER = :FOOTER;, CONTENT_TYPE = :CONTENT_TYPE; " + - "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + - ") AND TENANT_ID = :TENANT_ID;"; - public static final String UPDATE_ORG_NOTIFICATION_TEMPLATE_HYBRID_SQL = - "UPDATE IDN_NOTIFICATION_ORG_TEMPLATE " + - "SET CONTENT = :CONTENT;, SUBJECT = :SUBJECT;, BODY = :BODY;, FOOTER = :FOOTER;, CONTENT_TYPE = :CONTENT_TYPE; " + - "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + - ") AND TENANT_ID = :TENANT_ID;"; public static final String DELETE_ORG_NOTIFICATION_TEMPLATE_SQL = "DELETE FROM IDN_NOTIFICATION_ORG_TEMPLATE WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + ") AND TENANT_ID = :TENANT_ID;"; @@ -109,28 +75,10 @@ public class SQLConstants { "(TEMPLATE_KEY, LOCALE, CONTENT, CONTENT_TYPE, TYPE_ID, APP_ID, TENANT_ID, VERSION, CREATED_AT, UPDATED_AT) " + "VALUES (:TEMPLATE_KEY;, :LOCALE;, :CONTENT;, :CONTENT_TYPE;, (" + GET_NOTIFICATION_TYPE_ID_SQL + "), :APP_ID;, :TENANT_ID;, :VERSION;, :CREATED_AT;, :UPDATED_AT;)"; - public static final String INSERT_APP_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL = - "INSERT INTO IDN_NOTIFICATION_APP_TEMPLATE " + - "(TEMPLATE_KEY, LOCALE, SUBJECT, BODY, FOOTER, CONTENT_TYPE, TYPE_ID, APP_ID, TENANT_ID) " + - "VALUES (:TEMPLATE_KEY;, :LOCALE;, :SUBJECT;, :BODY;, :FOOTER;, :CONTENT_TYPE;, (" + - GET_NOTIFICATION_TYPE_ID_SQL + "), :APP_ID;, :TENANT_ID;)"; - public static final String INSERT_APP_NOTIFICATION_TEMPLATE_HYBRID_SQL = - "INSERT INTO IDN_NOTIFICATION_APP_TEMPLATE " + - "(TEMPLATE_KEY, LOCALE, CONTENT, SUBJECT, BODY, FOOTER, CONTENT_TYPE, TYPE_ID, APP_ID, TENANT_ID) " + - "VALUES (:TEMPLATE_KEY;, :LOCALE;, :CONTENT;, :SUBJECT;, :BODY;, :FOOTER;, :CONTENT_TYPE;, (" + - GET_NOTIFICATION_TYPE_ID_SQL + "), :APP_ID;, :TENANT_ID;)"; public static final String GET_APP_NOTIFICATION_TEMPLATE_SQL = "SELECT CONTENT, CONTENT_TYPE FROM IDN_NOTIFICATION_APP_TEMPLATE " + "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + ") AND APP_ID = :APP_ID; AND TENANT_ID = :TENANT_ID;"; - public static final String GET_APP_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL = - "SELECT SUBJECT, BODY, FOOTER, CONTENT_TYPE FROM IDN_NOTIFICATION_APP_TEMPLATE " + - "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + - ") AND APP_ID = :APP_ID; AND TENANT_ID = :TENANT_ID;"; - public static final String GET_APP_NOTIFICATION_TEMPLATE_HYBRID_SQL = - "SELECT CONTENT, SUBJECT, BODY, FOOTER, CONTENT_TYPE FROM IDN_NOTIFICATION_APP_TEMPLATE " + - "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + - ") AND APP_ID = :APP_ID; AND TENANT_ID = :TENANT_ID;"; public static final String IS_APP_NOTIFICATION_TEMPLATE_EXISTS_SQL = "SELECT ID FROM IDN_NOTIFICATION_APP_TEMPLATE " + "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = :TYPE_ID; AND APP_ID = :APP_ID; " + @@ -139,29 +87,11 @@ public class SQLConstants { "SELECT CONTENT, CONTENT_TYPE, LOCALE FROM IDN_NOTIFICATION_APP_TEMPLATE " + "WHERE TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + ") AND APP_ID = :APP_ID; AND TENANT_ID = :TENANT_ID;"; - public static final String LIST_APP_NOTIFICATION_TEMPLATES_BY_APP_WITHOUT_UNICODE_SQL = - "SELECT SUBJECT, BODY, FOOTER, CONTENT_TYPE, LOCALE FROM IDN_NOTIFICATION_APP_TEMPLATE " + - "WHERE TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + - ") AND APP_ID = :APP_ID; AND TENANT_ID = :TENANT_ID;"; - public static final String LIST_APP_NOTIFICATION_TEMPLATES_BY_APP_HYBRID_SQL = - "SELECT CONTENT, SUBJECT, BODY, FOOTER, CONTENT_TYPE, LOCALE FROM IDN_NOTIFICATION_APP_TEMPLATE " + - "WHERE TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + - ") AND APP_ID = :APP_ID; AND TENANT_ID = :TENANT_ID;"; public static final String UPDATE_APP_NOTIFICATION_TEMPLATE_SQL = "UPDATE IDN_NOTIFICATION_APP_TEMPLATE " + "SET CONTENT = :CONTENT;, CONTENT_TYPE = :CONTENT_TYPE;, UPDATED_AT = :UPDATED_AT; " + "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + ") AND APP_ID = :APP_ID; AND TENANT_ID = :TENANT_ID;"; - public static final String UPDATE_APP_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL = - "UPDATE IDN_NOTIFICATION_APP_TEMPLATE " + - "SET SUBJECT = :SUBJECT;, BODY = :BODY;, FOOTER = :FOOTER;, CONTENT_TYPE = :CONTENT_TYPE; " + - "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + - ") AND APP_ID = :APP_ID; AND TENANT_ID = :TENANT_ID;"; - public static final String UPDATE_APP_NOTIFICATION_TEMPLATE_HYBRID_SQL = - "UPDATE IDN_NOTIFICATION_APP_TEMPLATE " + - "SET CONTENT = :CONTENT;, SUBJECT = :SUBJECT;, BODY = :BODY;, FOOTER = :FOOTER;, CONTENT_TYPE = :CONTENT_TYPE; " + - "WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + - ") AND APP_ID = :APP_ID; AND TENANT_ID = :TENANT_ID;"; public static final String DELETE_APP_NOTIFICATION_TEMPLATE_SQL = "DELETE FROM IDN_NOTIFICATION_APP_TEMPLATE WHERE TEMPLATE_KEY = :TEMPLATE_KEY; AND TYPE_ID = (" + GET_NOTIFICATION_TYPE_ID_SQL + ") AND APP_ID = :APP_ID; AND TENANT_ID = :TENANT_ID;"; diff --git a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/internal/I18nMgtDataHolder.java b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/internal/I18nMgtDataHolder.java index c4b6be3e..419cfd06 100644 --- a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/internal/I18nMgtDataHolder.java +++ b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/internal/I18nMgtDataHolder.java @@ -40,8 +40,6 @@ public class I18nMgtDataHolder{ private List defaultSMSTemplates = new ArrayList<>(); private List legacyTenants = new ArrayList<>(); private List debugTenants = new ArrayList<>(); - private boolean isUnicodeSupported = false; - private boolean isUnicodeSupportedInHybridMode = false; private static I18nMgtDataHolder instance = new I18nMgtDataHolder(); @@ -205,44 +203,4 @@ public void setOrgResourceResolverService(OrgResourceResolverService orgResource this.orgResourceResolverService = orgResourceResolverService; } - - /** - * Sets whether the unicode support for template content is enabled or not. - * - * @param isUnicodeSupported true to enable Unicode support, false to disable. - */ - public void setUnicodeSupport(boolean isUnicodeSupported) { - - this.isUnicodeSupported = isUnicodeSupported; - } - - /** - * Gets whether the unicode support for template content is enabled. - * - * @return true if the unicode support for template content is enabled. - */ - public boolean isUnicodeSupported() { - - return isUnicodeSupported; - } - - /** - * Sets whether the unicode hybrid support for template content is enabled or not. - * - * @param isUnicodeSupportedInHybridMode true to enable Unicode support in hybrid mode, false to disable. - */ - public void setHybrid(boolean isUnicodeSupportedInHybridMode) { - - this.isUnicodeSupportedInHybridMode = isUnicodeSupportedInHybridMode; - } - - /** - * Gets whether the unicode hybrid support for template content is enabled. - * - * @return true if the unicode hybrid support for template content is enabled. - */ - public boolean isHybrid() { - - return isUnicodeSupportedInHybridMode; - } } diff --git a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/internal/I18nMgtServiceComponent.java b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/internal/I18nMgtServiceComponent.java index 12d15fe9..01d7edd8 100644 --- a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/internal/I18nMgtServiceComponent.java +++ b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/internal/I18nMgtServiceComponent.java @@ -104,10 +104,6 @@ protected void activate(ComponentContext context) { List debugTenants = IdentityUtil.getPropertyAsList(NOTIFICATION_TEMPLATES_DEBUG_TENANTS); I18nMgtDataHolder.getInstance().setDebugTenants(debugTenants); - String unicodeSupportType = IdentityUtil.getProperty(NOTIFICATION_TEMPLATES_ENABLE_UNICODE_SUPPORT); - I18nMgtDataHolder.getInstance().setUnicodeSupport(Boolean.parseBoolean(unicodeSupportType)); - I18nMgtDataHolder.getInstance().setHybrid("hybrid".equalsIgnoreCase(unicodeSupportType)); - // Register Email Mgt Service as an OSGi service. EmailTemplateManagerImpl emailTemplateManager = new EmailTemplateManagerImpl(); ServiceRegistration emailTemplateSR = bundleCtx.registerService(EmailTemplateManager.class.getName(), diff --git a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/store/dao/AppNotificationTemplateDAO.java b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/store/dao/AppNotificationTemplateDAO.java index dab88b48..4d1f0ac6 100644 --- a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/store/dao/AppNotificationTemplateDAO.java +++ b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/store/dao/AppNotificationTemplateDAO.java @@ -33,15 +33,12 @@ import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.APP_ID; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.APP_TEMPLATE_SCHEMA_VERSION; -import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.BODY; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.CHANNEL; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.CONTENT; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.CONTENT_TYPE; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.CREATED_AT; -import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.FOOTER; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.ID; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.LOCALE; -import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.SUBJECT; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.TEMPLATE_KEY; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.TENANT_ID; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.TYPE_ID; @@ -51,20 +48,12 @@ import static org.wso2.carbon.email.mgt.constants.SQLConstants.DELETE_ALL_APP_NOTIFICATION_TEMPLATES_BY_TYPE_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.DELETE_APP_NOTIFICATION_TEMPLATES_BY_TYPE_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.DELETE_APP_NOTIFICATION_TEMPLATE_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.GET_APP_NOTIFICATION_TEMPLATE_HYBRID_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.GET_APP_NOTIFICATION_TEMPLATE_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.GET_APP_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.GET_NOTIFICATION_TYPE_ID_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.INSERT_APP_NOTIFICATION_TEMPLATE_HYBRID_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.INSERT_APP_NOTIFICATION_TEMPLATE_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.INSERT_APP_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.IS_APP_NOTIFICATION_TEMPLATE_EXISTS_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.LIST_APP_NOTIFICATION_TEMPLATES_BY_APP_HYBRID_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.LIST_APP_NOTIFICATION_TEMPLATES_BY_APP_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.LIST_APP_NOTIFICATION_TEMPLATES_BY_APP_WITHOUT_UNICODE_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.UPDATE_APP_NOTIFICATION_TEMPLATE_HYBRID_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.UPDATE_APP_NOTIFICATION_TEMPLATE_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.UPDATE_APP_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; import static org.wso2.carbon.email.mgt.util.I18nEmailUtil.CALENDER; import static org.wso2.carbon.email.mgt.util.I18nEmailUtil.getContentByteArray; import static org.wso2.carbon.email.mgt.util.I18nEmailUtil.getCurrentTime; @@ -75,9 +64,6 @@ */ public class AppNotificationTemplateDAO { - private boolean isUnicodeSupported = I18nMgtDataHolder.getInstance().isUnicodeSupported(); - private boolean isHybrid = I18nMgtDataHolder.getInstance().isHybrid(); - public void addNotificationTemplate(NotificationTemplate notificationTemplate, String applicationUuid, int tenantId) throws NotificationTemplateManagerServerException { @@ -89,34 +75,21 @@ public void addNotificationTemplate(NotificationTemplate notificationTemplate, S byte[] contentByteArray = getContentByteArray(notificationTemplate); int contentLength = contentByteArray.length; try (InputStream contentStream = new ByteArrayInputStream(contentByteArray)) { - String insertAppNotificationTemplateSql = isUnicodeSupported ? INSERT_APP_NOTIFICATION_TEMPLATE_SQL : - isHybrid ? INSERT_APP_NOTIFICATION_TEMPLATE_HYBRID_SQL : - INSERT_APP_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; - namedJdbcTemplate.executeInsert(insertAppNotificationTemplateSql, (preparedStatement -> { + namedJdbcTemplate.executeInsert(INSERT_APP_NOTIFICATION_TEMPLATE_SQL, (preparedStatement -> { preparedStatement.setString(TEMPLATE_KEY, locale.toLowerCase()); preparedStatement.setString(LOCALE, locale); - if (isUnicodeSupported) { - preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); - Timestamp currentTime = getCurrentTime(); - preparedStatement.setTimeStamp(CREATED_AT, currentTime, CALENDER); - preparedStatement.setTimeStamp(UPDATED_AT, currentTime, CALENDER); - preparedStatement.setString(VERSION, APP_TEMPLATE_SCHEMA_VERSION); - } else if (isHybrid) { - preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); - preparedStatement.setString(SUBJECT, notificationTemplate.getSubject()); - preparedStatement.setString(BODY, notificationTemplate.getBody()); - preparedStatement.setString(FOOTER, notificationTemplate.getFooter()); - } else { - preparedStatement.setString(SUBJECT, notificationTemplate.getSubject()); - preparedStatement.setString(BODY, notificationTemplate.getBody()); - preparedStatement.setString(FOOTER, notificationTemplate.getFooter()); - } + preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); preparedStatement.setString(CONTENT_TYPE, notificationTemplate.getContentType()); preparedStatement.setString(TYPE_KEY, displayName.toLowerCase()); preparedStatement.setString(CHANNEL, channelName); preparedStatement.setInt(TENANT_ID, tenantId); preparedStatement.setString(APP_ID, applicationUuid); preparedStatement.setInt(TENANT_ID, tenantId); + + Timestamp currentTime = getCurrentTime(); + preparedStatement.setTimeStamp(CREATED_AT, currentTime, CALENDER); + preparedStatement.setTimeStamp(UPDATED_AT, currentTime, CALENDER); + preparedStatement.setString(VERSION, APP_TEMPLATE_SCHEMA_VERSION); }), notificationTemplate, false); } catch (DataAccessException e) { String error = @@ -136,28 +109,10 @@ public NotificationTemplate getNotificationTemplate(String locale, String templa NotificationTemplate notificationTemplate; try { - String getAppNotificationTemplateSql = isUnicodeSupported ? GET_APP_NOTIFICATION_TEMPLATE_SQL : - isHybrid ? GET_APP_NOTIFICATION_TEMPLATE_HYBRID_SQL : - GET_APP_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; - notificationTemplate = namedJdbcTemplate.fetchSingleRecord(getAppNotificationTemplateSql, + notificationTemplate = namedJdbcTemplate.fetchSingleRecord(GET_APP_NOTIFICATION_TEMPLATE_SQL, (resultSet, rowNumber) -> { NotificationTemplate notificationTemplateResult = new NotificationTemplate(); - if (isUnicodeSupported) { - setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); - } else if (isHybrid) { - setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); - if (notificationTemplateResult.getSubject() == null - && notificationTemplateResult.getBody() == null - && notificationTemplateResult.getFooter() == null) { - notificationTemplateResult.setSubject(resultSet.getString(SUBJECT)); - notificationTemplateResult.setBody(resultSet.getString(BODY)); - notificationTemplateResult.setFooter(resultSet.getString(FOOTER)); - } - } else { - notificationTemplateResult.setSubject(resultSet.getString(SUBJECT)); - notificationTemplateResult.setBody(resultSet.getString(BODY)); - notificationTemplateResult.setFooter(resultSet.getString(FOOTER)); - } + setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); notificationTemplateResult.setContentType(resultSet.getString(CONTENT_TYPE)); notificationTemplateResult.setLocale(locale); notificationTemplateResult.setType(templateType); @@ -228,29 +183,10 @@ public List listNotificationTemplates(String templateType, List notificationTemplates; try { - String listAppNotificationTemplatesByAppSql = - isUnicodeSupported ? LIST_APP_NOTIFICATION_TEMPLATES_BY_APP_SQL : - isHybrid ? LIST_APP_NOTIFICATION_TEMPLATES_BY_APP_HYBRID_SQL : - LIST_APP_NOTIFICATION_TEMPLATES_BY_APP_WITHOUT_UNICODE_SQL; - notificationTemplates = namedJdbcTemplate.executeQuery(listAppNotificationTemplatesByAppSql, + notificationTemplates = namedJdbcTemplate.executeQuery(LIST_APP_NOTIFICATION_TEMPLATES_BY_APP_SQL, (resultSet, rowNumber) -> { NotificationTemplate notificationTemplateResult = new NotificationTemplate(); - if (isUnicodeSupported) { - setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); - } else if (isHybrid) { - setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); - if (notificationTemplateResult.getSubject() == null - && notificationTemplateResult.getBody() == null - && notificationTemplateResult.getFooter() == null) { - notificationTemplateResult.setSubject(resultSet.getString(SUBJECT)); - notificationTemplateResult.setBody(resultSet.getString(BODY)); - notificationTemplateResult.setFooter(resultSet.getString(FOOTER)); - } - } else { - notificationTemplateResult.setSubject(resultSet.getString(SUBJECT)); - notificationTemplateResult.setBody(resultSet.getString(BODY)); - notificationTemplateResult.setFooter(resultSet.getString(FOOTER)); - } + setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); notificationTemplateResult.setContentType(resultSet.getString(CONTENT_TYPE)); notificationTemplateResult.setLocale(resultSet.getString(LOCALE)); notificationTemplateResult.setType(templateType.toLowerCase()); @@ -285,24 +221,9 @@ public void updateNotificationTemplate(NotificationTemplate notificationTemplate byte[] contentByteArray = getContentByteArray(notificationTemplate); int contentLength = contentByteArray.length; try (InputStream contentStream = new ByteArrayInputStream(contentByteArray)) { - String updateAppNotificationTemplateSql = isUnicodeSupported ? UPDATE_APP_NOTIFICATION_TEMPLATE_SQL : - isHybrid ? UPDATE_APP_NOTIFICATION_TEMPLATE_HYBRID_SQL : - UPDATE_APP_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; - namedJdbcTemplate.executeUpdate(updateAppNotificationTemplateSql, + namedJdbcTemplate.executeUpdate(UPDATE_APP_NOTIFICATION_TEMPLATE_SQL, preparedStatement -> { - if (isUnicodeSupported) { - preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); - preparedStatement.setTimeStamp(UPDATED_AT, getCurrentTime(), CALENDER); - } else if (isHybrid) { - preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); - preparedStatement.setString(SUBJECT, notificationTemplate.getSubject()); - preparedStatement.setString(BODY, notificationTemplate.getBody()); - preparedStatement.setString(FOOTER, notificationTemplate.getFooter()); - } else { - preparedStatement.setString(SUBJECT, notificationTemplate.getSubject()); - preparedStatement.setString(BODY, notificationTemplate.getBody()); - preparedStatement.setString(FOOTER, notificationTemplate.getFooter()); - } + preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); preparedStatement.setString(CONTENT_TYPE, notificationTemplate.getContentType()); preparedStatement.setString(TEMPLATE_KEY, locale.toLowerCase()); preparedStatement.setString(TYPE_KEY, displayName.toLowerCase()); @@ -311,8 +232,7 @@ public void updateNotificationTemplate(NotificationTemplate notificationTemplate preparedStatement.setString(APP_ID, applicationUuid); preparedStatement.setInt(TENANT_ID, tenantId); - Timestamp currentTime = getCurrentTime(); - preparedStatement.setTimeStamp(UPDATED_AT, currentTime, CALENDER); + preparedStatement.setTimeStamp(UPDATED_AT, getCurrentTime(), CALENDER); }); } catch (DataAccessException e) { String error = diff --git a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/store/dao/OrgNotificationTemplateDAO.java b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/store/dao/OrgNotificationTemplateDAO.java index 46d432af..fca4285b 100644 --- a/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/store/dao/OrgNotificationTemplateDAO.java +++ b/components/email-mgt/org.wso2.carbon.email.mgt/src/main/java/org/wso2/carbon/email/mgt/store/dao/OrgNotificationTemplateDAO.java @@ -33,16 +33,13 @@ import java.sql.Timestamp; import java.util.List; -import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.BODY; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.CHANNEL; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.CONTENT; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.CONTENT_TYPE; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.CREATED_AT; -import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.FOOTER; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.ID; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.LOCALE; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.ORG_TEMPLATE_SCHEMA_VERSION; -import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.SUBJECT; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.TEMPLATE_KEY; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.TENANT_ID; import static org.wso2.carbon.email.mgt.constants.I18nMgtConstants.NotificationTableColumns.TYPE_ID; @@ -52,19 +49,11 @@ import static org.wso2.carbon.email.mgt.constants.SQLConstants.DELETE_ORG_NOTIFICATION_TEMPLATES_BY_TYPE_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.DELETE_ORG_NOTIFICATION_TEMPLATE_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.GET_NOTIFICATION_TYPE_ID_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.GET_ORG_NOTIFICATION_TEMPLATE_HYBRID_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.GET_ORG_NOTIFICATION_TEMPLATE_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.GET_ORG_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.INSERT_ORG_NOTIFICATION_TEMPLATE_HYBRID_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.INSERT_ORG_NOTIFICATION_TEMPLATE_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.INSERT_ORG_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.IS_ORG_NOTIFICATION_TEMPLATE_EXISTS_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.LIST_ORG_NOTIFICATION_TEMPLATES_BY_TYPE_HYBRID_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.LIST_ORG_NOTIFICATION_TEMPLATES_BY_TYPE_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.LIST_ORG_NOTIFICATION_TEMPLATES_BY_TYPE_WITHOUT_UNICODE_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.UPDATE_ORG_NOTIFICATION_TEMPLATE_HYBRID_SQL; import static org.wso2.carbon.email.mgt.constants.SQLConstants.UPDATE_ORG_NOTIFICATION_TEMPLATE_SQL; -import static org.wso2.carbon.email.mgt.constants.SQLConstants.UPDATE_ORG_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; import static org.wso2.carbon.email.mgt.util.I18nEmailUtil.CALENDER; import static org.wso2.carbon.email.mgt.util.I18nEmailUtil.getContentByteArray; import static org.wso2.carbon.email.mgt.util.I18nEmailUtil.getCurrentTime; @@ -76,8 +65,6 @@ public class OrgNotificationTemplateDAO { private static final Log log = LogFactory.getLog(OrgNotificationTemplateDAO.class); - private boolean isUnicodeSupported = I18nMgtDataHolder.getInstance().isUnicodeSupported(); - private boolean isHybrid = I18nMgtDataHolder.getInstance().isHybrid(); private List debugTenants = I18nMgtDataHolder.getInstance().getDebugTenants(); public void addNotificationTemplate(NotificationTemplate notificationTemplate, int tenantId) @@ -91,33 +78,20 @@ public void addNotificationTemplate(NotificationTemplate notificationTemplate, i byte[] contentByteArray = getContentByteArray(notificationTemplate); int contentLength = contentByteArray.length; try (InputStream contentStream = new ByteArrayInputStream(contentByteArray)) { - String insertOrgNotificationTemplateSql = isUnicodeSupported ? INSERT_ORG_NOTIFICATION_TEMPLATE_SQL: - isHybrid ? INSERT_ORG_NOTIFICATION_TEMPLATE_HYBRID_SQL : - INSERT_ORG_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; - namedJdbcTemplate.executeInsert(insertOrgNotificationTemplateSql, (preparedStatement -> { + namedJdbcTemplate.executeInsert(INSERT_ORG_NOTIFICATION_TEMPLATE_SQL, (preparedStatement -> { preparedStatement.setString(TEMPLATE_KEY, locale.toLowerCase()); preparedStatement.setString(LOCALE, locale); - if (isUnicodeSupported) { - preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); - Timestamp currentTime = getCurrentTime(); - preparedStatement.setTimeStamp(CREATED_AT, currentTime, CALENDER); - preparedStatement.setTimeStamp(UPDATED_AT, currentTime, CALENDER); - preparedStatement.setString(VERSION, ORG_TEMPLATE_SCHEMA_VERSION); - } else if (isHybrid) { - preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); - preparedStatement.setString(SUBJECT, notificationTemplate.getSubject()); - preparedStatement.setString(BODY, notificationTemplate.getBody()); - preparedStatement.setString(FOOTER, notificationTemplate.getFooter()); - } else { - preparedStatement.setString(SUBJECT, notificationTemplate.getSubject()); - preparedStatement.setString(BODY, notificationTemplate.getBody()); - preparedStatement.setString(FOOTER, notificationTemplate.getFooter()); - } + preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); preparedStatement.setString(CONTENT_TYPE, notificationTemplate.getContentType()); preparedStatement.setString(TYPE_KEY, displayName.toLowerCase()); preparedStatement.setString(CHANNEL, channelName); preparedStatement.setInt(TENANT_ID, tenantId); preparedStatement.setInt(TENANT_ID, tenantId); + + Timestamp currentTime = getCurrentTime(); + preparedStatement.setTimeStamp(CREATED_AT, currentTime, CALENDER); + preparedStatement.setTimeStamp(UPDATED_AT, currentTime, CALENDER); + preparedStatement.setString(VERSION, ORG_TEMPLATE_SCHEMA_VERSION); }), notificationTemplate, false); } catch (DataAccessException e) { String error = @@ -145,28 +119,10 @@ public NotificationTemplate getNotificationTemplate(String locale, String templa NotificationTemplate notificationTemplate; try { - String getOrgNotificationTemplateSql = isUnicodeSupported ? GET_ORG_NOTIFICATION_TEMPLATE_SQL : - isHybrid ? GET_ORG_NOTIFICATION_TEMPLATE_HYBRID_SQL : - GET_ORG_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; - notificationTemplate = namedJdbcTemplate.fetchSingleRecord(getOrgNotificationTemplateSql, + notificationTemplate = namedJdbcTemplate.fetchSingleRecord(GET_ORG_NOTIFICATION_TEMPLATE_SQL, (resultSet, rowNumber) -> { NotificationTemplate notificationTemplateResult = new NotificationTemplate(); - if (isUnicodeSupported) { - setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); - } else if (isHybrid) { - setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); - if (notificationTemplateResult.getSubject() == null - && notificationTemplateResult.getBody() == null - && notificationTemplateResult.getFooter() == null) { - notificationTemplateResult.setSubject(resultSet.getString(SUBJECT)); - notificationTemplateResult.setBody(resultSet.getString(BODY)); - notificationTemplateResult.setFooter(resultSet.getString(FOOTER)); - } - } else { - notificationTemplateResult.setSubject(resultSet.getString(SUBJECT)); - notificationTemplateResult.setBody(resultSet.getString(BODY)); - notificationTemplateResult.setFooter(resultSet.getString(FOOTER)); - } + setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); notificationTemplateResult.setContentType(resultSet.getString(CONTENT_TYPE)); notificationTemplateResult.setLocale(locale); notificationTemplateResult.setType(templateType); @@ -245,29 +201,10 @@ public List listNotificationTemplates(String templateType, List notificationTemplates; try { - String listOrgNotificationTemplatesByTypeSql = - isUnicodeSupported ? LIST_ORG_NOTIFICATION_TEMPLATES_BY_TYPE_SQL : - isHybrid ? LIST_ORG_NOTIFICATION_TEMPLATES_BY_TYPE_HYBRID_SQL : - LIST_ORG_NOTIFICATION_TEMPLATES_BY_TYPE_WITHOUT_UNICODE_SQL; - notificationTemplates = namedJdbcTemplate.executeQuery(listOrgNotificationTemplatesByTypeSql, + notificationTemplates = namedJdbcTemplate.executeQuery(LIST_ORG_NOTIFICATION_TEMPLATES_BY_TYPE_SQL, (resultSet, rowNumber) -> { NotificationTemplate notificationTemplateResult = new NotificationTemplate(); - if (isUnicodeSupported) { - setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); - } else if (isHybrid) { - setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); - if (notificationTemplateResult.getSubject() == null - && notificationTemplateResult.getBody() == null - && notificationTemplateResult.getFooter() == null) { - notificationTemplateResult.setSubject(resultSet.getString(SUBJECT)); - notificationTemplateResult.setBody(resultSet.getString(BODY)); - notificationTemplateResult.setFooter(resultSet.getString(FOOTER)); - } - } else { - notificationTemplateResult.setSubject(resultSet.getString(SUBJECT)); - notificationTemplateResult.setBody(resultSet.getString(BODY)); - notificationTemplateResult.setFooter(resultSet.getString(FOOTER)); - } + setContent(resultSet.getBinaryStream(CONTENT), notificationTemplateResult); notificationTemplateResult.setContentType(resultSet.getString(CONTENT_TYPE)); notificationTemplateResult.setLocale(resultSet.getString(LOCALE)); notificationTemplateResult.setType(templateType.toLowerCase()); @@ -301,24 +238,9 @@ public void updateNotificationTemplate(NotificationTemplate notificationTemplate byte[] contentByteArray = getContentByteArray(notificationTemplate); int contentLength = contentByteArray.length; try (InputStream contentStream = new ByteArrayInputStream(contentByteArray)) { - String updateOrgNotificationTemplateSql = isUnicodeSupported ? UPDATE_ORG_NOTIFICATION_TEMPLATE_SQL : - isHybrid ? UPDATE_ORG_NOTIFICATION_TEMPLATE_HYBRID_SQL : - UPDATE_ORG_NOTIFICATION_TEMPLATE_WITHOUT_UNICODE_SQL; - namedJdbcTemplate.executeUpdate(updateOrgNotificationTemplateSql, + namedJdbcTemplate.executeUpdate(UPDATE_ORG_NOTIFICATION_TEMPLATE_SQL, preparedStatement -> { - if (isUnicodeSupported) { - preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); - preparedStatement.setTimeStamp(UPDATED_AT, getCurrentTime(), CALENDER); - } else if (isHybrid) { - preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); - preparedStatement.setString(SUBJECT, notificationTemplate.getSubject()); - preparedStatement.setString(BODY, notificationTemplate.getBody()); - preparedStatement.setString(FOOTER, notificationTemplate.getFooter()); - } else { - preparedStatement.setString(SUBJECT, notificationTemplate.getSubject()); - preparedStatement.setString(BODY, notificationTemplate.getBody()); - preparedStatement.setString(FOOTER, notificationTemplate.getFooter()); - } + preparedStatement.setBinaryStream(CONTENT, contentStream, contentLength); preparedStatement.setString(CONTENT_TYPE, notificationTemplate.getContentType()); preparedStatement.setString(TEMPLATE_KEY, locale.toLowerCase()); preparedStatement.setString(TYPE_KEY, displayName.toLowerCase()); @@ -326,8 +248,7 @@ public void updateNotificationTemplate(NotificationTemplate notificationTemplate preparedStatement.setInt(TENANT_ID, tenantId); preparedStatement.setInt(TENANT_ID, tenantId); - Timestamp currentTime = getCurrentTime(); - preparedStatement.setTimeStamp(UPDATED_AT, currentTime, CALENDER); + preparedStatement.setTimeStamp(UPDATED_AT, getCurrentTime(), CALENDER); }); } catch (DataAccessException e) { String error =