-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DB Based Template Management Support #227
Conversation
} | ||
|
||
try { | ||
notificationScenarioDAO.addNotificationScenario(emailTemplateTypeDisplayName, emailTemplateTypeDisplayName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we passing the same param twice since the UUID decision is pending?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improved with https://github.com/wso2-extensions/identity-event-handler-notification/pull/230/files#diff-f5880581b13fef821d04c7ace573dfa7cd6d418e6c21868874e841d674c2e065R42. First parameter used as the (case-insensitive) key and second parameter used as the display name.
|
@@ -232,4 +245,203 @@ public static String prependOperationScenarioToErrorCode(String exceptionErrorCo | |||
} | |||
return exceptionErrorCode; | |||
} | |||
|
|||
public static List<EmailTemplate> convertToEmailTemplates(List<NotificationTemplate> notificationTemplates) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a doc comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String[] whiteListPatterns = {TEMPLATE_REGEX_KEY}; | ||
String[] blackListPatterns = {REGISTRY_INVALID_CHARS}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we change the variable names here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with: bb2c28d
throw new NotificationTemplateManagerClientException(errorCode, | ||
I18nMgtConstants.ErrorMessages.ERROR_CODE_EMPTY_LOCALE.getMessage()); | ||
} | ||
// Regex check for registry invalid chars. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we move out of registry, these lines might not make sense. Though the allowed characters still makes sense, at some point we have to update the comments, variables and constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.. Since the current implementation has a registry based impl, it will be better to keep this.. But this has to be removed when we totally remove the registry dependency. Will keep track this as a part of that task.
@@ -428,6 +433,10 @@ | |||
<carbon.kernel.carbon.base.pkg.version>[1.0.0, 2.0.0)</carbon.kernel.carbon.base.pkg.version> | |||
<axis2.osgi.version.range>[1.6.1, 2.0.0)</axis2.osgi.version.range> | |||
|
|||
<!--Carbon Database Utils Version--> | |||
<org.wso2.carbon.database.utils.version>2.1.0</org.wso2.carbon.database.utils.version> | |||
<org.wso2.carbon.database.utils.version.range>[2.0.0,2.2.0)</org.wso2.carbon.database.utils.version.range> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to the 2.1.0 version, shall we restrict the range to start with 2.1.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Register EmailTemplateManagerImpl. | ||
ServiceRegistration notificationManagerSR = bundleCtx | ||
.registerService(NotificationTemplateManager.class.getName(), emailTemplateManager, null); | ||
.registerService(NotificationTemplateManager.class.getName(), notificationManager, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EmailTemplateManagerImpl implementes both EmailTemplateManager and NotificationTemplateManager interfaces. Does it makes sense anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.. As of now these both needs to be implemented since NotificationTemplateManager
don't have enough functionalities to deprecate the EmailTemplateManager
and EmailTemplateManager
is not general enough to handle different notification channel types.
This is mainly due to NotificationTemplate management is not fully complete. We will have to work on wso2/product-is#9762 and get NotificationTemplateManager
improved to have all needed functionalities and retire EmailTemplateManager
..
At that point it should be possible to EmailTemplateManagerImpl
to implement only NotificationTemplateManager
.. or even more general terms move out from EmailTemplateManagerImpl
by having more general notification management service.
@@ -37,8 +37,8 @@ private I18nMgtConstants() {} | |||
public static final String SMS_CONF_DIRECTORY = "sms"; | |||
public static final String EMAIL_ADMIN_CONF_FILE = "email-admin-config.xml"; | |||
public static final String SMS_TEMPLAE_ADMIN_CONF_FILE = "sms-templates-admin-config.xml"; | |||
public static final String DEFAULT_EMAIL_LOCALE = "en_us"; | |||
public static final String DEFAULT_SMS_NOTIFICATION_LOCALE = "en_us"; | |||
public static final String DEFAULT_EMAIL_LOCALE = "en_US"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will there be any impact in changing these constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change no longer needed with new impl: #230
Proposed changes in this pull request
$subject
When should this PR be merged
[Please describe any preconditions that need to be addressed before we
can merge this pull request.]
Follow up actions
[List any possible follow-up actions here; for instance, testing data
migrations, software that we need to install on staging and production
environments.]
Checklist (for reviewing)
General
Functionality
Code
Tests
Security
Documentation