Fixes on notification service and core
This commit is contained in:
parent
d4739ed1d0
commit
a56a9075b1
|
@ -2,9 +2,11 @@ package eu.eudat.data;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
|
import eu.eudat.data.types.JsonSQLType;
|
||||||
import gr.cite.queueinbox.entity.QueueInbox;
|
import gr.cite.queueinbox.entity.QueueInbox;
|
||||||
import gr.cite.queueinbox.entity.QueueInboxStatus;
|
import gr.cite.queueinbox.entity.QueueInboxStatus;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -37,6 +39,7 @@ public class QueueInboxEntity implements QueueInbox {
|
||||||
private UUID messageId;
|
private UUID messageId;
|
||||||
public final static String _messageId = "messageId";
|
public final static String _messageId = "messageId";
|
||||||
|
|
||||||
|
@Type(JsonSQLType.class)
|
||||||
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
||||||
private String message;
|
private String message;
|
||||||
public final static String _message = "message";
|
public final static String _message = "message";
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
package eu.eudat.data.types;
|
||||||
|
|
||||||
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
|
import org.hibernate.type.SqlTypes;
|
||||||
|
import org.hibernate.usertype.UserType;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Types;
|
||||||
|
|
||||||
|
public class JsonSQLType implements UserType<String> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSqlType() {
|
||||||
|
return SqlTypes.JSON;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<String> returnedClass() {
|
||||||
|
return String.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(String x, String y) {
|
||||||
|
if (x == null) {
|
||||||
|
return y == null;
|
||||||
|
} else {
|
||||||
|
return x.equals(y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode(String x) {
|
||||||
|
return x.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String nullSafeGet(ResultSet rs, int position, SharedSessionContractImplementor session, Object owner) throws SQLException {
|
||||||
|
String json = rs.getString(position);
|
||||||
|
return rs.wasNull() ? null : json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void nullSafeSet(PreparedStatement st, String value, int index, SharedSessionContractImplementor session) throws SQLException {
|
||||||
|
if (value == null) {
|
||||||
|
st.setNull(index, Types.OTHER);
|
||||||
|
} else {
|
||||||
|
st.setObject(index, value, Types.OTHER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String deepCopy(String value) throws HibernateException {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isMutable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Serializable disassemble(String value) throws HibernateException {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String assemble(Serializable cached, Object owner) throws HibernateException {
|
||||||
|
return (String) cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String replace(String original, String target, Object owner) throws HibernateException {
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
package eu.eudat.integrationevent.outbox.notification;
|
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
|
||||||
|
|
||||||
public interface NotificationIntegrationEventHandler {
|
|
||||||
void handle(NotificationIntegrationEvent event) throws InvalidApplicationException;
|
|
||||||
}
|
|
|
@ -5,16 +5,25 @@ import eu.eudat.integrationevent.TrackedEvent;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class NotificationIntegrationEvent extends TrackedEvent {
|
public class NotifyIntegrationEvent extends TrackedEvent {
|
||||||
|
|
||||||
private UUID userId;
|
private UUID userId;
|
||||||
private UUID tenant;
|
|
||||||
|
private UUID tenantId;
|
||||||
|
|
||||||
private UUID notificationType;
|
private UUID notificationType;
|
||||||
|
|
||||||
private NotificationContactType contactTypeHint;
|
private NotificationContactType contactTypeHint;
|
||||||
|
|
||||||
private String contactHint;
|
private String contactHint;
|
||||||
|
|
||||||
private String data;
|
private String data;
|
||||||
|
|
||||||
private String provenanceRef;
|
private String provenanceRef;
|
||||||
|
|
||||||
|
public NotifyIntegrationEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
public UUID getUserId() {
|
public UUID getUserId() {
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
@ -23,12 +32,12 @@ public class NotificationIntegrationEvent extends TrackedEvent {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getTenant() {
|
public UUID getTenantId() {
|
||||||
return tenant;
|
return tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTenant(UUID tenant) {
|
public void setTenantId(UUID tenantId) {
|
||||||
this.tenant = tenant;
|
this.tenantId = tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getNotificationType() {
|
public UUID getNotificationType() {
|
|
@ -0,0 +1,7 @@
|
||||||
|
package eu.eudat.integrationevent.outbox.notification;
|
||||||
|
|
||||||
|
import javax.management.InvalidApplicationException;
|
||||||
|
|
||||||
|
public interface NotifyIntegrationEventHandler {
|
||||||
|
void handle(NotifyIntegrationEvent event) throws InvalidApplicationException;
|
||||||
|
}
|
|
@ -1,10 +1,6 @@
|
||||||
package eu.eudat.integrationevent.outbox.notification;
|
package eu.eudat.integrationevent.outbox.notification;
|
||||||
|
|
||||||
import eu.eudat.audit.AuditableAction;
|
|
||||||
import eu.eudat.commons.enums.ContactInfoType;
|
import eu.eudat.commons.enums.ContactInfoType;
|
||||||
import eu.eudat.commons.enums.notification.NotificationNotifyState;
|
|
||||||
import eu.eudat.commons.enums.notification.NotificationTrackingProcess;
|
|
||||||
import eu.eudat.commons.enums.notification.NotificationTrackingState;
|
|
||||||
import eu.eudat.data.UserContactInfoEntity;
|
import eu.eudat.data.UserContactInfoEntity;
|
||||||
import eu.eudat.data.UserEntity;
|
import eu.eudat.data.UserEntity;
|
||||||
import eu.eudat.integrationevent.outbox.OutboxIntegrationEvent;
|
import eu.eudat.integrationevent.outbox.OutboxIntegrationEvent;
|
||||||
|
@ -24,15 +20,14 @@ import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.context.annotation.RequestScope;
|
import org.springframework.web.context.annotation.RequestScope;
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
import javax.management.InvalidApplicationException;
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@RequestScope
|
@RequestScope
|
||||||
public class NotificationIntegrationEventHandlerImpl implements NotificationIntegrationEventHandler {
|
public class NotifyIntegrationEventHandlerImpl implements NotifyIntegrationEventHandler {
|
||||||
|
|
||||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(NotificationIntegrationEventHandlerImpl.class));
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(NotifyIntegrationEventHandlerImpl.class));
|
||||||
|
|
||||||
private final NotificationService notificationService;
|
private final NotificationService notificationService;
|
||||||
|
|
||||||
|
@ -45,7 +40,7 @@ public class NotificationIntegrationEventHandlerImpl implements NotificationInte
|
||||||
private final ValidatorFactory validatorFactory;
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public NotificationIntegrationEventHandlerImpl(
|
public NotifyIntegrationEventHandlerImpl(
|
||||||
OutboxService outboxService,
|
OutboxService outboxService,
|
||||||
NotificationService notificationService,
|
NotificationService notificationService,
|
||||||
QueryFactory queryFactory,
|
QueryFactory queryFactory,
|
||||||
|
@ -58,31 +53,12 @@ public class NotificationIntegrationEventHandlerImpl implements NotificationInte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(NotificationIntegrationEvent event) throws InvalidApplicationException {
|
public void handle(NotifyIntegrationEvent event) throws InvalidApplicationException {
|
||||||
OutboxIntegrationEvent message = new OutboxIntegrationEvent();
|
OutboxIntegrationEvent message = new OutboxIntegrationEvent();
|
||||||
message.setMessageId(UUID.randomUUID());
|
message.setMessageId(UUID.randomUUID());
|
||||||
message.setType(OutboxIntegrationEvent.NOTIFY);
|
message.setType(OutboxIntegrationEvent.NOTIFY);
|
||||||
message.setEvent(event);
|
message.setEvent(event);
|
||||||
this.outboxService.publish(message);
|
this.outboxService.publish(message);
|
||||||
// NotificationPersist persist = new NotificationPersist();
|
|
||||||
// persist.setType(event.getNotificationType());
|
|
||||||
// persist.setUserId(event.getUserId());
|
|
||||||
// persist.setContactHint(event.getContactHint());
|
|
||||||
// persist.setContactTypeHint(event.getContactTypeHint());
|
|
||||||
// persist.setData(event.getData());
|
|
||||||
// persist.setNotifyState(NotificationNotifyState.PENDING);
|
|
||||||
// persist.setNotifiedWith(event.getContactTypeHint());
|
|
||||||
// persist.setRetryCount(0);
|
|
||||||
// persist.setTrackingState(NotificationTrackingState.UNDEFINED);
|
|
||||||
// persist.setTrackingProcess(NotificationTrackingProcess.PENDING);
|
|
||||||
// persist.setTrackingData(null);
|
|
||||||
// persist.setProvenanceRef(event.getProvenanceRef());
|
|
||||||
// persist.setNotifiedAt(Instant.now());
|
|
||||||
// validatorFactory.validator(NotificationPersist.NotificationPersistValidator.class).validateForce(persist);
|
|
||||||
// if (isNotificationConsistent(persist)) {
|
|
||||||
// notificationService.persist(persist, null);
|
|
||||||
// auditService.track(AuditableAction.Notification_Persist, "notification_event", event);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNotificationConsistent(NotificationPersist notification) {
|
private boolean isNotificationConsistent(NotificationPersist notification) {
|
|
@ -8,8 +8,8 @@ import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.commons.types.notification.*;
|
import eu.eudat.commons.types.notification.*;
|
||||||
import eu.eudat.configurations.notification.NotificationProperties;
|
import eu.eudat.configurations.notification.NotificationProperties;
|
||||||
import eu.eudat.data.UserContactInfoEntity;
|
import eu.eudat.data.UserContactInfoEntity;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEvent;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEventHandler;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
||||||
import eu.eudat.model.UserContactInfo;
|
import eu.eudat.model.UserContactInfo;
|
||||||
import eu.eudat.model.persist.ContactSupportPersist;
|
import eu.eudat.model.persist.ContactSupportPersist;
|
||||||
import eu.eudat.model.persist.PublicContactSupportPersist;
|
import eu.eudat.model.persist.PublicContactSupportPersist;
|
||||||
|
@ -41,7 +41,7 @@ public class ContactSupportServiceImpl implements ContactSupportService {
|
||||||
|
|
||||||
private final UserScope userScope;
|
private final UserScope userScope;
|
||||||
|
|
||||||
private final NotificationIntegrationEventHandler notificationIntegrationEventHandler;
|
private final NotifyIntegrationEventHandler notifyIntegrationEventHandler;
|
||||||
|
|
||||||
private final NotificationProperties notificationProperties;
|
private final NotificationProperties notificationProperties;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -50,13 +50,13 @@ public class ContactSupportServiceImpl implements ContactSupportService {
|
||||||
QueryFactory queryFactory,
|
QueryFactory queryFactory,
|
||||||
JsonHandlingService jsonHandlingService,
|
JsonHandlingService jsonHandlingService,
|
||||||
UserScope userScope,
|
UserScope userScope,
|
||||||
NotificationIntegrationEventHandler notificationIntegrationEventHandler,
|
NotifyIntegrationEventHandler notifyIntegrationEventHandler,
|
||||||
NotificationProperties notificationProperties) {
|
NotificationProperties notificationProperties) {
|
||||||
this.authorizationService = authorizationService;
|
this.authorizationService = authorizationService;
|
||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
this.jsonHandlingService = jsonHandlingService;
|
this.jsonHandlingService = jsonHandlingService;
|
||||||
this.userScope = userScope;
|
this.userScope = userScope;
|
||||||
this.notificationIntegrationEventHandler = notificationIntegrationEventHandler;
|
this.notifyIntegrationEventHandler = notifyIntegrationEventHandler;
|
||||||
this.notificationProperties = notificationProperties;
|
this.notificationProperties = notificationProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class ContactSupportServiceImpl implements ContactSupportService {
|
||||||
logger.debug(new MapLogEntry("send contact email").And("model", model));
|
logger.debug(new MapLogEntry("send contact email").And("model", model));
|
||||||
this.authorizationService.authorizeForce(Permission.SendContactSupport);
|
this.authorizationService.authorizeForce(Permission.SendContactSupport);
|
||||||
|
|
||||||
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||||
|
|
||||||
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(this.userScope.getUserId());
|
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(this.userScope.getUserId());
|
||||||
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
|
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
|
||||||
|
@ -86,7 +86,7 @@ public class ContactSupportServiceImpl implements ContactSupportService {
|
||||||
data.setFields(fieldInfoList);
|
data.setFields(fieldInfoList);
|
||||||
event.setData(jsonHandlingService.toJsonSafe(data));
|
event.setData(jsonHandlingService.toJsonSafe(data));
|
||||||
|
|
||||||
notificationIntegrationEventHandler.handle(event);
|
notifyIntegrationEventHandler.handle(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,7 +94,7 @@ public class ContactSupportServiceImpl implements ContactSupportService {
|
||||||
logger.debug(new MapLogEntry("public send contact email").And("model", model));
|
logger.debug(new MapLogEntry("public send contact email").And("model", model));
|
||||||
this.authorizationService.authorizeForce(Permission.PublicSendContactSupport);
|
this.authorizationService.authorizeForce(Permission.PublicSendContactSupport);
|
||||||
|
|
||||||
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||||
|
|
||||||
List<ContactPair> contactPairs = new ArrayList<>();
|
List<ContactPair> contactPairs = new ArrayList<>();
|
||||||
contactPairs.add(new ContactPair(ContactInfoType.Email, notificationProperties.getContactSupportEmail()));
|
contactPairs.add(new ContactPair(ContactInfoType.Email, notificationProperties.getContactSupportEmail()));
|
||||||
|
@ -112,7 +112,7 @@ public class ContactSupportServiceImpl implements ContactSupportService {
|
||||||
data.setFields(fieldInfoList);
|
data.setFields(fieldInfoList);
|
||||||
event.setData(jsonHandlingService.toJsonSafe(data));
|
event.setData(jsonHandlingService.toJsonSafe(data));
|
||||||
|
|
||||||
notificationIntegrationEventHandler.handle(event);
|
notifyIntegrationEventHandler.handle(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package eu.eudat.service.description;
|
package eu.eudat.service.description;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.commons.JsonHandlingService;
|
import eu.eudat.commons.JsonHandlingService;
|
||||||
|
@ -21,8 +20,8 @@ import eu.eudat.data.*;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.event.DescriptionTouchedEvent;
|
import eu.eudat.event.DescriptionTouchedEvent;
|
||||||
import eu.eudat.event.EventBroker;
|
import eu.eudat.event.EventBroker;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEvent;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEventHandler;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
||||||
import eu.eudat.model.*;
|
import eu.eudat.model.*;
|
||||||
import eu.eudat.model.builder.DescriptionBuilder;
|
import eu.eudat.model.builder.DescriptionBuilder;
|
||||||
import eu.eudat.model.deleter.DescriptionDeleter;
|
import eu.eudat.model.deleter.DescriptionDeleter;
|
||||||
|
@ -100,7 +99,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
private final XmlHandlingService xmlHandlingService;
|
private final XmlHandlingService xmlHandlingService;
|
||||||
private final FileTransformerService fileTransformerService;
|
private final FileTransformerService fileTransformerService;
|
||||||
|
|
||||||
private final NotificationIntegrationEventHandler eventHandler;
|
private final NotifyIntegrationEventHandler eventHandler;
|
||||||
|
|
||||||
private final NotificationProperties notificationProperties;
|
private final NotificationProperties notificationProperties;
|
||||||
|
|
||||||
|
@ -109,18 +108,18 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public DescriptionServiceImpl(
|
public DescriptionServiceImpl(
|
||||||
EntityManager entityManager,
|
EntityManager entityManager,
|
||||||
AuthorizationService authorizationService,
|
AuthorizationService authorizationService,
|
||||||
DeleterFactory deleterFactory,
|
DeleterFactory deleterFactory,
|
||||||
BuilderFactory builderFactory,
|
BuilderFactory builderFactory,
|
||||||
ConventionService conventionService,
|
ConventionService conventionService,
|
||||||
ErrorThesaurusProperties errors,
|
ErrorThesaurusProperties errors,
|
||||||
MessageSource messageSource,
|
MessageSource messageSource,
|
||||||
EventBroker eventBroker,
|
EventBroker eventBroker,
|
||||||
QueryFactory queryFactory,
|
QueryFactory queryFactory,
|
||||||
JsonHandlingService jsonHandlingService,
|
JsonHandlingService jsonHandlingService,
|
||||||
UserScope userScope,
|
UserScope userScope,
|
||||||
XmlHandlingService xmlHandlingService, NotificationIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, FileTransformerService fileTransformerService, ElasticService elasticService) {
|
XmlHandlingService xmlHandlingService, NotifyIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, FileTransformerService fileTransformerService, ElasticService elasticService) {
|
||||||
this.entityManager = entityManager;
|
this.entityManager = entityManager;
|
||||||
this.authorizationService = authorizationService;
|
this.authorizationService = authorizationService;
|
||||||
this.deleterFactory = deleterFactory;
|
this.deleterFactory = deleterFactory;
|
||||||
|
@ -225,7 +224,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createDescriptionNotificationEvent(DescriptionEntity description, UserEntity user, NotificationContactType type) throws InvalidApplicationException {
|
private void createDescriptionNotificationEvent(DescriptionEntity description, UserEntity user, NotificationContactType type) throws InvalidApplicationException {
|
||||||
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||||
event.setUserId(this.userScope.getUserId());
|
event.setUserId(this.userScope.getUserId());
|
||||||
|
|
||||||
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(user.getId());
|
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(user.getId());
|
||||||
|
@ -250,7 +249,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
eventHandler.handle(event);
|
eventHandler.handle(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
private NotificationIntegrationEvent applyNotificationType(DescriptionStatus status, NotificationIntegrationEvent event) {
|
private NotifyIntegrationEvent applyNotificationType(DescriptionStatus status, NotifyIntegrationEvent event) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case Draft:
|
case Draft:
|
||||||
event.setNotificationType(notificationProperties.getDescriptionModifiedType());
|
event.setNotificationType(notificationProperties.getDescriptionModifiedType());
|
||||||
|
|
|
@ -19,8 +19,8 @@ import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
import eu.eudat.data.UserDescriptionTemplateEntity;
|
import eu.eudat.data.UserDescriptionTemplateEntity;
|
||||||
import eu.eudat.data.UserEntity;
|
import eu.eudat.data.UserEntity;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEvent;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEventHandler;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
||||||
import eu.eudat.model.DescriptionTemplate;
|
import eu.eudat.model.DescriptionTemplate;
|
||||||
import eu.eudat.model.UserContactInfo;
|
import eu.eudat.model.UserContactInfo;
|
||||||
import eu.eudat.model.builder.DescriptionTemplateBuilder;
|
import eu.eudat.model.builder.DescriptionTemplateBuilder;
|
||||||
|
@ -116,7 +116,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
|
|
||||||
private final JsonHandlingService jsonHandlingService;
|
private final JsonHandlingService jsonHandlingService;
|
||||||
|
|
||||||
private final NotificationIntegrationEventHandler eventHandler;
|
private final NotifyIntegrationEventHandler eventHandler;
|
||||||
|
|
||||||
private final NotificationProperties notificationProperties;
|
private final NotificationProperties notificationProperties;
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
ResponseUtilsService responseUtilsService,
|
ResponseUtilsService responseUtilsService,
|
||||||
StorageFileService storageFileService,
|
StorageFileService storageFileService,
|
||||||
JsonHandlingService jsonHandlingService,
|
JsonHandlingService jsonHandlingService,
|
||||||
NotificationIntegrationEventHandler eventHandler,
|
NotifyIntegrationEventHandler eventHandler,
|
||||||
NotificationProperties notificationProperties,
|
NotificationProperties notificationProperties,
|
||||||
ValidatorFactory validatorFactory) {
|
ValidatorFactory validatorFactory) {
|
||||||
this.entityManager = entityManager;
|
this.entityManager = entityManager;
|
||||||
|
@ -237,8 +237,8 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendDescriptionTemplateInvitationEvent(UserDescriptionTemplateEntity userDescriptionTemplate, NotificationContactType type) throws InvalidApplicationException {
|
private void sendDescriptionTemplateInvitationEvent(UserDescriptionTemplateEntity userDescriptionTemplate, NotificationContactType type) throws InvalidApplicationException {
|
||||||
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||||
event.setTenant(tenantScope.getTenant());
|
event.setTenantId(tenantScope.getTenant());
|
||||||
event.setUserId(userScope.getUserIdSafe());
|
event.setUserId(userScope.getUserIdSafe());
|
||||||
|
|
||||||
UserEntity user = this.entityManager.find(UserEntity.class, userDescriptionTemplate.getUserId());
|
UserEntity user = this.entityManager.find(UserEntity.class, userDescriptionTemplate.getUserId());
|
||||||
|
|
|
@ -22,8 +22,8 @@ import eu.eudat.data.*;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.event.DmpTouchedEvent;
|
import eu.eudat.event.DmpTouchedEvent;
|
||||||
import eu.eudat.event.EventBroker;
|
import eu.eudat.event.EventBroker;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEvent;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEventHandler;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
||||||
import eu.eudat.model.Dmp;
|
import eu.eudat.model.Dmp;
|
||||||
import eu.eudat.model.DmpUser;
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.model.Reference;
|
import eu.eudat.model.Reference;
|
||||||
|
@ -112,29 +112,37 @@ public class DmpServiceImpl implements DmpService {
|
||||||
private final DescriptionService descriptionService;
|
private final DescriptionService descriptionService;
|
||||||
private final FileTransformerService fileTransformerService;
|
private final FileTransformerService fileTransformerService;
|
||||||
|
|
||||||
private final NotificationIntegrationEventHandler eventHandler;
|
private final NotifyIntegrationEventHandler eventHandler;
|
||||||
|
|
||||||
private final NotificationProperties notificationProperties;
|
private final NotificationProperties notificationProperties;
|
||||||
|
|
||||||
private final ActionConfirmationService actionConfirmationService;
|
private final ActionConfirmationService actionConfirmationService;
|
||||||
|
|
||||||
private final ValidatorFactory validatorFactory;
|
private final gr.cite.tools.validation.ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
private final ElasticService elasticService;
|
private final ElasticService elasticService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public DmpServiceImpl(
|
public DmpServiceImpl(
|
||||||
EntityManager entityManager,
|
EntityManager entityManager,
|
||||||
AuthorizationService authorizationService,
|
AuthorizationService authorizationService,
|
||||||
DeleterFactory deleterFactory,
|
DeleterFactory deleterFactory,
|
||||||
BuilderFactory builderFactory,
|
BuilderFactory builderFactory,
|
||||||
QueryFactory queryFactory,
|
QueryFactory queryFactory,
|
||||||
ConventionService conventionService,
|
ConventionService conventionService,
|
||||||
ErrorThesaurusProperties errors,
|
ErrorThesaurusProperties errors,
|
||||||
MessageSource messageSource,
|
MessageSource messageSource,
|
||||||
XmlHandlingService xmlHandlingService,
|
XmlHandlingService xmlHandlingService,
|
||||||
JsonHandlingService jsonHandlingService,
|
JsonHandlingService jsonHandlingService,
|
||||||
UserScope userScope, EventBroker eventBroker, DescriptionService descriptionService, NotificationIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, ActionConfirmationService actionConfirmationService, FileTransformerService fileTransformerService, ValidatorFactory validatorFactory, ElasticService elasticService) {
|
UserScope userScope,
|
||||||
|
EventBroker eventBroker,
|
||||||
|
DescriptionService descriptionService,
|
||||||
|
NotifyIntegrationEventHandler eventHandler,
|
||||||
|
NotificationProperties notificationProperties,
|
||||||
|
ActionConfirmationService actionConfirmationService,
|
||||||
|
FileTransformerService fileTransformerService,
|
||||||
|
ValidatorFactory validatorFactory,
|
||||||
|
ElasticService elasticService) {
|
||||||
this.entityManager = entityManager;
|
this.entityManager = entityManager;
|
||||||
this.authorizationService = authorizationService;
|
this.authorizationService = authorizationService;
|
||||||
this.deleterFactory = deleterFactory;
|
this.deleterFactory = deleterFactory;
|
||||||
|
@ -196,7 +204,7 @@ public class DmpServiceImpl implements DmpService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createDmpNotificationEvent(DmpEntity dmp, UserEntity user, NotificationContactType type) throws InvalidApplicationException {
|
private void createDmpNotificationEvent(DmpEntity dmp, UserEntity user, NotificationContactType type) throws InvalidApplicationException {
|
||||||
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||||
event.setUserId(this.userScope.getUserId());
|
event.setUserId(this.userScope.getUserId());
|
||||||
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(user.getId());
|
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(user.getId());
|
||||||
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
|
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
|
||||||
|
@ -220,7 +228,7 @@ public class DmpServiceImpl implements DmpService {
|
||||||
eventHandler.handle(event);
|
eventHandler.handle(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
private NotificationIntegrationEvent applyNotificationType(DmpStatus status, NotificationIntegrationEvent event) {
|
private NotifyIntegrationEvent applyNotificationType(DmpStatus status, NotifyIntegrationEvent event) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case Draft:
|
case Draft:
|
||||||
event.setNotificationType(notificationProperties.getDmpModifiedType());
|
event.setNotificationType(notificationProperties.getDmpModifiedType());
|
||||||
|
@ -785,7 +793,7 @@ public class DmpServiceImpl implements DmpService {
|
||||||
|
|
||||||
private void createDmpInvitationExistingUserEvent(UserEntity recipient, DmpEntity dmp, DmpUserRole role, String email, NotificationContactType type) throws InvalidApplicationException {
|
private void createDmpInvitationExistingUserEvent(UserEntity recipient, DmpEntity dmp, DmpUserRole role, String email, NotificationContactType type) throws InvalidApplicationException {
|
||||||
|
|
||||||
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||||
event.setUserId(this.userScope.getUserIdSafe());
|
event.setUserId(this.userScope.getUserIdSafe());
|
||||||
|
|
||||||
List<ContactPair> contactPairs = new ArrayList<>();
|
List<ContactPair> contactPairs = new ArrayList<>();
|
||||||
|
@ -809,7 +817,7 @@ public class DmpServiceImpl implements DmpService {
|
||||||
private void sendDmpInvitationExternalUser(String email, DmpEntity dmp, DmpUserRole role) throws JAXBException, InvalidApplicationException {
|
private void sendDmpInvitationExternalUser(String email, DmpEntity dmp, DmpUserRole role) throws JAXBException, InvalidApplicationException {
|
||||||
String token = this.createActionConfirmation(email, dmp, role);
|
String token = this.createActionConfirmation(email, dmp, role);
|
||||||
|
|
||||||
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||||
event.setUserId(this.userScope.getUserIdSafe());
|
event.setUserId(this.userScope.getUserIdSafe());
|
||||||
|
|
||||||
List<ContactPair> contactPairs = new ArrayList<>();
|
List<ContactPair> contactPairs = new ArrayList<>();
|
||||||
|
|
|
@ -23,8 +23,8 @@ import eu.eudat.data.*;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.event.UserTouchedEvent;
|
import eu.eudat.event.UserTouchedEvent;
|
||||||
import eu.eudat.event.EventBroker;
|
import eu.eudat.event.EventBroker;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEvent;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEventHandler;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
||||||
import eu.eudat.model.User;
|
import eu.eudat.model.User;
|
||||||
import eu.eudat.model.UserContactInfo;
|
import eu.eudat.model.UserContactInfo;
|
||||||
import eu.eudat.model.UserCredential;
|
import eu.eudat.model.UserCredential;
|
||||||
|
@ -99,7 +99,7 @@ public class UserServiceImpl implements UserService {
|
||||||
private final KeycloakService keycloakService;
|
private final KeycloakService keycloakService;
|
||||||
private final ActionConfirmationService actionConfirmationService;
|
private final ActionConfirmationService actionConfirmationService;
|
||||||
private final NotificationProperties notificationProperties;
|
private final NotificationProperties notificationProperties;
|
||||||
private final NotificationIntegrationEventHandler eventHandler;
|
private final NotifyIntegrationEventHandler eventHandler;
|
||||||
|
|
||||||
private final ValidatorFactory validatorFactory;
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
@ -107,17 +107,17 @@ public class UserServiceImpl implements UserService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public UserServiceImpl(
|
public UserServiceImpl(
|
||||||
EntityManager entityManager,
|
EntityManager entityManager,
|
||||||
AuthorizationService authorizationService,
|
AuthorizationService authorizationService,
|
||||||
DeleterFactory deleterFactory,
|
DeleterFactory deleterFactory,
|
||||||
BuilderFactory builderFactory,
|
BuilderFactory builderFactory,
|
||||||
ConventionService conventionService,
|
ConventionService conventionService,
|
||||||
ErrorThesaurusProperties errors,
|
ErrorThesaurusProperties errors,
|
||||||
MessageSource messageSource,
|
MessageSource messageSource,
|
||||||
EventBroker eventBroker,
|
EventBroker eventBroker,
|
||||||
JsonHandlingService jsonHandlingService,
|
JsonHandlingService jsonHandlingService,
|
||||||
XmlHandlingService xmlHandlingService, QueryFactory queryFactory,
|
XmlHandlingService xmlHandlingService, QueryFactory queryFactory,
|
||||||
UserScope userScope, KeycloakService keycloakService, ActionConfirmationService actionConfirmationService, NotificationProperties notificationProperties, NotificationIntegrationEventHandler eventHandler, ValidatorFactory validatorFactory, ElasticService elasticService) {
|
UserScope userScope, KeycloakService keycloakService, ActionConfirmationService actionConfirmationService, NotificationProperties notificationProperties, NotifyIntegrationEventHandler eventHandler, ValidatorFactory validatorFactory, ElasticService elasticService) {
|
||||||
this.entityManager = entityManager;
|
this.entityManager = entityManager;
|
||||||
this.authorizationService = authorizationService;
|
this.authorizationService = authorizationService;
|
||||||
this.deleterFactory = deleterFactory;
|
this.deleterFactory = deleterFactory;
|
||||||
|
@ -363,7 +363,7 @@ public class UserServiceImpl implements UserService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createMergeNotificationEvent(String token, UserEntity user, String email, NotificationContactType type) throws InvalidApplicationException {
|
private void createMergeNotificationEvent(String token, UserEntity user, String email, NotificationContactType type) throws InvalidApplicationException {
|
||||||
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||||
event.setUserId(user.getId());
|
event.setUserId(user.getId());
|
||||||
List<ContactPair> contactPairs = new ArrayList<>();
|
List<ContactPair> contactPairs = new ArrayList<>();
|
||||||
contactPairs.add(new ContactPair(ContactInfoType.Email, email));
|
contactPairs.add(new ContactPair(ContactInfoType.Email, email));
|
||||||
|
@ -393,7 +393,7 @@ public class UserServiceImpl implements UserService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createRemoveCredentialNotificationEvent(String token, UUID userId, NotificationContactType type) throws InvalidApplicationException {
|
private void createRemoveCredentialNotificationEvent(String token, UUID userId, NotificationContactType type) throws InvalidApplicationException {
|
||||||
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||||
event.setUserId(userId);
|
event.setUserId(userId);
|
||||||
event.setContactTypeHint(type);
|
event.setContactTypeHint(type);
|
||||||
event.setNotificationType(notificationProperties.getRemoveCredentialConfirmationType());
|
event.setNotificationType(notificationProperties.getRemoveCredentialConfirmationType());
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
artifactId=core
|
|
||||||
groupId=eu.eudat
|
|
||||||
version=1.0.0-SNAPSHOT
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
|
@ -9,7 +9,7 @@ spring:
|
||||||
queue:
|
queue:
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
enable: false
|
enable: false
|
||||||
app-id: ${THE_API_ID}
|
app-id: ${QUEUE_APP_ID}
|
||||||
durable: null
|
durable: null
|
||||||
queue: null
|
queue: null
|
||||||
exchange: null
|
exchange: null
|
||||||
|
|
|
@ -9,7 +9,7 @@ spring:
|
||||||
queue:
|
queue:
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
enable: false
|
enable: false
|
||||||
app-id: ${THE_API_ID}
|
app-id: ${QUEUE_APP_ID}
|
||||||
durable: null
|
durable: null
|
||||||
queue: null
|
queue: null
|
||||||
exchange: null
|
exchange: null
|
||||||
|
|
|
@ -2,10 +2,14 @@ package gr.cite.notification.data;
|
||||||
|
|
||||||
import gr.cite.notification.common.enums.IsActive;
|
import gr.cite.notification.common.enums.IsActive;
|
||||||
import gr.cite.notification.data.conventers.IsActiveConverter;
|
import gr.cite.notification.data.conventers.IsActiveConverter;
|
||||||
|
import gr.cite.notification.data.types.JsonSQLType;
|
||||||
import gr.cite.queueinbox.entity.QueueInbox;
|
import gr.cite.queueinbox.entity.QueueInbox;
|
||||||
import gr.cite.queueinbox.entity.QueueInboxStatus;
|
import gr.cite.queueinbox.entity.QueueInboxStatus;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
import org.hibernate.usertype.UserType;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -37,6 +41,7 @@ public class QueueInboxEntity implements QueueInbox {
|
||||||
private UUID messageId;
|
private UUID messageId;
|
||||||
public final static String _messageId = "messageId";
|
public final static String _messageId = "messageId";
|
||||||
|
|
||||||
|
@Type(JsonSQLType.class)
|
||||||
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
||||||
private String message;
|
private String message;
|
||||||
public final static String _message = "message";
|
public final static String _message = "message";
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
package gr.cite.notification.data.types;
|
||||||
|
|
||||||
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
|
import org.hibernate.type.SqlTypes;
|
||||||
|
import org.hibernate.usertype.UserType;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Types;
|
||||||
|
|
||||||
|
public class JsonSQLType implements UserType<String> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSqlType() {
|
||||||
|
return SqlTypes.JSON;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<String> returnedClass() {
|
||||||
|
return String.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(String x, String y) {
|
||||||
|
if (x == null) {
|
||||||
|
return y == null;
|
||||||
|
} else {
|
||||||
|
return x.equals(y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode(String x) {
|
||||||
|
return x.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String nullSafeGet(ResultSet rs, int position, SharedSessionContractImplementor session, Object owner) throws SQLException {
|
||||||
|
String json = rs.getString(position);
|
||||||
|
return rs.wasNull() ? null : json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void nullSafeSet(PreparedStatement st, String value, int index, SharedSessionContractImplementor session) throws SQLException {
|
||||||
|
if (value == null) {
|
||||||
|
st.setNull(index, Types.OTHER);
|
||||||
|
} else {
|
||||||
|
st.setObject(index, value, Types.OTHER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String deepCopy(String value) throws HibernateException {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isMutable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Serializable disassemble(String value) throws HibernateException {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String assemble(Serializable cached, Object owner) throws HibernateException {
|
||||||
|
return (String) cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String replace(String original, String target, Object owner) throws HibernateException {
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -48,4 +48,5 @@ public class AppRabbitConfigurer extends RabbitConfigurer {
|
||||||
return inboxRepository.create(params) != null;
|
return inboxRepository.create(params) != null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,31 +4,30 @@ import gr.cite.notification.integrationevent.inbox.InboxProperties;
|
||||||
import gr.cite.notification.integrationevent.inbox.InboxRepositoryImpl;
|
import gr.cite.notification.integrationevent.inbox.InboxRepositoryImpl;
|
||||||
import gr.cite.queueinbox.InboxConfigurer;
|
import gr.cite.queueinbox.InboxConfigurer;
|
||||||
import gr.cite.queueinbox.repository.InboxRepository;
|
import gr.cite.queueinbox.repository.InboxRepository;
|
||||||
import jakarta.persistence.EntityManagerFactory;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.DependsOn;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties({InboxProperties.class})
|
@EnableConfigurationProperties({InboxProperties.class})
|
||||||
@ConditionalOnProperty(prefix = "queue.task.listener", name = "enable", matchIfMissing = false)
|
@ConditionalOnProperty(prefix = "queue.task.listener", name = "enable", matchIfMissing = false)
|
||||||
public class InboxIntegrationEventConfigurer extends InboxConfigurer {
|
public class InboxIntegrationEventConfigurer extends InboxConfigurer {
|
||||||
private ApplicationContext applicationContext;
|
|
||||||
private InboxProperties inboxProperties;
|
|
||||||
|
|
||||||
public InboxIntegrationEventConfigurer(ApplicationContext applicationContext, InboxProperties inboxProperties) {
|
private ApplicationContext applicationContext;
|
||||||
this.applicationContext = applicationContext;
|
|
||||||
this.inboxProperties = inboxProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
private InboxProperties inboxProperties;
|
||||||
public InboxRepository inboxRepositoryCreator() {
|
|
||||||
return new InboxRepositoryImpl(this.applicationContext, this.inboxProperties);
|
public InboxIntegrationEventConfigurer(ApplicationContext applicationContext, InboxProperties inboxProperties) {
|
||||||
}
|
this.applicationContext = applicationContext;
|
||||||
|
this.inboxProperties = inboxProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public InboxRepository inboxRepositoryCreator() {
|
||||||
|
return new InboxRepositoryImpl(this.applicationContext, this.inboxProperties);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@ public class NotifyIntegrationEvent extends TrackedEvent {
|
||||||
|
|
||||||
private String provenanceRef;
|
private String provenanceRef;
|
||||||
|
|
||||||
|
public NotifyIntegrationEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
public UUID getUserId() {
|
public UUID getUserId() {
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ public class NotifyIntegrationEventHandlerImpl implements NotifyIntegrationEvent
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.error("Problem getting list of queue outbox. Skipping: {}", ex.getMessage(), ex);
|
logger.error("Problem getting list of queue outbox. Skipping: {}", ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
return null;
|
return EventProcessingStatus.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>gr.cite</groupId>
|
<groupId>gr.cite</groupId>
|
||||||
<artifactId>rabbitmq-core</artifactId>
|
<artifactId>rabbitmq-core</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>2.1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -9,7 +9,7 @@ spring:
|
||||||
queue:
|
queue:
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
enable: false
|
enable: false
|
||||||
app-id: ${THE_API_ID}
|
app-id: ${QUEUE_APP_ID}
|
||||||
durable: null
|
durable: null
|
||||||
queue: null
|
queue: null
|
||||||
exchange: null
|
exchange: null
|
||||||
|
|
Loading…
Reference in New Issue