Class MailApi


  • @RestController
    @RequestMapping("/api/mail")
    @CrossOrigin
    public class MailApi
    extends SecureApi
    The MailApi class.
    Author:
    Marcus Portmann
    • Constructor Detail

      • MailApi

        public MailApi​(org.springframework.context.ApplicationContext applicationContext,
                       IMailService mailService)
        Constructs a new MailRestController.
        Parameters:
        applicationContext - the Spring application context
        mailService - 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.ServiceUnavailableException
        Create the new mail template.
        Parameters:
        mailTemplate - the mail template to create
        Throws:
        africa.absa.inception.core.service.InvalidArgumentException - if an argument is invalid
        DuplicateMailTemplateException - if the mail template already exists
        africa.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.ServiceUnavailableException
        Delete the mail template.
        Parameters:
        mailTemplateId - the ID for the mail template
        Throws:
        africa.absa.inception.core.service.InvalidArgumentException - if an argument is invalid
        MailTemplateNotFoundException - if the mail template could not be found
        africa.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.ServiceUnavailableException
        Retrieve 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 invalid
        MailTemplateNotFoundException - if the mail template could not be found
        africa.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.ServiceUnavailableException
        Retrieve 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 invalid
        MailTemplateNotFoundException - if the mail template could not be found
        africa.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.ServiceUnavailableException
        Retrieve 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.ServiceUnavailableException
        Retrieve 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.ServiceUnavailableException
        Update the mail template.
        Parameters:
        mailTemplateId - the ID for the mail template
        mailTemplate - the mail template
        Throws:
        africa.absa.inception.core.service.InvalidArgumentException - if an argument is invalid
        MailTemplateNotFoundException - if the mail template could not be found
        africa.absa.inception.core.service.ServiceUnavailableException - if the mail template could not be updated