diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/FieldOptionsEntity.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/FieldOptionsEntity.java index 831b12535..15b24149f 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/FieldOptionsEntity.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/FieldOptionsEntity.java @@ -1,8 +1,8 @@ package gr.cite.notification.common.types.notificationtemplate; -import java.util.Dictionary; import java.util.List; +import java.util.Map; public class FieldOptionsEntity { @@ -10,7 +10,7 @@ public class FieldOptionsEntity { private List optional; - private Dictionary formatting; + private Map formatting; public List getMandatory() { return mandatory; @@ -28,11 +28,11 @@ public class FieldOptionsEntity { this.optional = optional; } - public Dictionary getFormatting() { + public Map getFormatting() { return formatting; } - public void setFormatting(Dictionary formatting) { + public void setFormatting(Map formatting) { this.formatting = formatting; } } diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/data/NotificationTemplateEntity.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/data/NotificationTemplateEntity.java index be3d907c6..393794885 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/data/NotificationTemplateEntity.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/data/NotificationTemplateEntity.java @@ -33,7 +33,7 @@ public class NotificationTemplateEntity extends TenantScopedBaseEntity { @Column(name = "\"language\"", columnDefinition = "uuid", nullable = false) private UUID languageId; - public final static String _language = "language"; + public final static String _languageId = "languageId"; @Column(name = "\"value\"", nullable = false) private String value; diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/notificationtemplate/FieldOptions.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/notificationtemplate/FieldOptions.java index 878f93025..cfdb94459 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/notificationtemplate/FieldOptions.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/notificationtemplate/FieldOptions.java @@ -2,8 +2,8 @@ package gr.cite.notification.model.notificationtemplate; import gr.cite.notification.common.types.notification.FieldInfo; -import java.util.Dictionary; import java.util.List; +import java.util.Map; public class FieldOptions { @@ -13,7 +13,7 @@ public class FieldOptions { private List optional; public final static String _optional = "optional"; - private Dictionary formatting; + private Map formatting; public final static String _formatting = "formatting"; public List getMandatory() { @@ -32,11 +32,11 @@ public class FieldOptions { this.optional = optional; } - public Dictionary getFormatting() { + public Map getFormatting() { return formatting; } - public void setFormatting(Dictionary formatting) { + public void setFormatting(Map formatting) { this.formatting = formatting; } } diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/FieldOptionsPersist.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/FieldOptionsPersist.java index db92bdb54..bb63f1187 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/FieldOptionsPersist.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/FieldOptionsPersist.java @@ -2,9 +2,8 @@ package gr.cite.notification.model.persist.notificationtemplate; import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.Dictionary; import java.util.List; +import java.util.Map; public class FieldOptionsPersist { @@ -15,7 +14,7 @@ public class FieldOptionsPersist { private List optional; @Valid - private Dictionary formatting; + private Map formatting; public List getMandatory() { return mandatory; @@ -33,11 +32,11 @@ public class FieldOptionsPersist { this.optional = optional; } - public Dictionary getFormatting() { + public Map getFormatting() { return formatting; } - public void setFormatting(Dictionary formatting) { + public void setFormatting(Map formatting) { this.formatting = formatting; } } diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/NotificationTemplateQuery.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/NotificationTemplateQuery.java index 15665d3ba..fb5535de4 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/NotificationTemplateQuery.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/NotificationTemplateQuery.java @@ -2,6 +2,7 @@ package gr.cite.notification.query; import gr.cite.notification.authorization.AuthorizationFlags; import gr.cite.notification.common.enums.*; +import gr.cite.notification.data.LanguageEntity; import gr.cite.notification.data.NotificationTemplateEntity; import gr.cite.notification.model.NotificationTemplate; import gr.cite.tools.data.query.FieldResolver; @@ -14,6 +15,7 @@ import org.springframework.stereotype.Component; import javax.persistence.Tuple; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Subquery; import java.time.Instant; import java.util.*; @@ -25,6 +27,10 @@ public class NotificationTemplateQuery extends QueryBase excludedIds; private Collection isActives; + private Collection notificationTypes; + private Collection languages; + private LanguageQuery languageQuery; + private List channels; private List kinds; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @@ -59,6 +65,41 @@ public class NotificationTemplateQuery extends QueryBase values) { + this.notificationTypes = values; + return this; + } + + public NotificationTemplateQuery languages(UUID value) { + this.languages = List.of(value); + return this; + } + + public NotificationTemplateQuery languages(UUID... value) { + this.languages = Arrays.asList(value); + return this; + } + + public NotificationTemplateQuery languages(Collection values) { + this.languages = values; + return this; + } + + public NotificationTemplateQuery languageSubQuery(LanguageQuery subQuery) { + this.languageQuery = subQuery; + return this; + } + public NotificationTemplateQuery channels(NotificationTemplateChannel... channels) { this.channels = List.of(channels); return this; @@ -115,6 +156,8 @@ public class NotificationTemplateQuery extends QueryBase inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(NotificationTemplateEntity._notificationType)); + for (UUID item : this.notificationTypes) + inClause.value(item); + predicates.add(inClause); + } + + if (this.languages != null) { + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(NotificationTemplateEntity._languageId)); + for (UUID item : this.languages) + inClause.value(item); + predicates.add(inClause); + } + + if (this.languageQuery != null) { + Subquery subQuery = queryContext.Query.subquery(this.languageQuery.entityClass()); + this.applySubQuery(this.languageQuery, queryContext.CriteriaBuilder, subQuery); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(NotificationTemplateEntity._languageId)).value(subQuery)); + } + if (this.channels != null) { CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(NotificationTemplateEntity._channel)); for (NotificationTemplateChannel item : this.channels) @@ -176,8 +239,8 @@ public class NotificationTemplateQuery extends QueryBase> flowMap; private final MessageInfoBuilderService messageInfoBuilderService; private final Map cipherFields; + private final NotificationTemplateService notificationTemplateService; + private final QueryFactory queryFactory; @Autowired public EmailMessageBuilder(NotificationProperties properties, @@ -46,12 +58,14 @@ public class EmailMessageBuilder extends MessageBuilderBase implements MessageBu CipherService cipherService, CipherProfileProperties cipherProfileProperties, FormattingService formattingService, - NotificationTemplateCache cache) { + NotificationTemplateCache cache, NotificationTemplateService notificationTemplateService, QueryFactory queryFactory) { super(logger, errors, cipherService, cipherProfileProperties, formattingService, cache); this.properties = properties; this.flowMap = flowMap; this.messageInfoBuilderService = messageInfoBuilderService; this.cipherFields = cipherFields; + this.notificationTemplateService = notificationTemplateService; + this.queryFactory = queryFactory; } @Override @@ -59,18 +73,35 @@ public class EmailMessageBuilder extends MessageBuilderBase implements MessageBu MessageInfo messageInfo = this.messageInfoBuilderService.buildMessageInfo(notification); NotificationProperties.Flow flow = this.flowMap.get("email").getOrDefault(notification.getType(), null); if (flow == null) return null; + + NotificationTemplate template = notificationTemplateService.lookupOverriddenTemplates(notification.getType(), NotificationTemplateChannel.Email, this.queryFactory.query(LanguageQuery.class).codes(messageInfo.getLanguage()).isActive(IsActive.Active).first().getId()); String subjectTemplate = null; - if(!StringUtils.isNullOrEmpty(flow.getSubjectKey())) subjectTemplate = messageInfo.getFields().stream().filter(fieldInfo -> fieldInfo.getKey().equals(flow.getSubjectKey())).findFirst().orElse(new FieldInfo()).getValue(); - if (StringUtils.isNullOrEmpty(subjectTemplate)) subjectTemplate = this.lookupOrReadLocalizedFile(this.getTemplate().getTemplateCache(), flow.getSubjectPath(), messageInfo.getLanguage()); - FieldFormatting subjectFormatting = this.buildFieldFormatting(flow.getSubjectFieldOptions()); - ReplaceResult subjectResult = this.buildTemplate(notification.getId(), subjectTemplate, messageInfo, flow.getSubjectFieldOptions(), subjectFormatting, cipherFields.get(notification.getType())); - + ReplaceResult subjectResult = null; String bodyTemplate = null; - if(!StringUtils.isNullOrEmpty(flow.getBodyKey())) bodyTemplate = messageInfo.getFields().stream().filter(fieldInfo -> fieldInfo.getKey().equals(flow.getBodyKey())).findFirst().orElse(new FieldInfo()).getValue(); - if (StringUtils.isNullOrEmpty(bodyTemplate)) bodyTemplate = this.lookupOrReadLocalizedFile(this.getTemplate().getTemplateCache(), flow.getBodyPath(), messageInfo.getLanguage()); - FieldFormatting bodyFormatting = this.buildFieldFormatting(flow.getBodyFieldOptions()); - ReplaceResult bodyResult = this.buildTemplate(notification.getId(), bodyTemplate, messageInfo, flow.getBodyFieldOptions(), bodyFormatting, cipherFields.get(notification.getType())); + ReplaceResult bodyResult = null; + if (template != null && template.getValue() != null){ + if (!StringUtils.isNullOrEmpty(template.getValue().getSubjectKey())) subjectTemplate = messageInfo.getFields().stream().filter(fieldInfo -> fieldInfo.getKey().equals(template.getValue().getSubjectKey())).findFirst().orElse(new FieldInfo()).getValue(); + if (StringUtils.isNullOrEmpty(subjectTemplate)) subjectTemplate = template.getValue().getSubjectText(); + //TODO add formatting function with db fields + subjectResult = this.buildTemplate(notification.getId(), subjectTemplate, messageInfo, template.getValue().getSubjectFieldOptions(), null, cipherFields.get(notification.getType())); + + if(!StringUtils.isNullOrEmpty(template.getValue().getBodyKey())) bodyTemplate = messageInfo.getFields().stream().filter(fieldInfo -> fieldInfo.getKey().equals(template.getValue().getBodyKey())).findFirst().orElse(new FieldInfo()).getValue(); + if (StringUtils.isNullOrEmpty(bodyTemplate)) bodyTemplate = template.getValue().getBodyText(); + FieldFormatting bodyFormatting = this.buildFieldFormatting(flow.getBodyFieldOptions()); + bodyResult = this.buildTemplate(notification.getId(), bodyTemplate, messageInfo, template.getValue().getBodyFieldOptions(), bodyFormatting, cipherFields.get(notification.getType())); + }else { + if(!StringUtils.isNullOrEmpty(flow.getSubjectKey())) subjectTemplate = messageInfo.getFields().stream().filter(fieldInfo -> fieldInfo.getKey().equals(flow.getSubjectKey())).findFirst().orElse(new FieldInfo()).getValue(); + if (StringUtils.isNullOrEmpty(subjectTemplate)) subjectTemplate = this.lookupOrReadLocalizedFile(this.getTemplate().getTemplateCache(), flow.getSubjectPath(), messageInfo.getLanguage()); + FieldFormatting subjectFormatting = this.buildFieldFormatting(flow.getSubjectFieldOptions()); + subjectResult = this.buildTemplate(notification.getId(), subjectTemplate, messageInfo, flow.getSubjectFieldOptions(), subjectFormatting, cipherFields.get(notification.getType())); + + if(!StringUtils.isNullOrEmpty(flow.getBodyKey())) bodyTemplate = messageInfo.getFields().stream().filter(fieldInfo -> fieldInfo.getKey().equals(flow.getBodyKey())).findFirst().orElse(new FieldInfo()).getValue(); + if (StringUtils.isNullOrEmpty(bodyTemplate)) bodyTemplate = this.lookupOrReadLocalizedFile(this.getTemplate().getTemplateCache(), flow.getBodyPath(), messageInfo.getLanguage()); + FieldFormatting bodyFormatting = this.buildFieldFormatting(flow.getBodyFieldOptions()); + bodyResult = this.buildTemplate(notification.getId(), bodyTemplate, messageInfo, flow.getBodyFieldOptions(), bodyFormatting, cipherFields.get(notification.getType())); + + } if (bodyResult != null && subjectResult != null) { EmailMessage emailMessage = new EmailMessage(); emailMessage.setBody(bodyResult.getText()); diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/message/common/MessageBuilderBase.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/message/common/MessageBuilderBase.java index 4557e8cfc..44ef3ebf7 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/message/common/MessageBuilderBase.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/message/common/MessageBuilderBase.java @@ -5,6 +5,7 @@ import gr.cite.notification.common.StringUtils; import gr.cite.notification.common.types.notification.FieldInfo; import gr.cite.notification.config.notification.NotificationProperties; import gr.cite.notification.errorcode.ErrorThesaurusProperties; +import gr.cite.notification.model.notificationtemplate.FieldOptions; import gr.cite.notification.service.formatting.FormattingService; import gr.cite.notification.service.message.model.MessageInfo; import gr.cite.tools.cipher.CipherService; @@ -128,11 +129,13 @@ public abstract class MessageBuilderBase { theField.setValue(this.decipherValue(field)); } - String format = fieldFormatting.isSet(theField.getKey()) ? fieldFormatting.get(theField.getKey()) : null; - String value = this.format(messageInfo.getUserId(), theField, format); - if (StringUtils.isNullOrEmpty(value)) continue; - text = text.replace(theField.getKey(), value); - result.getReplacedKeys().add(theField.getKey()); + if (fieldFormatting != null){ + String format = fieldFormatting.isSet(theField.getKey()) ? fieldFormatting.get(theField.getKey()) : null; + String value = this.format(messageInfo.getUserId(), theField, format); + if (StringUtils.isNullOrEmpty(value)) continue; + text = text.replace(theField.getKey(), value); + result.getReplacedKeys().add(theField.getKey()); + } } result.setText(text); @@ -205,6 +208,23 @@ public abstract class MessageBuilderBase { return result; } + protected ReplaceResult buildTemplate(UUID notificationId, String template, MessageInfo messageInfo, FieldOptions options, FieldFormatting formatting, FieldCiphering ciphering) { + ReplaceResult result = this.applyFieldReplace(template, messageInfo, formatting, ciphering); + if (options != null) { + Boolean allMandatory = this.ensureMandatoryFields(result, options.getMandatory() != null ? options.getMandatory() : new ArrayList<>()); + if (!allMandatory) { + logger.error("Could not replace all subject mandatory field for notification {}", notificationId); + return null; + } + if (options.getOptional() != null) { + for (FieldInfo field : options.getOptional()) { + result.setText(this.applyFieldReplace(result.getText(), field, "", formatting)); + } + } + } + return result; + } + protected Boolean ensureMandatoryFields(ReplaceResult result, List mandatory) { for (String field : mandatory) { if (!result.getReplacedKeys().contains(field)) { diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notificationtemplate/NotificationServiceTemplateImpl.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notificationtemplate/NotificationServiceTemplateImpl.java index 0787f468b..819916832 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notificationtemplate/NotificationServiceTemplateImpl.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notificationtemplate/NotificationServiceTemplateImpl.java @@ -5,6 +5,9 @@ import gr.cite.notification.authorization.AuthorizationFlags; import gr.cite.notification.authorization.Permission; import gr.cite.notification.common.JsonHandlingService; import gr.cite.notification.common.enums.IsActive; +import gr.cite.notification.common.enums.NotificationTemplateChannel; +import gr.cite.notification.common.enums.NotificationTemplateKind; +import gr.cite.notification.common.types.notification.FieldInfo; import gr.cite.notification.common.types.notificationtemplate.FieldInfoEntity; import gr.cite.notification.common.types.notificationtemplate.FieldOptionsEntity; import gr.cite.notification.common.types.notificationtemplate.NotificationTemplateValueEntity; @@ -12,15 +15,20 @@ import gr.cite.notification.convention.ConventionService; import gr.cite.notification.data.NotificationTemplateEntity; import gr.cite.notification.data.TenantScopedEntityManager; import gr.cite.notification.errorcode.ErrorThesaurusProperties; +import gr.cite.notification.model.Language; import gr.cite.notification.model.NotificationTemplate; import gr.cite.notification.model.builder.NotificationTemplateBuilder; import gr.cite.notification.model.deleter.NotificationTemplateDeleter; +import gr.cite.notification.model.notificationtemplate.FieldOptions; +import gr.cite.notification.model.notificationtemplate.NotificationTemplateValue; import gr.cite.notification.model.persist.NotificationTemplatePersist; import gr.cite.notification.model.persist.notificationtemplate.FieldInfoPersist; import gr.cite.notification.model.persist.notificationtemplate.FieldOptionsPersist; import gr.cite.notification.model.persist.notificationtemplate.NotificationTemplateValuePersist; +import gr.cite.notification.query.NotificationTemplateQuery; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.deleter.DeleterFactory; +import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.exception.MyForbiddenException; import gr.cite.tools.exception.MyNotFoundException; @@ -53,6 +61,7 @@ public class NotificationServiceTemplateImpl implements NotificationTemplateServ private final AuthorizationService authorizationService; private final DeleterFactory deleterFactory; private final BuilderFactory builderFactory; + private final QueryFactory queryFactory; private final ConventionService conventionService; private final ErrorThesaurusProperties errors; private final MessageSource messageSource; @@ -64,7 +73,7 @@ public class NotificationServiceTemplateImpl implements NotificationTemplateServ AuthorizationService authService, AuthorizationService authorizationService, DeleterFactory deleterFactory, BuilderFactory builderFactory, - ConventionService conventionService, + QueryFactory queryFactory, ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, JsonHandlingService jsonHandlingService) { @@ -73,6 +82,7 @@ public class NotificationServiceTemplateImpl implements NotificationTemplateServ this.authorizationService = authorizationService; this.deleterFactory = deleterFactory; this.builderFactory = builderFactory; + this.queryFactory = queryFactory; this.conventionService = conventionService; this.errors = errors; this.messageSource = messageSource; @@ -176,4 +186,57 @@ public class NotificationServiceTemplateImpl implements NotificationTemplateServ this.deleterFactory.deleter(NotificationTemplateDeleter.class).deleteAndSaveByIds(List.of(id)); } + @Override + public NotificationTemplate lookupOverriddenTemplates(UUID notificationType, NotificationTemplateChannel channel, UUID language) { + NotificationTemplateQuery query = this.queryFactory.query(NotificationTemplateQuery.class) + .notificationTypes(notificationType) + .channels(channel) + .languages(language) + .kinds(NotificationTemplateKind.Primary) + .isActive(IsActive.Active); + + if (query.first() == null){ + return null; + } + FieldSet fieldSet = new BaseFieldSet( + NotificationTemplate._id, + NotificationTemplate._channel, + NotificationTemplate._notificationType, + NotificationTemplate._kind, + + NotificationTemplate._language + "." + Language._id, + NotificationTemplate._language + "." + Language._code, + + NotificationTemplate._value + "." + NotificationTemplateValue._subjectKey, + NotificationTemplate._value + "." + NotificationTemplateValue._subjectText, + NotificationTemplate._value + "." + NotificationTemplateValue._subjectFieldOptions, + NotificationTemplate._value + "." + NotificationTemplateValue._subjectFieldOptions + "." + FieldOptions._mandatory, + NotificationTemplate._value + "." + NotificationTemplateValue._subjectFieldOptions + "." + FieldOptions._optional + "." + FieldInfo._key, + NotificationTemplate._value + "." + NotificationTemplateValue._subjectFieldOptions + "." + FieldOptions._optional + "." +FieldInfo._type, + NotificationTemplate._value + "." + NotificationTemplateValue._subjectFieldOptions + "." + FieldOptions._optional + "." + FieldInfo._value, + NotificationTemplate._value + "." + NotificationTemplateValue._subjectFieldOptions + "." + FieldOptions._formatting, + NotificationTemplate._value + "." + NotificationTemplateValue._bodyKey, + NotificationTemplate._value + "." + NotificationTemplateValue._bodyText, + NotificationTemplate._value + "." + NotificationTemplateValue._bodyFieldOptions, + NotificationTemplate._value + "." + NotificationTemplateValue._bodyFieldOptions + "." + FieldOptions._mandatory, + NotificationTemplate._value + "." + NotificationTemplateValue._bodyFieldOptions + "." + FieldOptions._optional + "." + FieldInfo._key, + NotificationTemplate._value + "." + NotificationTemplateValue._bodyFieldOptions + "." + FieldOptions._optional + "." + FieldInfo._type, + NotificationTemplate._value + "." + NotificationTemplateValue._bodyFieldOptions + "." + FieldOptions._optional + "." + FieldInfo._value, + NotificationTemplate._value + "." + NotificationTemplateValue._bodyFieldOptions + "." + FieldOptions._formatting, + NotificationTemplate._value + "." + NotificationTemplateValue._priorityKey, + NotificationTemplate._value + "." + NotificationTemplateValue._allowAttachments, + NotificationTemplate._value + "." + NotificationTemplateValue._cc, + NotificationTemplate._value + "." + NotificationTemplateValue._ccMode, + NotificationTemplate._value + "." + NotificationTemplateValue._bcc, + NotificationTemplate._value + "." + NotificationTemplateValue._bccMode, + NotificationTemplate._value + "." + NotificationTemplateValue._extraDataKeys, + + NotificationTemplate._createdAt, + NotificationTemplate._updatedAt, + NotificationTemplate._hash, + NotificationTemplate._isActive + ); + return this.builderFactory.builder(NotificationTemplateBuilder.class).build(fieldSet, query.first()); + } + } diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notificationtemplate/NotificationTemplateService.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notificationtemplate/NotificationTemplateService.java index b7d3e315d..bbeb106b2 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notificationtemplate/NotificationTemplateService.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notificationtemplate/NotificationTemplateService.java @@ -1,5 +1,6 @@ package gr.cite.notification.service.notificationtemplate; +import gr.cite.notification.common.enums.NotificationTemplateChannel; import gr.cite.notification.model.NotificationTemplate; import gr.cite.notification.model.persist.NotificationTemplatePersist; import gr.cite.tools.exception.MyApplicationException; @@ -15,4 +16,6 @@ public interface NotificationTemplateService { NotificationTemplate persist(NotificationTemplatePersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException; void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException; + NotificationTemplate lookupOverriddenTemplates(UUID notificationType, NotificationTemplateChannel channel, UUID language); + }