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
Show file tree
Hide file tree
Changes from all 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,18 +1,21 @@
/*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2019-2024, WSO2 LLC. (http://www.wso2.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.identity.governance.service.notification;

import org.wso2.carbon.identity.governance.exceptions.notiification.NotificationTemplateManagerException;
Expand All @@ -25,6 +28,142 @@
*/
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 {

throw new UnsupportedOperationException("Not implemented yet");
}

/**
* 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.
*/
@Deprecated
default void addNotificationTemplateType(String notificationChannel, String displayName,
RushanNanayakkara marked this conversation as resolved.
Show resolved Hide resolved
String tenantDomain, String applicationUuid)
throws NotificationTemplateManagerException {

throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}

/**
* Return the notification template from the tenant registry which matches the given channel and template name.
*
Expand All @@ -39,7 +178,7 @@ default NotificationTemplate getNotificationTemplate(String notificationChannel,
String tenantDomain)
throws NotificationTemplateManagerException {

return null;
throw new UnsupportedOperationException("Not implemented yet");
}

/**
Expand All @@ -57,11 +196,11 @@ default NotificationTemplate getNotificationTemplate(String notificationChannel,
String tenantDomain, String applicationUuid)
throws NotificationTemplateManagerException {

return null;
throw new UnsupportedOperationException("Not implemented yet");
}

/**
* 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 @@ -71,10 +210,11 @@ default NotificationTemplate getNotificationTemplate(String notificationChannel,
default void addNotificationTemplate(NotificationTemplate notificationTemplate, String tenantDomain)
throws NotificationTemplateManagerException {

throw new UnsupportedOperationException("Not implemented yet");
}

/**
* Add the notification template to the registry.
* Add the notification template.
*
* @param notificationTemplate Notification template.
* @param tenantDomain Tenant domain.
Expand All @@ -84,19 +224,69 @@ default void addNotificationTemplate(NotificationTemplate notificationTemplate,
default void addNotificationTemplate(NotificationTemplate notificationTemplate, String tenantDomain,
String applicationUuid) throws NotificationTemplateManagerException {

throw new UnsupportedOperationException("Not implemented yet");
}

/**
* 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
throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}


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

throw new UnsupportedOperationException("Not implemented yet");
}

/**
Expand All @@ -111,6 +301,7 @@ default void addNotificationTemplateType(String displayName, String notification
default void addDefaultNotificationTemplates(String notificationChannel, String tenantDomain)
throws NotificationTemplateManagerException {

throw new UnsupportedOperationException("Not implemented yet");
}

/**
Expand All @@ -121,21 +312,66 @@ default void addDefaultNotificationTemplates(String notificationChannel, String
*/
default List<NotificationTemplate> getDefaultNotificationTemplates(String notificationChannel) {

return null;
throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}

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

throw new UnsupportedOperationException("Not implemented yet");
}
}
Loading
Loading