use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto in project CzechIdMng by bcvsolutions.
the class IdmNotificationConfigurationFilterTest method testTemplateIdFilter.
@Test
public void testTemplateIdFilter() {
String text = "someText" + System.currentTimeMillis();
IdmNotificationTemplateDto templ = createTemplate("testFilter");
NotificationConfigurationDto notification = createNotification(NotificationLevel.SUCCESS, CoreModuleDescriptor.MODULE_ID + ":test003", text, templ.getId());
IdmNotificationConfigurationFilter filter = new IdmNotificationConfigurationFilter();
filter.setTemplate(templ.getId());
filter.setNotificationType(text);
Page<NotificationConfigurationDto> result = idmNotificationConfService.find(filter, null);
assertEquals(1, result.getTotalElements());
assertEquals(notification.getId(), result.getContent().get(0).getId());
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto in project CzechIdMng by bcvsolutions.
the class IdmNotificationConfigurationFilterTest method createTemplate.
/**
* Creates and returns notification template
*
* @return
*/
private IdmNotificationTemplateDto createTemplate(String subject) {
IdmNotificationTemplateDto templ = new IdmNotificationTemplateDto();
templ.setName(getHelper().createName());
templ.setCode(templ.getName());
templ.setSubject(subject);
return idmNotificationTemplateService.save(templ);
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto in project CzechIdMng by bcvsolutions.
the class NotificationTemplateDeleteBulkAction method prevalidate.
@Override
public ResultModels prevalidate() {
IdmBulkActionDto action = getAction();
List<UUID> entities = getEntities(action, new StringBuilder());
ResultModels results = new ResultModels();
IdmNotificationTemplateFilter templateFilter = new IdmNotificationTemplateFilter();
templateFilter.setUnmodifiable(Boolean.TRUE);
List<IdmNotificationTemplateDto> unmodifiable = notificationService.find(templateFilter, null).getContent();
List<IdmNotificationTemplateDto> templatesToWarn = unmodifiable.stream().filter(dto -> {
return entities.contains(dto.getId());
}).collect(Collectors.toList());
for (IdmNotificationTemplateDto item : templatesToWarn) {
results.addInfo(new DefaultResultModel(CoreResultCode.NOTIFICATION_SYSTEM_TEMPLATE_DELETE_FAILED, ImmutableMap.of("template", item.getCode())));
}
return results;
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto in project CzechIdMng by bcvsolutions.
the class DefaultRptReportManagerIntegrationTest method createTestTemplate.
private IdmNotificationTemplateDto createTestTemplate() {
// create templates
IdmNotificationTemplateDto template = new IdmNotificationTemplateDto();
template.setName(getHelper().createName());
template.setBodyHtml(getHelper().createName());
template.setBodyText(template.getBodyHtml());
template.setCode(template.getName());
template.setSubject(getHelper().createName());
return notificationTemplateService.save(template);
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto in project CzechIdMng by bcvsolutions.
the class DefaultNotificationServiceIntegrationTest method testSendSimple.
@Test
@Transactional
public void testSendSimple() {
assertEquals(0, idmNotificationRepository.count());
IdmNotificationTemplateDto template = createTestTemplate("Idm notification", "subject");
IdmIdentityDto identity = identityService.getByUsername(InitTestData.TEST_USER_1);
notificationManager.send(TOPIC, new IdmMessageDto.Builder().setTemplate(template).build(), identity);
assertEquals(1, idmNotificationRepository.count());
assertEquals(1, emailLogRepository.count());
}
Aggregations