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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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,136 @@
*/
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 {

}

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 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,
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.
* @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.
* @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
}

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

Check warning on line 110 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#L110

Added line #L110 was not covered by tests
}

/**
* Get all available system notification templates of given type.
*
* @param notificationChannel Notification channel (Eg: SMS, EMAIL).
* @return List of system notification templates.
*/
default List<NotificationTemplate> getAllSystemNotificationTemplatesOfType(String notificationChannel,
String templateDisplayName) throws NotificationTemplateManagerException {

return null;

Check warning on line 122 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#L122

Added line #L122 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 138 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#L138

Added line #L138 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 155 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#L155

Added line #L155 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 +191,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 +204,7 @@
}

/**
* Add the notification template to the registry.
* Add the notification template.
*
* @param notificationTemplate Notification template.
* @param tenantDomain Tenant domain.
Expand All @@ -87,14 +217,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 {

}

Check warning on line 230 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#L230

Added line #L230 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 243 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#L243

Added line #L243 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 addNotificationTemplateType(String displayName, String notificationChannel, String tenantDomain)
default void deleteNotificationTemplate(String notificationChannel, String templateDisplayName, String locale,
String tenantDomain)
throws NotificationTemplateManagerException {

}

Check warning on line 258 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#L258

Added line #L258 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 deleteNotificationTemplate(String notificationChannel, String templateDisplayName, String locale,
String tenantDomain, String applicationUuid)
throws NotificationTemplateManagerException {

}
Expand Down Expand Up @@ -125,17 +300,50 @@
}

/**
* Add a new notification template to the registry to the corresponding notification channel root directory.
* Return the default system notification template which matches the given channel and template name.
*
* @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 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 void addNotificationTemplateType(String displayName, String notificationChannel,
String tenantDomain, String applicationUuid)
default NotificationTemplate getSystemNotificationTemplate(String notificationChannel, String templateType,
String locale)
throws NotificationTemplateManagerException {

return null;

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.
* @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 330 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#L330

Added line #L330 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 347 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#L347

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