Skip to content
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

[Notification Template API] Add notification template management functions #832

Merged
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2019-2024, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,6 +25,137 @@
*/
public interface NotificationTemplateManager {


/**
* Add new notification template type to the system.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param displayName Notification template display name
* @param tenantDomain Tenant domain
* @throws NotificationTemplateManagerException If an error occurred while adding the template to the registry
*/
default void addNotificationTemplateType(String notificationChannel, String displayName, String tenantDomain)
throws NotificationTemplateManagerException {

}

Check warning on line 40 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L40

Added line #L40 was not covered by tests

/**
* Add new notification template type to the system.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param displayName Notification template display name.
* @param tenantDomain Tenant domain.
* @param applicationUuid Application UUID.
* @throws NotificationTemplateManagerException If an error occurred while adding the template to the registry.
*/
default void addNotificationTemplateType(String notificationChannel, String displayName,
RushanNanayakkara marked this conversation as resolved.
Show resolved Hide resolved
String tenantDomain, String applicationUuid)
throws NotificationTemplateManagerException {

}

Check warning on line 55 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L55

Added line #L55 was not covered by tests

/**
* Get all available notification template types for the tenant.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param tenantDomain Tenant domain.
* @return List of notification template types.
* @throws NotificationTemplateManagerException If an error occurred while getting the notification template types.
*/
default List<String> getAllNotificationTemplateTypes(String notificationChannel, String tenantDomain)
throws NotificationTemplateManagerException {

return null;

Check warning on line 68 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L68

Added line #L68 was not covered by tests
}

/**
* Delete a notification template type from the tenant registry.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param templateDisplayName Display name of the template type.
* @param tenantDomain Tenant domain.
* @throws NotificationTemplateManagerException If an error occurred while deleting the notification template type.
*/
default void deleteNotificationTemplateType(String notificationChannel, String templateDisplayName,
String tenantDomain)
throws NotificationTemplateManagerException {

}

Check warning on line 83 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L83

Added line #L83 was not covered by tests

/**
* Check whether the given notification template type exists in the system.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param templateTypeDisplayName Display name of the template type.
* @param tenantDomain Tenant Domain.
* @throws NotificationTemplateManagerException If an error occurred while checking if template type exists.
*/
default boolean isNotificationTemplateTypeExists(String notificationChannel, String templateTypeDisplayName,
String tenantDomain)
throws NotificationTemplateManagerException {

return false;

Check warning on line 97 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L97

Added line #L97 was not covered by tests
}

/**
* Resets the template type in the database by deleting of all it's user defined templates.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param templateType Display name of the template.
* @param tenantDomain Tenant domain.
* @throws NotificationTemplateManagerException If an error occurred while resetting the notification template type.
*/
default void resetNotificationTemplateType(String notificationChannel, String templateType, String tenantDomain)
throws NotificationTemplateManagerException {

}

Check warning on line 111 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L111

Added line #L111 was not covered by tests

/**
* Get all available notification template types in the tenant for a given notification channel.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param tenantDomain Tenant domain.
* @throws NotificationTemplateManagerException If an error occurred while getting the notification template types.
*/
default List<NotificationTemplate> getAllNotificationTemplates(String notificationChannel, String tenantDomain)
throws NotificationTemplateManagerException {

return null;

Check warning on line 123 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L123

Added line #L123 was not covered by tests
}

/**
* Get all notification templates of the given type.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param templateDisplayName Display name of the template.
* @param tenantDomain Tenant domain.
* @return List of notification templates.
* @throws NotificationTemplateManagerException If an error occurred while getting the notification templates.
*/
default List<NotificationTemplate> getNotificationTemplatesOfType(String notificationChannel,
String templateDisplayName, String tenantDomain)
throws NotificationTemplateManagerException {

return null;

Check warning on line 139 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L139

Added line #L139 was not covered by tests
}

/**
* Get all notification templates of the given type.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param templateDisplayName Display name of the template.
* @param tenantDomain Tenant domain.
* @param applicationUuid Application UUID.
* @return List of notification templates.
* @throws NotificationTemplateManagerException If an error occurred while getting the notification templates.
*/
default List<NotificationTemplate> getNotificationTemplatesOfType(String notificationChannel,
String templateDisplayName, String tenantDomain, String applicationUuid)
throws NotificationTemplateManagerException {

return null;

Check warning on line 156 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L156

Added line #L156 was not covered by tests
}

/**
* Return the notification template from the tenant registry which matches the given channel and template name.
*
Expand Down Expand Up @@ -61,7 +192,7 @@
}

/**
* Add the notification template to the registry.
* Add the notification template.
*
* @param notificationTemplate Notification template
* {@link org.wso2.carbon.identity.governance.model.NotificationTemplate}
Expand All @@ -74,7 +205,7 @@
}

/**
* Add the notification template to the registry.
* Add the notification template.
*
* @param notificationTemplate Notification template.
* @param tenantDomain Tenant domain.
Expand All @@ -87,14 +218,59 @@
}

/**
* Add a new notification template to the registry to the corresponding notification channel root directory.
* Update notification template.
*
* @param displayName Notification template display name
* @param notificationChannel Notification channel
* @param tenantDomain Tenant domain
* @throws NotificationTemplateManagerException If an error occurred while adding the template to the registry
* @param notificationTemplate Notification template
* {@link org.wso2.carbon.identity.governance.model.NotificationTemplate}
* @param tenantDomain Tenant domain
* @throws NotificationTemplateManagerException If an error occurred while updating the notification template
*/
default void updateNotificationTemplate(NotificationTemplate notificationTemplate, String tenantDomain)
throws NotificationTemplateManagerException {

RushanNanayakkara marked this conversation as resolved.
Show resolved Hide resolved
}

Check warning on line 231 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L231

Added line #L231 was not covered by tests

/**
* Update notification template of application.
*
* @param notificationTemplate Notification template.
* @param tenantDomain Tenant domain.
* @param applicationUuid Application UUID.
* @throws NotificationTemplateManagerException If an error occurred while updating the notification template.
*/
default void updateNotificationTemplate(NotificationTemplate notificationTemplate, String tenantDomain,
String applicationUuid) throws NotificationTemplateManagerException {

}

Check warning on line 244 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L244

Added line #L244 was not covered by tests

/**
* Delete a notification template from the system.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param templateDisplayName Display name of the template.
* @param locale Locale of the template.
* @param tenantDomain Tenant domain.
* @throws NotificationTemplateManagerException If an error occurred while deleting the notification template.
*/
default void deleteNotificationTemplate(String notificationChannel, String templateDisplayName, String locale,
String tenantDomain)
throws NotificationTemplateManagerException {

}

Check warning on line 259 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L259

Added line #L259 was not covered by tests


/**
* Delete an application notification template from the system.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param templateDisplayName Display name of the template.
* @param locale Locale of the template.
* @param tenantDomain Tenant domain.
* @param applicationUuid Application UUID.
* @throws NotificationTemplateManagerException If an error occurred while deleting the notification template.
*/
default void addNotificationTemplateType(String displayName, String notificationChannel, String tenantDomain)
default void deleteNotificationTemplate(String notificationChannel, String templateDisplayName, String locale,
String tenantDomain, String applicationUuid)
throws NotificationTemplateManagerException {

}
Expand Down Expand Up @@ -125,17 +301,62 @@
}

/**
* Add a new notification template to the registry to the corresponding notification channel root directory.
* Check whether the given notification template exists in the system.
*
* @param notificationChannel Notification channel.
* @param templateDisplayName Display name of the template.
* @param tenantDomain Tenant Domain.
* @throws NotificationTemplateManagerException If an error occurred while checking if template type exists.
*/
default boolean isNotificationTemplateExists(String notificationChannel, String templateDisplayName, String locale,
String tenantDomain)
throws NotificationTemplateManagerException {

return false;

Check warning on line 315 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L315

Added line #L315 was not covered by tests
}

/**
* Check whether the given notification template exists in the system.
*
* @param notificationChannel Notification channel.
* @param templateDisplayName Display name of the template.
* @param tenantDomain Tenant Domain.
* @param applicationUuid Application UUID.
* @return True if the template exists, false otherwise.
* @throws NotificationTemplateManagerException If an error occurred while checking if template type exists.
*/
default boolean isNotificationTemplateExists(String notificationChannel, String templateDisplayName, String locale,
String tenantDomain, String applicationUuid)
throws NotificationTemplateManagerException {

return false;

Check warning on line 332 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L332

Added line #L332 was not covered by tests
}

/**
* Get all available system notification templates of given type.
*
* @param displayName Notification template display name.
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @param tenantDomain Tenant domain.
* @param applicationUuid Application UUID.
* @throws NotificationTemplateManagerException If an error occurred while adding the template to the registry.
* @return List of system notification templates.
*/
default void addNotificationTemplateType(String displayName, String notificationChannel,
String tenantDomain, String applicationUuid)
default List<NotificationTemplate> getAllSystemNotificationTemplatesOfType(String notificationChannel,
String templateDisplayName) throws NotificationTemplateManagerException {

return null;

Check warning on line 344 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L344

Added line #L344 was not covered by tests
}

/**
* Return the default system notification template which matches the given channel and template name.
*
* @param notificationChannel Notification Channel Name (Eg: SMS or EMAIL)
* @param templateType Display name of the template
* @param locale Locale
* @return Return {@link org.wso2.carbon.identity.governance.model.NotificationTemplate} object
* @throws NotificationTemplateManagerException If an error occurred while getting the notification template
*/
default NotificationTemplate getSystemNotificationTemplate(String notificationChannel, String templateType,
String locale)
throws NotificationTemplateManagerException {

return null;

Check warning on line 360 in components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java

View check run for this annotation

Codecov / codecov/patch

components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/service/notification/NotificationTemplateManager.java#L360

Added line #L360 was not covered by tests
}
}
Loading