Search in sources :

Example 6 with MailTemplate

use of org.apache.syncope.core.persistence.api.entity.MailTemplate in project syncope by apache.

the class JPAMailTemplateDAO method delete.

@Override
public void delete(final String key) {
    MailTemplate template = find(key);
    if (template == null) {
        return;
    }
    entityManager().remove(template);
}
Also used : JPAMailTemplate(org.apache.syncope.core.persistence.jpa.entity.JPAMailTemplate) MailTemplate(org.apache.syncope.core.persistence.api.entity.MailTemplate)

Example 7 with MailTemplate

use of org.apache.syncope.core.persistence.api.entity.MailTemplate in project syncope by apache.

the class MailTemplateTest method save.

@Test
public void save() {
    MailTemplate template = entityFactory.newEntity(MailTemplate.class);
    template.setKey("new");
    template.setTextTemplate("Text template");
    MailTemplate actual = mailTemplateDAO.save(template);
    assertNotNull(actual);
    assertNotNull(actual.getKey());
    assertNotNull(actual.getTextTemplate());
    assertNull(actual.getHTMLTemplate());
    actual.setHTMLTemplate("<html><body><p>HTML template</p></body></html>");
    actual = mailTemplateDAO.save(actual);
    assertNotNull(actual.getTextTemplate());
    assertNotNull(actual.getHTMLTemplate());
}
Also used : MailTemplate(org.apache.syncope.core.persistence.api.entity.MailTemplate) Test(org.junit.jupiter.api.Test) AbstractTest(org.apache.syncope.core.persistence.jpa.AbstractTest)

Example 8 with MailTemplate

use of org.apache.syncope.core.persistence.api.entity.MailTemplate in project syncope by apache.

the class MailTemplateTest method find.

@Test
public void find() {
    MailTemplate optin = mailTemplateDAO.find("optin");
    assertNotNull(optin);
    assertNotNull(optin.getTextTemplate());
    assertNotNull(optin.getHTMLTemplate());
}
Also used : MailTemplate(org.apache.syncope.core.persistence.api.entity.MailTemplate) Test(org.junit.jupiter.api.Test) AbstractTest(org.apache.syncope.core.persistence.jpa.AbstractTest)

Aggregations

MailTemplate (org.apache.syncope.core.persistence.api.entity.MailTemplate)8 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)4 NotFoundException (org.apache.syncope.core.persistence.api.dao.NotFoundException)3 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)2 Notification (org.apache.syncope.core.persistence.api.entity.Notification)2 AbstractTest (org.apache.syncope.core.persistence.jpa.AbstractTest)2 Test (org.junit.jupiter.api.Test)2 ParseException (java.text.ParseException)1 Matcher (java.util.regex.Matcher)1 StringUtils (org.apache.commons.lang3.StringUtils)1 SyncopeConstants (org.apache.syncope.common.lib.SyncopeConstants)1 MailTemplateTO (org.apache.syncope.common.lib.to.MailTemplateTO)1 NotificationTO (org.apache.syncope.common.lib.to.NotificationTO)1 AnyTypeKind (org.apache.syncope.common.lib.types.AnyTypeKind)1 ClientExceptionType (org.apache.syncope.common.lib.types.ClientExceptionType)1 AnyTypeDAO (org.apache.syncope.core.persistence.api.dao.AnyTypeDAO)1 DuplicateException (org.apache.syncope.core.persistence.api.dao.DuplicateException)1 ImplementationDAO (org.apache.syncope.core.persistence.api.dao.ImplementationDAO)1 MailTemplateDAO (org.apache.syncope.core.persistence.api.dao.MailTemplateDAO)1 AnyAbout (org.apache.syncope.core.persistence.api.entity.AnyAbout)1