remove mail service
This commit is contained in:
parent
f46543f1a4
commit
f47f9721fe
|
@ -0,0 +1,20 @@
|
|||
package eu.eudat.configurations.notification;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(NotificationProperties.class)
|
||||
public class NotificationConfiguration {
|
||||
private final NotificationProperties properties;
|
||||
|
||||
@Autowired
|
||||
public NotificationConfiguration(NotificationProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public NotificationProperties getProperties() {
|
||||
return properties;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package eu.eudat.configurations.notification;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "notification")
|
||||
public class NotificationProperties {
|
||||
|
||||
private String confirmation;
|
||||
private String dataManagementPlan;
|
||||
private String finalised;
|
||||
private String mergeConfirmation;
|
||||
private String modified;
|
||||
private String modifiedFinalised;
|
||||
private String publish;
|
||||
private String template;
|
||||
private String unlinkConfirmation;
|
||||
|
||||
public String getConfirmation() {
|
||||
return confirmation;
|
||||
}
|
||||
|
||||
public void setConfirmation(String confirmation) {
|
||||
this.confirmation = confirmation;
|
||||
}
|
||||
|
||||
public String getDataManagementPlan() {
|
||||
return dataManagementPlan;
|
||||
}
|
||||
|
||||
public void setDataManagementPlan(String dataManagementPlan) {
|
||||
this.dataManagementPlan = dataManagementPlan;
|
||||
}
|
||||
|
||||
public String getFinalised() {
|
||||
return finalised;
|
||||
}
|
||||
|
||||
public void setFinalised(String finalised) {
|
||||
this.finalised = finalised;
|
||||
}
|
||||
|
||||
public String getMergeConfirmation() {
|
||||
return mergeConfirmation;
|
||||
}
|
||||
|
||||
public void setMergeConfirmation(String mergeConfirmation) {
|
||||
this.mergeConfirmation = mergeConfirmation;
|
||||
}
|
||||
|
||||
public String getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(String modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
public String getModifiedFinalised() {
|
||||
return modifiedFinalised;
|
||||
}
|
||||
|
||||
public void setModifiedFinalised(String modifiedFinalised) {
|
||||
this.modifiedFinalised = modifiedFinalised;
|
||||
}
|
||||
|
||||
public String getPublish() {
|
||||
return publish;
|
||||
}
|
||||
|
||||
public void setPublish(String publish) {
|
||||
this.publish = publish;
|
||||
}
|
||||
|
||||
public String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
public void setTemplate(String template) {
|
||||
this.template = template;
|
||||
}
|
||||
|
||||
public String getUnlinkConfirmation() {
|
||||
return unlinkConfirmation;
|
||||
}
|
||||
|
||||
public void setUnlinkConfirmation(String unlinkConfirmation) {
|
||||
this.unlinkConfirmation = unlinkConfirmation;
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import eu.eudat.commons.types.descriptiontemplate.*;
|
|||
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
||||
import eu.eudat.commons.types.descriptiontemplate.importexport.*;
|
||||
import eu.eudat.commons.types.notification.*;
|
||||
import eu.eudat.configurations.notification.NotificationProperties;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.data.DescriptionTemplateEntity;
|
||||
import eu.eudat.data.UserDescriptionTemplateEntity;
|
||||
|
@ -106,6 +107,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
private final StorageFileService storageFileService;
|
||||
private final JsonHandlingService jsonHandlingService;
|
||||
private final NotificationIntegrationEventHandler eventHandler;
|
||||
private final NotificationProperties notificationProperties;
|
||||
|
||||
@Autowired
|
||||
public DescriptionTemplateServiceImpl(
|
||||
|
@ -116,7 +118,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
ConventionService conventionService,
|
||||
MessageSource messageSource,
|
||||
XmlHandlingService xmlHandlingService,
|
||||
FieldDataHelperServiceProvider fieldDataHelperServiceProvider, QueryFactory queryFactory, ErrorThesaurusProperties errors, ValidationService validationService, TenantScope tenantScope, Environment environment, ResponseUtilsService responseUtilsService, StorageFileService storageFileService, JsonHandlingService jsonHandlingService, NotificationIntegrationEventHandler eventHandler) {
|
||||
FieldDataHelperServiceProvider fieldDataHelperServiceProvider, QueryFactory queryFactory, ErrorThesaurusProperties errors, ValidationService validationService, TenantScope tenantScope, Environment environment, ResponseUtilsService responseUtilsService, StorageFileService storageFileService, JsonHandlingService jsonHandlingService, NotificationIntegrationEventHandler eventHandler, NotificationProperties notificationProperties) {
|
||||
this.entityManager = entityManager;
|
||||
this.userScope = userScope;
|
||||
this.authorizationService = authorizationService;
|
||||
|
@ -135,6 +137,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
this.storageFileService = storageFileService;
|
||||
this.jsonHandlingService = jsonHandlingService;
|
||||
this.eventHandler = eventHandler;
|
||||
this.notificationProperties = notificationProperties;
|
||||
}
|
||||
|
||||
//region Persist
|
||||
|
@ -222,7 +225,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
||||
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
||||
event.setContactTypeHint(NotificationContactType.EMAIL);
|
||||
event.setNotificationType(UUID.fromString("223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B"));
|
||||
event.setNotificationType(UUID.fromString(notificationProperties.getTemplate()));
|
||||
NotificationFieldData data = new NotificationFieldData();
|
||||
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||
fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, user.getName()));
|
||||
|
|
|
@ -52,7 +52,7 @@ notification:
|
|||
|
||||
body-path: classpath:notification_templates/Confirmation/Email/body.{language}.html
|
||||
body-field-options:
|
||||
mandatory: [ ]
|
||||
mandatory: [ "{host}", "{confirmationToken}" ]
|
||||
optional:
|
||||
- key: "{expiration_time}"
|
||||
value: --
|
||||
|
@ -94,7 +94,7 @@ notification:
|
|||
optional: [ ]
|
||||
body-path: classpath:notification_templates/Finalised/Email/body.{language}.html
|
||||
body-field-options:
|
||||
mandatory: [ "{reasonName}", "{name}" ]
|
||||
mandatory: [ "{reasonName}", "{name}", "{host}", "{path}", "{id}" ]
|
||||
optional:
|
||||
- key: "{recipient}"
|
||||
value:
|
||||
|
@ -138,7 +138,7 @@ notification:
|
|||
optional: [ ]
|
||||
body-path: classpath:notification_templates/Modified/Email/body.{language}.html
|
||||
body-field-options:
|
||||
mandatory: [ "{reasonName}", "{name}" ]
|
||||
mandatory: [ "{reasonName}", "{name}", "{host}", "{path}", "{id}" ]
|
||||
optional:
|
||||
- key: "{recipient}"
|
||||
value:
|
||||
|
@ -160,7 +160,7 @@ notification:
|
|||
optional: [ ]
|
||||
body-path: classpath:notification_templates/ModifiedFinalised/Email/body.{language}.html
|
||||
body-field-options:
|
||||
mandatory: [ "{reasonName}", "{name}" ]
|
||||
mandatory: [ "{reasonName}", "{name}", "{host}", "{path}", "{id}" ]
|
||||
optional:
|
||||
- key: "{recipient}"
|
||||
value:
|
||||
|
@ -182,7 +182,7 @@ notification:
|
|||
optional: [ ]
|
||||
body-path: classpath:notification_templates/Publish/Email/body.{language}.html
|
||||
body-field-options:
|
||||
mandatory: [ "{reasonName}", "{name}" ]
|
||||
mandatory: [ "{reasonName}", "{name}", "{host}", "{path}", "{id}" ]
|
||||
optional:
|
||||
- key: "{recipient}"
|
||||
value:
|
||||
|
|
|
@ -75,7 +75,7 @@ public class EmailConfirmationManager {
|
|||
// if (user.getEmail() != null) //TODO
|
||||
// throw new HasConfirmedEmailException("User already has confirmed his Email.");
|
||||
|
||||
apiContext.getUtilitiesService().getConfirmationEmailService().sentConfirmationEmail(email);
|
||||
apiContext.getUtilitiesService().getConfirmationEmailService().sentConfirmationEmail(databaseRepository.getLoginConfirmationEmailDao(), email, user);
|
||||
}
|
||||
|
||||
private void mergeNewUserToOld(UserEntity newUser, UserEntity oldUser) throws InvalidApplicationException {
|
||||
|
|
|
@ -9,6 +9,9 @@ import eu.eudat.exceptions.security.UnauthorisedException;
|
|||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.model.User;
|
||||
import eu.eudat.models.data.invitation.Invitation;
|
||||
import eu.eudat.query.DmpQuery;
|
||||
import eu.eudat.query.UserQuery;
|
||||
import gr.cite.tools.data.query.QueryFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -25,12 +28,14 @@ public class InvitationsManager {
|
|||
private ApiContext apiContext;
|
||||
private DataManagementPlanManager dataManagementPlanManager;
|
||||
private final UserScope userScope;
|
||||
private final QueryFactory queryFactory;
|
||||
|
||||
@Autowired
|
||||
public InvitationsManager(ApiContext apiContext, DataManagementPlanManager dataManagementPlanManager, UserScope userScope) {
|
||||
public InvitationsManager(ApiContext apiContext, DataManagementPlanManager dataManagementPlanManager, UserScope userScope, QueryFactory queryFactory) {
|
||||
this.apiContext = apiContext;
|
||||
this.dataManagementPlanManager = dataManagementPlanManager;
|
||||
this.userScope = userScope;
|
||||
this.queryFactory = queryFactory;
|
||||
}
|
||||
|
||||
public void inviteUsers(Invitation invitation) throws Exception {
|
||||
|
@ -63,9 +68,19 @@ public class InvitationsManager {
|
|||
apiContext.getOperationsContext().getDatabaseRepository().getUserAssociationDao().createOrUpdate(userAssociation);
|
||||
}*/
|
||||
}
|
||||
DmpEntity dataManagementPlan = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(invitation.getDataManagementPlan());
|
||||
// apiContext.getUtilitiesService().getInvitationService().createInvitations(apiContext.getOperationsContext().getDatabaseRepository().getInvitationDao(), apiContext.getUtilitiesService().getMailService(), invitation.getUsers().stream().map(UserInfoInvitationModel::toDataModel).collect(Collectors.toList()), dataManagementPlan, invitation.getRole(), principalUser);
|
||||
apiContext.getUtilitiesService().getInvitationService().assignToDmp(apiContext.getOperationsContext().getDatabaseRepository().getDmpDao(), userInfoToUserDmp, dataManagementPlan);
|
||||
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).ids(invitation.getDataManagementPlan());
|
||||
if(dmpQuery != null){
|
||||
// DmpEntity dataManagementPlan = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(invitation.getDataManagementPlan());
|
||||
DmpEntity dmpEntity = dmpQuery.first();
|
||||
UserQuery userQuery = this.queryFactory.query(UserQuery.class).ids(invitation.getUsers().stream().map(user -> user.getId()).collect(Collectors.toList()));
|
||||
if (userQuery != null){
|
||||
List<UserEntity> userEntities = userQuery.collect();
|
||||
// apiContext.getUtilitiesService().getInvitationService().createInvitations(apiContext.getOperationsContext().getDatabaseRepository().getInvitationDao(), invitation.getUsers().stream().map(UserInfoInvitationModel::toDataModel).collect(Collectors.toList()), dmpEntity, invitation.getRole(), principalUser);
|
||||
apiContext.getUtilitiesService().getInvitationService().createInvitations(apiContext.getOperationsContext().getDatabaseRepository().getInvitationDao(), userEntities, dmpEntity, invitation.getRole(), principalUser);
|
||||
apiContext.getUtilitiesService().getInvitationService().assignToDmp(apiContext.getOperationsContext().getDatabaseRepository().getDmpDao(), userInfoToUserDmp, dmpEntity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<User> getUsers() throws InstantiationException, IllegalAccessException, InvalidApplicationException {
|
||||
|
|
|
@ -10,7 +10,10 @@ import eu.eudat.exceptions.emailconfirmation.TokenExpiredException;
|
|||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||
|
||||
import eu.eudat.model.UserContactInfo;
|
||||
import eu.eudat.query.UserContactInfoQuery;
|
||||
import eu.eudat.query.UserQuery;
|
||||
import gr.cite.tools.data.query.Ordering;
|
||||
import gr.cite.tools.data.query.QueryFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -70,18 +73,18 @@ public class MergeEmailConfirmationManager {
|
|||
return userToBeMergedEmail;
|
||||
}
|
||||
|
||||
public void sendConfirmationEmail(String email, UUID userId, Integer provider) throws HasConfirmedEmailException, InvalidApplicationException {
|
||||
public void sendMergeConfirmationEmail(String email, Integer provider) throws HasConfirmedEmailException, InvalidApplicationException {
|
||||
UserEntity user = this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first();
|
||||
//TODO
|
||||
// if (user.getEmail() != null && !user.getEmail().equals(email)) {
|
||||
// apiContext.getUtilitiesService().getConfirmationEmailService().createMergeConfirmationEmail(
|
||||
// databaseRepository.getLoginConfirmationEmailDao(),
|
||||
// apiContext.getUtilitiesService().getMailService(),
|
||||
// email,
|
||||
// user,
|
||||
// provider
|
||||
// );
|
||||
// }
|
||||
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(user.getId());
|
||||
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
|
||||
if (query.first().getValue() != null && !query.first().getValue().equals(email)) {
|
||||
apiContext.getUtilitiesService().getConfirmationEmailService().sentMergeConfirmationEmail(
|
||||
databaseRepository.getLoginConfirmationEmailDao(),
|
||||
email,
|
||||
user,
|
||||
provider
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
|
|
@ -25,7 +25,6 @@ public class NotificationManager {
|
|||
|
||||
private ApiContext apiContext;
|
||||
private Environment environment;
|
||||
// private MailService mailService;
|
||||
private final QueryFactory queryFactory;
|
||||
|
||||
@Autowired
|
||||
|
@ -34,7 +33,6 @@ public class NotificationManager {
|
|||
QueryFactory queryFactory) {
|
||||
this.apiContext = apiContext;
|
||||
this.environment = environment;
|
||||
// this.mailService = mailService;
|
||||
this.queryFactory = queryFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package eu.eudat.logic.managers;
|
|||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.data.UserCredentialEntity;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.data.old.EmailConfirmation;
|
||||
import eu.eudat.data.UserEntity;
|
||||
import eu.eudat.exceptions.emailconfirmation.HasConfirmedEmailException;
|
||||
|
@ -32,12 +32,14 @@ public class UnlinkEmailConfirmationManager {
|
|||
private ApiContext apiContext;
|
||||
private DatabaseRepository databaseRepository;
|
||||
private final QueryFactory queryFactory;
|
||||
private final UserScope userScope;
|
||||
|
||||
@Autowired
|
||||
public UnlinkEmailConfirmationManager(ApiContext apiContext, QueryFactory queryFactory) {
|
||||
public UnlinkEmailConfirmationManager(ApiContext apiContext, QueryFactory queryFactory, UserScope userScope) {
|
||||
this.apiContext = apiContext;
|
||||
this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository();
|
||||
this.queryFactory = queryFactory;
|
||||
this.userScope = userScope;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -79,8 +81,8 @@ public class UnlinkEmailConfirmationManager {
|
|||
// }
|
||||
}
|
||||
|
||||
public void sendUnlinkConfirmationEmail(String email, UUID userId, Integer provider) throws InvalidApplicationException {
|
||||
UserEntity user = this.queryFactory.query(UserQuery.class).ids(userId).first();
|
||||
public void sendUnlinkConfirmationEmail(String email, Integer provider) throws InvalidApplicationException {
|
||||
UserEntity user = this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first();
|
||||
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(user.getId());
|
||||
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
|
||||
if (query.first().getValue() != null && !query.first().getValue().equals(email)) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import javax.management.InvalidApplicationException;
|
|||
|
||||
|
||||
public interface ConfirmationEmailService {
|
||||
public void sentConfirmationEmail(String email) throws InvalidApplicationException;
|
||||
public void sentConfirmationEmail(EmailConfirmationDao loginConfirmationEmailDao, String email, UserEntity user) throws InvalidApplicationException;
|
||||
|
||||
public void sentUnlinkConfirmationEmail(EmailConfirmationDao loginConfirmationEmailDao, String email, UserEntity user, Integer provider) throws InvalidApplicationException;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import eu.eudat.commons.enums.ContactInfoType;
|
|||
import eu.eudat.commons.enums.notification.NotificationContactType;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.commons.types.notification.*;
|
||||
import eu.eudat.configurations.notification.NotificationProperties;
|
||||
import eu.eudat.data.dao.entities.EmailConfirmationDao;
|
||||
import eu.eudat.data.old.EmailConfirmation;
|
||||
import eu.eudat.data.UserEntity;
|
||||
|
@ -23,7 +24,6 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import javax.management.InvalidApplicationException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Service("ConfirmationEmailService")
|
||||
public class ConfirmationEmailServiceImpl implements ConfirmationEmailService {
|
||||
|
@ -34,19 +34,34 @@ public class ConfirmationEmailServiceImpl implements ConfirmationEmailService {
|
|||
private final QueryFactory queryFactory;
|
||||
private final JsonHandlingService jsonHandlingService;
|
||||
private final NotificationIntegrationEventHandler eventHandler;
|
||||
private final NotificationProperties notificationProperties;
|
||||
|
||||
|
||||
public ConfirmationEmailServiceImpl(/*Logger logger,*/ Environment environment, UserScope userScope, QueryFactory queryFactory, JsonHandlingService jsonHandlingService, NotificationIntegrationEventHandler eventHandler) {
|
||||
public ConfirmationEmailServiceImpl(/*Logger logger,*/ Environment environment, UserScope userScope, QueryFactory queryFactory, JsonHandlingService jsonHandlingService, NotificationIntegrationEventHandler eventHandler, NotificationProperties notificationProperties) {
|
||||
// this.logger = logger;
|
||||
this.environment = environment;
|
||||
this.userScope = userScope;
|
||||
this.queryFactory = queryFactory;
|
||||
this.jsonHandlingService = jsonHandlingService;
|
||||
this.eventHandler = eventHandler;
|
||||
this.notificationProperties = notificationProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sentConfirmationEmail(String email) throws InvalidApplicationException {
|
||||
public void sentConfirmationEmail(EmailConfirmationDao loginConfirmationEmailDao, String email, UserEntity user) throws InvalidApplicationException {
|
||||
|
||||
EmailConfirmation confirmationEmail = new EmailConfirmation();
|
||||
confirmationEmail.setEmail(email);
|
||||
confirmationEmail.setExpiresAt(Date
|
||||
.from(new Date()
|
||||
.toInstant()
|
||||
.plusSeconds(Long.parseLong(this.environment.getProperty("conf_email.expiration_time_seconds")))
|
||||
)
|
||||
);
|
||||
confirmationEmail.setUserId(user.getId());
|
||||
confirmationEmail.setIsConfirmed(false);
|
||||
confirmationEmail.setToken(UUID.randomUUID());
|
||||
confirmationEmail = loginConfirmationEmailDao.createOrUpdate(confirmationEmail);
|
||||
|
||||
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
||||
event.setUserId(userScope.getUserIdSafe());
|
||||
|
@ -55,9 +70,11 @@ public class ConfirmationEmailServiceImpl implements ConfirmationEmailService {
|
|||
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
||||
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
||||
event.setContactTypeHint(NotificationContactType.EMAIL);
|
||||
event.setNotificationType(UUID.fromString("4FDBFA80-7A71-4A69-B854-67CBB70648F1"));
|
||||
event.setNotificationType(UUID.fromString(notificationProperties.getConfirmation()));
|
||||
NotificationFieldData data = new NotificationFieldData();
|
||||
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||
fieldInfoList.add(new FieldInfo("{host}", DataType.String, this.environment.getProperty("dmp.domain")));
|
||||
fieldInfoList.add(new FieldInfo("{confirmationToken}", DataType.String, confirmationEmail.getToken().toString()));
|
||||
fieldInfoList.add(new FieldInfo("{expiration_time}", DataType.String, this.secondsToTime(Integer.parseInt(this.environment.getProperty("conf_email.expiration_time_seconds")))));
|
||||
data.setFields(fieldInfoList);
|
||||
event.setData(jsonHandlingService.toJsonSafe(data));
|
||||
|
@ -96,7 +113,7 @@ public class ConfirmationEmailServiceImpl implements ConfirmationEmailService {
|
|||
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
||||
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
||||
event.setContactTypeHint(NotificationContactType.EMAIL);
|
||||
event.setNotificationType(UUID.fromString("C9BC3F16-057E-4BBA-8A5F-36BD835E5604"));
|
||||
event.setNotificationType(UUID.fromString(notificationProperties.getUnlinkConfirmation()));
|
||||
NotificationFieldData data = new NotificationFieldData();
|
||||
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||
fieldInfoList.add(new FieldInfo("{host}", DataType.String, this.environment.getProperty("dmp.domain")));
|
||||
|
@ -139,7 +156,7 @@ public class ConfirmationEmailServiceImpl implements ConfirmationEmailService {
|
|||
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
||||
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
||||
event.setContactTypeHint(NotificationContactType.EMAIL);
|
||||
event.setNotificationType(UUID.fromString("BFE68845-CB05-4C5A-A03D-29161A7C9660"));
|
||||
event.setNotificationType(UUID.fromString(notificationProperties.getMergeConfirmation()));
|
||||
NotificationFieldData data = new NotificationFieldData();
|
||||
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||
fieldInfoList.add(new FieldInfo("{userName}", DataType.String, user.getName()));
|
||||
|
|
|
@ -3,9 +3,11 @@ package eu.eudat.logic.services.utilities;
|
|||
|
||||
import eu.eudat.commons.JsonHandlingService;
|
||||
import eu.eudat.commons.enums.ContactInfoType;
|
||||
import eu.eudat.commons.enums.DmpUserRole;
|
||||
import eu.eudat.commons.enums.notification.NotificationContactType;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.commons.types.notification.*;
|
||||
import eu.eudat.configurations.notification.NotificationProperties;
|
||||
import eu.eudat.data.DmpEntity;
|
||||
import eu.eudat.data.DmpUserEntity;
|
||||
import eu.eudat.data.dao.entities.DMPDao;
|
||||
|
@ -34,7 +36,6 @@ import java.io.StringWriter;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
|
||||
@Service("invitationService")
|
||||
|
@ -44,13 +45,15 @@ public class InvitationServiceImpl implements InvitationService {
|
|||
private final UserScope userScope;
|
||||
private final NotificationIntegrationEventHandler eventHandler;
|
||||
private final JsonHandlingService jsonHandlingService;
|
||||
private final NotificationProperties notificationProperties;
|
||||
|
||||
@Autowired
|
||||
public InvitationServiceImpl(Environment environment, UserScope userScope, NotificationIntegrationEventHandler eventHandler, JsonHandlingService jsonHandlingService, QueryFactory queryFactory) {
|
||||
public InvitationServiceImpl(Environment environment, UserScope userScope, NotificationIntegrationEventHandler eventHandler, JsonHandlingService jsonHandlingService, NotificationProperties notificationProperties, QueryFactory queryFactory) {
|
||||
this.environment = environment;
|
||||
this.userScope = userScope;
|
||||
this.eventHandler = eventHandler;
|
||||
this.jsonHandlingService = jsonHandlingService;
|
||||
this.notificationProperties = notificationProperties;
|
||||
this.queryFactory = queryFactory;
|
||||
}
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -112,14 +115,14 @@ public class InvitationServiceImpl implements InvitationService {
|
|||
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
||||
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
||||
event.setContactTypeHint(NotificationContactType.EMAIL);
|
||||
event.setNotificationType(UUID.fromString("065DEECD-21BB-44AF-9983-E660FDF24BC4"));
|
||||
event.setNotificationType(UUID.fromString(notificationProperties.getDataManagementPlan()));
|
||||
NotificationFieldData data = new NotificationFieldData();
|
||||
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||
fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, user.getName()));
|
||||
fieldInfoList.add(new FieldInfo("{invitationID}", DataType.String, invitation.getId().toString()));
|
||||
fieldInfoList.add(new FieldInfo("{host}", DataType.String, this.environment.getProperty("dmp.domain")));
|
||||
fieldInfoList.add(new FieldInfo("{dmpname}", DataType.String, dmp.getLabel()));
|
||||
// fieldInfoList.add(new FieldInfo("{dmprole}", DataType.String, UserDMP.UserDMPRoles.fromInteger(role).name())); //TODO
|
||||
fieldInfoList.add(new FieldInfo("{dmprole}", DataType.String, DmpUserRole.of(role.shortValue()).toString()));
|
||||
data.setFields(fieldInfoList);
|
||||
event.setData(jsonHandlingService.toJsonSafe(data));
|
||||
eventHandler.handle(event);
|
||||
|
|
|
@ -26,5 +26,7 @@ spring:
|
|||
optional:classpath:config/storage.yml[.yml], optional:classpath:config/storage-${spring.profiles.active}.yml[.yml], optional:file:../config/storage-${spring.profiles.active}.yml[.yml],
|
||||
optional:classpath:config/reference-type.yml[.yml], optional:classpath:config/reference-type-${spring.profiles.active}.yml[.yml], optional:file:../config/reference-type-${spring.profiles.active}.yml[.yml],
|
||||
optional:classpath:config/tenant.yml[.yml], optional:classpath:config/tenant-${spring.profiles.active}.yml[.yml], optional:file:../config/tenant-${spring.profiles.active}.yml[.yml],
|
||||
optional:classpath:config/queue.yml[.yml], optional:classpath:config/queue-${spring.profiles.active}.yml[.yml], optional:file:../config/queue-${spring.profiles.active}.yml[.yml]
|
||||
optional:classpath:config/queue.yml[.yml], optional:classpath:config/queue-${spring.profiles.active}.yml[.yml], optional:file:../config/queue-${spring.profiles.active}.yml[.yml],
|
||||
optional:classpath:config/notification.yml[.yml], optional:classpath:config/notification-${spring.profiles.active}.yml[.yml], optional:file:../config/notification-${spring.profiles.active}.yml[.yml]
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
notification:
|
||||
confirmation: 4FDBFA80-7A71-4A69-B854-67CBB70648F1
|
||||
dataManagementPlan: 065DEECD-21BB-44AF-9983-E660FDF24BC4
|
||||
finalised: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E
|
||||
mergeConfirmation: BFE68845-CB05-4C5A-A03D-29161A7C9660
|
||||
modified: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB
|
||||
modifiedFinalised: D3CD55FE-8DA2-42E7-A501-3795EE4F16D3
|
||||
publish: 55736F7A-83AB-4190-AF43-9D031A6F9612
|
||||
template: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B
|
||||
unlinkConfirmation: C9BC3F16-057E-4BBA-8A5F-36BD835E5604
|
Loading…
Reference in New Issue