Package africa.absa.inception.mail
Class MailApi
- java.lang.Object
-
- africa.absa.inception.api.SecureApi
-
- africa.absa.inception.mail.MailApi
-
@RestController @RequestMapping("/api/mail") @CrossOrigin public class MailApi extends SecureApiThe MailApi class.- Author:
- Marcus Portmann
-
-
Constructor Summary
Constructors Constructor Description MailApi(org.springframework.context.ApplicationContext applicationContext, IMailService mailService)Constructs a new MailRestController.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateMailTemplate(MailTemplate mailTemplate)Create the new mail template.voiddeleteMailTemplate(String mailTemplateId)Delete the mail template.MailTemplategetMailTemplate(String mailTemplateId)Retrieve the mail template.StringgetMailTemplateName(String mailTemplateId)Retrieve the name of the mail template.List<MailTemplate>getMailTemplates()Retrieve the mail templates.List<MailTemplateSummary>getMailTemplateSummaries()Retrieve the mail template summaries.voidupdateMailTemplate(String mailTemplateId, MailTemplate mailTemplate)Update the mail template.-
Methods inherited from class africa.absa.inception.api.SecureApi
getLongValuesForAuthoritiesWithPrefix, getUUIDValuesForAuthoritiesWithPrefix, getValueForAuthorityWithPrefix, getValuesForAuthoritiesWithPrefix, hasAccessToFunction, hasAccessToTenant, hasAuthority, hasRole, inDebugMode, isSecurityDisabled, isSecurityEnabled
-
-
-
-
Constructor Detail
-
MailApi
public MailApi(org.springframework.context.ApplicationContext applicationContext, IMailService mailService)Constructs a new MailRestController.- Parameters:
applicationContext- the Spring application contextmailService- the Mail Service
-
-
Method Detail
-
createMailTemplate
@RequestMapping(value="/mail-templates", method=POST, produces="application/json") @ResponseStatus(NO_CONTENT) @PreAuthorize("isSecurityDisabled() or hasRole(\'Administrator\') or hasAuthority(\'FUNCTION_Mail.MailTemplateAdministration\')") public void createMailTemplate(@RequestBody MailTemplate mailTemplate) throws africa.absa.inception.core.service.InvalidArgumentException, DuplicateMailTemplateException, africa.absa.inception.core.service.ServiceUnavailableExceptionCreate the new mail template.- Parameters:
mailTemplate- the mail template to create- Throws:
africa.absa.inception.core.service.InvalidArgumentException- if an argument is invalidDuplicateMailTemplateException- if the mail template already existsafrica.absa.inception.core.service.ServiceUnavailableException- if the mail template could not be created
-
deleteMailTemplate
@RequestMapping(value="/mail-templates/{mailTemplateId}", method=DELETE, produces="application/json") @ResponseStatus(NO_CONTENT) @PreAuthorize("isSecurityDisabled() or hasRole(\'Administrator\') or hasAuthority(\'FUNCTION_Mail.MailTemplateAdministration\')") public void deleteMailTemplate(@PathVariable String mailTemplateId) throws africa.absa.inception.core.service.InvalidArgumentException, MailTemplateNotFoundException, africa.absa.inception.core.service.ServiceUnavailableExceptionDelete the mail template.- Parameters:
mailTemplateId- the ID for the mail template- Throws:
africa.absa.inception.core.service.InvalidArgumentException- if an argument is invalidMailTemplateNotFoundException- if the mail template could not be foundafrica.absa.inception.core.service.ServiceUnavailableException- if the mail template could not be deleted
-
getMailTemplate
@RequestMapping(value="/mail-templates/{mailTemplateId}", method=GET, produces="application/json") @ResponseStatus(OK) @PreAuthorize("isSecurityDisabled() or hasRole(\'Administrator\') or hasAuthority(\'FUNCTION_Mail.MailTemplateAdministration\')") public MailTemplate getMailTemplate(@PathVariable String mailTemplateId) throws africa.absa.inception.core.service.InvalidArgumentException, MailTemplateNotFoundException, africa.absa.inception.core.service.ServiceUnavailableExceptionRetrieve the mail template.- Parameters:
mailTemplateId- the ID for the mail template- Returns:
- the mail template
- Throws:
africa.absa.inception.core.service.InvalidArgumentException- if an argument is invalidMailTemplateNotFoundException- if the mail template could not be foundafrica.absa.inception.core.service.ServiceUnavailableException- if the mail template could not be retrieved
-
getMailTemplateName
@RequestMapping(value="/mail-templates/{mailTemplateId}/name", method=GET, produces="application/json") @ResponseStatus(OK) @PreAuthorize("isSecurityDisabled() or hasRole(\'Administrator\') or hasAuthority(\'FUNCTION_Mail.MailTemplateAdministration\')") public String getMailTemplateName(@PathVariable String mailTemplateId) throws africa.absa.inception.core.service.InvalidArgumentException, MailTemplateNotFoundException, africa.absa.inception.core.service.ServiceUnavailableExceptionRetrieve the name of the mail template.- Parameters:
mailTemplateId- the ID for the mail template- Returns:
- the name of the mail template
- Throws:
africa.absa.inception.core.service.InvalidArgumentException- if an argument is invalidMailTemplateNotFoundException- if the mail template could not be foundafrica.absa.inception.core.service.ServiceUnavailableException- if the name of the mail template could not be retrieved
-
getMailTemplateSummaries
@RequestMapping(value="/mail-template-summaries", method=GET, produces="application/json") @ResponseStatus(OK) @PreAuthorize("isSecurityDisabled() or hasRole(\'Administrator\') or hasAuthority(\'FUNCTION_Mail.MailTemplateAdministration\')") public List<MailTemplateSummary> getMailTemplateSummaries() throws africa.absa.inception.core.service.ServiceUnavailableExceptionRetrieve the mail template summaries.- Returns:
- the mail template summaries
- Throws:
africa.absa.inception.core.service.ServiceUnavailableException- if the mail template summaries could not be retrieved
-
getMailTemplates
@RequestMapping(value="/mail-templates", method=GET, produces="application/json") @ResponseStatus(OK) @PreAuthorize("isSecurityDisabled() or hasRole(\'Administrator\') or hasAuthority(\'FUNCTION_Mail.MailTemplateAdministration\')") public List<MailTemplate> getMailTemplates() throws africa.absa.inception.core.service.ServiceUnavailableExceptionRetrieve the mail templates.- Returns:
- the mail templates
- Throws:
africa.absa.inception.core.service.ServiceUnavailableException- if the mail templates could not be retrieved
-
updateMailTemplate
@RequestMapping(value="/mail-templates/{mailTemplateId}", method=PUT, produces="application/json") @ResponseStatus(NO_CONTENT) @PreAuthorize("isSecurityDisabled() or hasRole(\'Administrator\') or hasAuthority(\'FUNCTION_Mail.MailTemplateAdministration\')") public void updateMailTemplate(@PathVariable String mailTemplateId, @RequestBody MailTemplate mailTemplate) throws africa.absa.inception.core.service.InvalidArgumentException, MailTemplateNotFoundException, africa.absa.inception.core.service.ServiceUnavailableExceptionUpdate the mail template.- Parameters:
mailTemplateId- the ID for the mail templatemailTemplate- the mail template- Throws:
africa.absa.inception.core.service.InvalidArgumentException- if an argument is invalidMailTemplateNotFoundException- if the mail template could not be foundafrica.absa.inception.core.service.ServiceUnavailableException- if the mail template could not be updated
-
-