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

Introduce B2B Notification Template Inheritance #291

Merged
15 changes: 15 additions & 0 deletions components/email-mgt/org.wso2.carbon.email.mgt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@
<groupId>org.wso2.carbon.utils</groupId>
<artifactId>org.wso2.carbon.database.utils</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.organization.management</groupId>
<artifactId>org.wso2.carbon.identity.organization.resource.hierarchy.traverse.service</artifactId>
</dependency>
<dependency>
<groupId>commons-collections.wso2</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
Expand Down Expand Up @@ -147,6 +155,7 @@
org.apache.axiom.*; version="${axiom.wso2.imp.pkg.version.range}",
org.apache.commons.logging; version="${commons.logging.imp.pkg.version.range}",
org.apache.commons.lang.*; version="${commons-lang.version.range}",
org.apache.commons.collections; version="${commons-collections.wso2.version.range}",

org.osgi.framework; version="${osgi.framework.imp.pkg.version.range}",
org.osgi.service.component; version="${osgi.service.component.imp.pkg.version.range}",
Expand Down Expand Up @@ -174,6 +183,12 @@
version="${org.wso2.identity.organization.mgt.core.imp.pkg.version.range}",
org.wso2.carbon.identity.organization.management.service.exception;
version="${org.wso2.identity.organization.mgt.core.imp.pkg.version.range}",
org.wso2.carbon.identity.organization.resource.hierarchy.traverse.service;
version="${org.wso2.identity.organization.mgt.imp.pkg.version.range}",
org.wso2.carbon.identity.organization.resource.hierarchy.traverse.service.exception;
version="${org.wso2.identity.organization.mgt.imp.pkg.version.range}",
org.wso2.carbon.identity.organization.resource.hierarchy.traverse.service.strategy;
version="${org.wso2.identity.organization.mgt.imp.pkg.version.range}",
</Import-Package>
</instructions>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ default List<EmailTemplate> getEmailTemplateType(String templateDisplayName, Str
}

/**
* @deprecated Use {@link #getEmailTemplateType(String, String, String, boolean)} instead.
* <p>
* Get all email templates of a specific template type for an application, from tenant registry.
*
* @param templateDisplayName Email template type displace name.
Expand All @@ -137,12 +139,40 @@ default List<EmailTemplate> getEmailTemplateType(String templateDisplayName, Str
* @return A list of email templates that matches to the provided template type.
* @throws I18nEmailMgtException if an error occurred.
*/
@Deprecated
default List<EmailTemplate> getEmailTemplateType(
String templateDisplayName, String tenantDomain, String applicationUuid) throws I18nEmailMgtException {

throw new I18nEmailMgtException("Method not implemented");
}

/**
* Retrieves all email templates of a specific type for a given tenant and application UUID.
* <p>
* This method validates and fetches email templates based on the specified type. The behavior of the method
* depends on the {@code resolve} parameter:
* <ul>
* <li><b>Resolved Template (resolve = true):</b> Retrieves the templates resolved through the ancestor
* organization hierarchy.</li>
* <li><b>Current org's or app's template (resolve = false):</b> Retrieves the templates specific to the
* current organization or application.</li>
* </ul>
*
* @param templateDisplayName the display name of the email template type (e.g., "Welcome Email").
* @param tenantDomain the tenant domain of the organization to retrieve the template from.
* @param applicationUuid the UUID of the application associated with the template.
* @param resolve a flag indicating whether to retrieve resolved template ({@code true}) or template
* specific to the current organization or application ({@code false}).
* @return a list of {@link EmailTemplate} objects matching the specified type and criteria.
* @throws I18nEmailMgtException if any unexpected error occurs while retrieving email templates.
*/
default List<EmailTemplate> getEmailTemplateType(String templateDisplayName, String tenantDomain,
String applicationUuid, boolean resolve)
throws I18nEmailMgtException {

throw new I18nEmailMgtException("getEmailTemplateType method not implemented in " + this.getClass().getName());
}

/**
* Get all available email templates in a tenant's registry.
*
Expand Down Expand Up @@ -220,6 +250,8 @@ void deleteEmailTemplate(String templateTypeName,
String applicationUuid) throws I18nEmailMgtException;

/**
* @deprecated Use {@link #getEmailTemplate(String, String, String, String, boolean)} instead.
* <p>
* Get an email template from tenant registry with application UUID.
*
* @param templateType Email template type.
Expand All @@ -229,12 +261,42 @@ void deleteEmailTemplate(String templateTypeName,
* @return Email template of the application with fallback to organization template.
* @throws I18nEmailMgtException If an error occurred while getting the email template.
*/
@Deprecated
EmailTemplate getEmailTemplate(String templateType,
String locale,
String tenantDomain,
String applicationUuid) throws I18nEmailMgtException;

/**
* Retrieves an email template for a specified type, locale, tenant domain, and application UUID.
* <p>
* This method resolves and retrieves an email template based on the provided parameters. The behavior is
* dependent on the {@code resolve} parameter:
* <ul>
* <li><b>Resolved template (resolve = true):</b> Retrieves the template resolved through the ancestor
* organization hierarchy.</li>
* <li><b>Current org's or app's template (resolve = false):</b> Retrieves the template specific to the
* current organization or application only.</li>
* </ul>
*
* @param templateType the type of the email template.
* @param locale the locale of the email template (e.g., "en_US").
* @param tenantDomain the tenant domain of the organization to retrieve the template from.
* @param applicationUuid the UUID of the application associated with the template.
* @param resolve a flag indicating whether to retrieve resolved template ({@code true}) or template
* specific to the current organization or application ({@code false}).
* @return the {@link EmailTemplate} matching the specified criteria.
* @throws I18nEmailMgtException if any unexpected error occurs while retrieving email template.
*/
default EmailTemplate getEmailTemplate(String templateType, String locale, String tenantDomain,
String applicationUuid, boolean resolve) throws I18nEmailMgtException {

throw new I18nEmailMgtException("getEmailTemplate method not implemented in " + this.getClass().getName());
}

/**
* @deprecated Use {@link #isEmailTemplateExists(String, String, String, String, boolean)} instead.
* <p>
* Check whether the given email template type exists for the application.
*
* @param templateTypeDisplayName Display name of the template type.
Expand All @@ -244,9 +306,28 @@ EmailTemplate getEmailTemplate(String templateType,
* @return True if the template type exists, false otherwise.
* @throws I18nEmailMgtException If an error occurred while checking the existence of the email template.
*/
@Deprecated
default boolean isEmailTemplateExists(String templateTypeDisplayName, String locale,
String tenantDomain, String applicationUuid) throws I18nEmailMgtException {

throw new I18nEmailMgtException("Method not implemented");
}

/**
* Checks if an email template exists for the specified template type, locale, tenant domain, and application UUID.
*
* @param templateTypeDisplayName The display name of the template type.
* @param locale The locale of the email template.
* @param tenantDomain The tenant domain in which to search for the template.
* @param applicationUuid The UUID of the application for which the template exists (optional).
* @param resolve If true, searches for the template by resolving through the organization
* hierarchy; if false, searches only within the specified tenant domain.
* @return True if the email template exists; false otherwise.
* @throws I18nEmailMgtException If an error occurs while checking the existence of the email template.
*/
default boolean isEmailTemplateExists(String templateTypeDisplayName, String locale, String tenantDomain,
String applicationUuid, boolean resolve) throws I18nEmailMgtException {

throw new I18nEmailMgtException("isEmailTemplateExists method not implemented in " + this.getClass().getName());
}
}
Loading
Loading