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 1 commit
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,124 @@
*/
public interface NotificationTemplateManager {


/**
* Add a new notification template to the system (db/ registry).
*
* @param notificationChannel Notification channel
* @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 {

}

/**
* Add a new notification template to the system (db/ registry).
*
* @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 {

}

/**
* 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;
}

/**
* Delete a notification template type from the tenant registry.
*
* @param notificationChannel Notification channel.
* @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 whether the given notification template type exists in the system.
*
* @param notificationChannel Notification channel.
* @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;
}

/**
* Get all available notification template types for the tenant.
*
* @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;
}

/**
* 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;
}

/**
* 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;
}

/**
* Return the notification template from the tenant registry which matches the given channel and template name.
*
Expand Down Expand Up @@ -61,7 +179,7 @@ default NotificationTemplate getNotificationTemplate(String notificationChannel,
}

/**
* 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 +192,7 @@ default void addNotificationTemplate(NotificationTemplate notificationTemplate,
}

/**
* Add the notification template to the registry.
* Add the notification template.
*
* @param notificationTemplate Notification template.
* @param tenantDomain Tenant domain.
Expand All @@ -87,14 +205,59 @@ default void addNotificationTemplate(NotificationTemplate notificationTemplate,
}

/**
* 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 addNotificationTemplateType(String displayName, String notificationChannel, String tenantDomain)
default void updateNotificationTemplate(NotificationTemplate notificationTemplate, String tenantDomain)
throws NotificationTemplateManagerException {

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

/**
* 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 {

}

/**
* 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 {

}


/**
* 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 deleteNotificationTemplate(String notificationChannel, String templateDisplayName, String locale,
String tenantDomain, String applicationUuid)
throws NotificationTemplateManagerException {

}
Expand Down Expand Up @@ -124,17 +287,34 @@ default List<NotificationTemplate> getDefaultNotificationTemplates(String notifi
}

/**
* 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 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.
* @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 void addNotificationTemplateType(String displayName, String notificationChannel,
String tenantDomain, String applicationUuid)
default boolean isNotificationTemplateExists(String notificationChannel, String templateDisplayName, String locale,
String tenantDomain)
throws NotificationTemplateManagerException {

return false;
}

/**
* 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;
}
}
Loading