Compare commits

..

No commits in common. "53062a879f8c50747e4d1935d27594435c77a788" and "698c27747d4f599bbba024f0d42132d3e0a85ce3" have entirely different histories.

23 changed files with 130 additions and 323 deletions

View File

@ -2,11 +2,9 @@ package eu.eudat.data;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.types.JsonSQLType;
import gr.cite.queueinbox.entity.QueueInbox;
import gr.cite.queueinbox.entity.QueueInboxStatus;
import jakarta.persistence.*;
import org.hibernate.annotations.Type;
import java.time.Instant;
import java.util.UUID;
@ -39,7 +37,6 @@ public class QueueInboxEntity implements QueueInbox {
private UUID messageId;
public final static String _messageId = "messageId";
@Type(JsonSQLType.class)
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
private String message;
public final static String _message = "message";

View File

@ -1,80 +0,0 @@
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;
}
}

View File

@ -5,25 +5,16 @@ import eu.eudat.integrationevent.TrackedEvent;
import java.util.UUID;
public class NotifyIntegrationEvent extends TrackedEvent {
public class NotificationIntegrationEvent extends TrackedEvent {
private UUID userId;
private UUID tenantId;
private UUID tenant;
private UUID notificationType;
private NotificationContactType contactTypeHint;
private String contactHint;
private String data;
private String provenanceRef;
public NotifyIntegrationEvent() {
}
public UUID getUserId() {
return userId;
}
@ -32,12 +23,12 @@ public class NotifyIntegrationEvent extends TrackedEvent {
this.userId = userId;
}
public UUID getTenantId() {
return tenantId;
public UUID getTenant() {
return tenant;
}
public void setTenantId(UUID tenantId) {
this.tenantId = tenantId;
public void setTenant(UUID tenant) {
this.tenant = tenant;
}
public UUID getNotificationType() {

View File

@ -0,0 +1,7 @@
package eu.eudat.integrationevent.outbox.notification;
import javax.management.InvalidApplicationException;
public interface NotificationIntegrationEventHandler {
void handle(NotificationIntegrationEvent event) throws InvalidApplicationException;
}

View File

@ -1,6 +1,10 @@
package eu.eudat.integrationevent.outbox.notification;
import eu.eudat.audit.AuditableAction;
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.UserEntity;
import eu.eudat.integrationevent.outbox.OutboxIntegrationEvent;
@ -20,14 +24,15 @@ import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.RequestScope;
import javax.management.InvalidApplicationException;
import java.time.Instant;
import java.util.List;
import java.util.UUID;
@Component
@RequestScope
public class NotifyIntegrationEventHandlerImpl implements NotifyIntegrationEventHandler {
public class NotificationIntegrationEventHandlerImpl implements NotificationIntegrationEventHandler {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(NotifyIntegrationEventHandlerImpl.class));
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(NotificationIntegrationEventHandlerImpl.class));
private final NotificationService notificationService;
@ -40,7 +45,7 @@ public class NotifyIntegrationEventHandlerImpl implements NotifyIntegrationEvent
private final ValidatorFactory validatorFactory;
@Autowired
public NotifyIntegrationEventHandlerImpl(
public NotificationIntegrationEventHandlerImpl(
OutboxService outboxService,
NotificationService notificationService,
QueryFactory queryFactory,
@ -53,12 +58,31 @@ public class NotifyIntegrationEventHandlerImpl implements NotifyIntegrationEvent
}
@Override
public void handle(NotifyIntegrationEvent event) throws InvalidApplicationException {
public void handle(NotificationIntegrationEvent event) throws InvalidApplicationException {
OutboxIntegrationEvent message = new OutboxIntegrationEvent();
message.setMessageId(UUID.randomUUID());
message.setType(OutboxIntegrationEvent.NOTIFY);
message.setEvent(event);
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) {

View File

@ -1,7 +0,0 @@
package eu.eudat.integrationevent.outbox.notification;
import javax.management.InvalidApplicationException;
public interface NotifyIntegrationEventHandler {
void handle(NotifyIntegrationEvent event) throws InvalidApplicationException;
}

View File

@ -8,8 +8,8 @@ import eu.eudat.commons.scope.user.UserScope;
import eu.eudat.commons.types.notification.*;
import eu.eudat.configurations.notification.NotificationProperties;
import eu.eudat.data.UserContactInfoEntity;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEventHandler;
import eu.eudat.model.UserContactInfo;
import eu.eudat.model.persist.ContactSupportPersist;
import eu.eudat.model.persist.PublicContactSupportPersist;
@ -41,7 +41,7 @@ public class ContactSupportServiceImpl implements ContactSupportService {
private final UserScope userScope;
private final NotifyIntegrationEventHandler notifyIntegrationEventHandler;
private final NotificationIntegrationEventHandler notificationIntegrationEventHandler;
private final NotificationProperties notificationProperties;
@Autowired
@ -50,13 +50,13 @@ public class ContactSupportServiceImpl implements ContactSupportService {
QueryFactory queryFactory,
JsonHandlingService jsonHandlingService,
UserScope userScope,
NotifyIntegrationEventHandler notifyIntegrationEventHandler,
NotificationIntegrationEventHandler notificationIntegrationEventHandler,
NotificationProperties notificationProperties) {
this.authorizationService = authorizationService;
this.queryFactory = queryFactory;
this.jsonHandlingService = jsonHandlingService;
this.userScope = userScope;
this.notifyIntegrationEventHandler = notifyIntegrationEventHandler;
this.notificationIntegrationEventHandler = notificationIntegrationEventHandler;
this.notificationProperties = notificationProperties;
}
@ -65,7 +65,7 @@ public class ContactSupportServiceImpl implements ContactSupportService {
logger.debug(new MapLogEntry("send contact email").And("model", model));
this.authorizationService.authorizeForce(Permission.SendContactSupport);
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(this.userScope.getUserId());
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
@ -86,7 +86,7 @@ public class ContactSupportServiceImpl implements ContactSupportService {
data.setFields(fieldInfoList);
event.setData(jsonHandlingService.toJsonSafe(data));
notifyIntegrationEventHandler.handle(event);
notificationIntegrationEventHandler.handle(event);
}
@Override
@ -94,7 +94,7 @@ public class ContactSupportServiceImpl implements ContactSupportService {
logger.debug(new MapLogEntry("public send contact email").And("model", model));
this.authorizationService.authorizeForce(Permission.PublicSendContactSupport);
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
List<ContactPair> contactPairs = new ArrayList<>();
contactPairs.add(new ContactPair(ContactInfoType.Email, notificationProperties.getContactSupportEmail()));
@ -112,7 +112,7 @@ public class ContactSupportServiceImpl implements ContactSupportService {
data.setFields(fieldInfoList);
event.setData(jsonHandlingService.toJsonSafe(data));
notifyIntegrationEventHandler.handle(event);
notificationIntegrationEventHandler.handle(event);
}

View File

@ -1,5 +1,6 @@
package eu.eudat.service.description;
import com.fasterxml.jackson.core.JsonProcessingException;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission;
import eu.eudat.commons.JsonHandlingService;
@ -20,8 +21,8 @@ import eu.eudat.data.*;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.event.DescriptionTouchedEvent;
import eu.eudat.event.EventBroker;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEventHandler;
import eu.eudat.model.*;
import eu.eudat.model.builder.DescriptionBuilder;
import eu.eudat.model.deleter.DescriptionDeleter;
@ -99,7 +100,7 @@ public class DescriptionServiceImpl implements DescriptionService {
private final XmlHandlingService xmlHandlingService;
private final FileTransformerService fileTransformerService;
private final NotifyIntegrationEventHandler eventHandler;
private final NotificationIntegrationEventHandler eventHandler;
private final NotificationProperties notificationProperties;
@ -108,18 +109,18 @@ public class DescriptionServiceImpl implements DescriptionService {
@Autowired
public DescriptionServiceImpl(
EntityManager entityManager,
AuthorizationService authorizationService,
DeleterFactory deleterFactory,
BuilderFactory builderFactory,
ConventionService conventionService,
ErrorThesaurusProperties errors,
MessageSource messageSource,
EventBroker eventBroker,
QueryFactory queryFactory,
JsonHandlingService jsonHandlingService,
UserScope userScope,
XmlHandlingService xmlHandlingService, NotifyIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, FileTransformerService fileTransformerService, ElasticService elasticService) {
EntityManager entityManager,
AuthorizationService authorizationService,
DeleterFactory deleterFactory,
BuilderFactory builderFactory,
ConventionService conventionService,
ErrorThesaurusProperties errors,
MessageSource messageSource,
EventBroker eventBroker,
QueryFactory queryFactory,
JsonHandlingService jsonHandlingService,
UserScope userScope,
XmlHandlingService xmlHandlingService, NotificationIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, FileTransformerService fileTransformerService, ElasticService elasticService) {
this.entityManager = entityManager;
this.authorizationService = authorizationService;
this.deleterFactory = deleterFactory;
@ -224,7 +225,7 @@ public class DescriptionServiceImpl implements DescriptionService {
}
private void createDescriptionNotificationEvent(DescriptionEntity description, UserEntity user, NotificationContactType type) throws InvalidApplicationException {
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
event.setUserId(this.userScope.getUserId());
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(user.getId());
@ -249,7 +250,7 @@ public class DescriptionServiceImpl implements DescriptionService {
eventHandler.handle(event);
}
private NotifyIntegrationEvent applyNotificationType(DescriptionStatus status, NotifyIntegrationEvent event) {
private NotificationIntegrationEvent applyNotificationType(DescriptionStatus status, NotificationIntegrationEvent event) {
switch (status) {
case Draft:
event.setNotificationType(notificationProperties.getDescriptionModifiedType());

View File

@ -19,8 +19,8 @@ import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.data.UserDescriptionTemplateEntity;
import eu.eudat.data.UserEntity;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEventHandler;
import eu.eudat.model.DescriptionTemplate;
import eu.eudat.model.UserContactInfo;
import eu.eudat.model.builder.DescriptionTemplateBuilder;
@ -116,7 +116,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
private final JsonHandlingService jsonHandlingService;
private final NotifyIntegrationEventHandler eventHandler;
private final NotificationIntegrationEventHandler eventHandler;
private final NotificationProperties notificationProperties;
@ -137,7 +137,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
ResponseUtilsService responseUtilsService,
StorageFileService storageFileService,
JsonHandlingService jsonHandlingService,
NotifyIntegrationEventHandler eventHandler,
NotificationIntegrationEventHandler eventHandler,
NotificationProperties notificationProperties,
ValidatorFactory validatorFactory) {
this.entityManager = entityManager;
@ -237,8 +237,8 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
}
private void sendDescriptionTemplateInvitationEvent(UserDescriptionTemplateEntity userDescriptionTemplate, NotificationContactType type) throws InvalidApplicationException {
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
event.setTenantId(tenantScope.getTenant());
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
event.setTenant(tenantScope.getTenant());
event.setUserId(userScope.getUserIdSafe());
UserEntity user = this.entityManager.find(UserEntity.class, userDescriptionTemplate.getUserId());

View File

@ -22,8 +22,8 @@ import eu.eudat.data.*;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.event.DmpTouchedEvent;
import eu.eudat.event.EventBroker;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEventHandler;
import eu.eudat.model.Dmp;
import eu.eudat.model.DmpUser;
import eu.eudat.model.Reference;
@ -112,37 +112,29 @@ public class DmpServiceImpl implements DmpService {
private final DescriptionService descriptionService;
private final FileTransformerService fileTransformerService;
private final NotifyIntegrationEventHandler eventHandler;
private final NotificationIntegrationEventHandler eventHandler;
private final NotificationProperties notificationProperties;
private final ActionConfirmationService actionConfirmationService;
private final gr.cite.tools.validation.ValidatorFactory validatorFactory;
private final ValidatorFactory validatorFactory;
private final ElasticService elasticService;
@Autowired
public DmpServiceImpl(
EntityManager entityManager,
AuthorizationService authorizationService,
DeleterFactory deleterFactory,
BuilderFactory builderFactory,
QueryFactory queryFactory,
ConventionService conventionService,
ErrorThesaurusProperties errors,
MessageSource messageSource,
XmlHandlingService xmlHandlingService,
JsonHandlingService jsonHandlingService,
UserScope userScope,
EventBroker eventBroker,
DescriptionService descriptionService,
NotifyIntegrationEventHandler eventHandler,
NotificationProperties notificationProperties,
ActionConfirmationService actionConfirmationService,
FileTransformerService fileTransformerService,
ValidatorFactory validatorFactory,
ElasticService elasticService) {
EntityManager entityManager,
AuthorizationService authorizationService,
DeleterFactory deleterFactory,
BuilderFactory builderFactory,
QueryFactory queryFactory,
ConventionService conventionService,
ErrorThesaurusProperties errors,
MessageSource messageSource,
XmlHandlingService xmlHandlingService,
JsonHandlingService jsonHandlingService,
UserScope userScope, EventBroker eventBroker, DescriptionService descriptionService, NotificationIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, ActionConfirmationService actionConfirmationService, FileTransformerService fileTransformerService, ValidatorFactory validatorFactory, ElasticService elasticService) {
this.entityManager = entityManager;
this.authorizationService = authorizationService;
this.deleterFactory = deleterFactory;
@ -204,7 +196,7 @@ public class DmpServiceImpl implements DmpService {
}
private void createDmpNotificationEvent(DmpEntity dmp, UserEntity user, NotificationContactType type) throws InvalidApplicationException {
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
event.setUserId(this.userScope.getUserId());
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(user.getId());
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
@ -228,7 +220,7 @@ public class DmpServiceImpl implements DmpService {
eventHandler.handle(event);
}
private NotifyIntegrationEvent applyNotificationType(DmpStatus status, NotifyIntegrationEvent event) {
private NotificationIntegrationEvent applyNotificationType(DmpStatus status, NotificationIntegrationEvent event) {
switch (status) {
case Draft:
event.setNotificationType(notificationProperties.getDmpModifiedType());
@ -793,7 +785,7 @@ public class DmpServiceImpl implements DmpService {
private void createDmpInvitationExistingUserEvent(UserEntity recipient, DmpEntity dmp, DmpUserRole role, String email, NotificationContactType type) throws InvalidApplicationException {
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
event.setUserId(this.userScope.getUserIdSafe());
List<ContactPair> contactPairs = new ArrayList<>();
@ -817,7 +809,7 @@ public class DmpServiceImpl implements DmpService {
private void sendDmpInvitationExternalUser(String email, DmpEntity dmp, DmpUserRole role) throws JAXBException, InvalidApplicationException {
String token = this.createActionConfirmation(email, dmp, role);
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
event.setUserId(this.userScope.getUserIdSafe());
List<ContactPair> contactPairs = new ArrayList<>();

View File

@ -23,8 +23,8 @@ import eu.eudat.data.*;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.event.UserTouchedEvent;
import eu.eudat.event.EventBroker;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEventHandler;
import eu.eudat.model.User;
import eu.eudat.model.UserContactInfo;
import eu.eudat.model.UserCredential;
@ -99,7 +99,7 @@ public class UserServiceImpl implements UserService {
private final KeycloakService keycloakService;
private final ActionConfirmationService actionConfirmationService;
private final NotificationProperties notificationProperties;
private final NotifyIntegrationEventHandler eventHandler;
private final NotificationIntegrationEventHandler eventHandler;
private final ValidatorFactory validatorFactory;
@ -107,17 +107,17 @@ public class UserServiceImpl implements UserService {
@Autowired
public UserServiceImpl(
EntityManager entityManager,
AuthorizationService authorizationService,
DeleterFactory deleterFactory,
BuilderFactory builderFactory,
ConventionService conventionService,
ErrorThesaurusProperties errors,
MessageSource messageSource,
EventBroker eventBroker,
JsonHandlingService jsonHandlingService,
XmlHandlingService xmlHandlingService, QueryFactory queryFactory,
UserScope userScope, KeycloakService keycloakService, ActionConfirmationService actionConfirmationService, NotificationProperties notificationProperties, NotifyIntegrationEventHandler eventHandler, ValidatorFactory validatorFactory, ElasticService elasticService) {
EntityManager entityManager,
AuthorizationService authorizationService,
DeleterFactory deleterFactory,
BuilderFactory builderFactory,
ConventionService conventionService,
ErrorThesaurusProperties errors,
MessageSource messageSource,
EventBroker eventBroker,
JsonHandlingService jsonHandlingService,
XmlHandlingService xmlHandlingService, QueryFactory queryFactory,
UserScope userScope, KeycloakService keycloakService, ActionConfirmationService actionConfirmationService, NotificationProperties notificationProperties, NotificationIntegrationEventHandler eventHandler, ValidatorFactory validatorFactory, ElasticService elasticService) {
this.entityManager = entityManager;
this.authorizationService = authorizationService;
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 {
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
event.setUserId(user.getId());
List<ContactPair> contactPairs = new ArrayList<>();
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 {
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
event.setUserId(userId);
event.setContactTypeHint(type);
event.setNotificationType(notificationProperties.getRemoveCredentialConfirmationType());

View File

@ -0,0 +1,3 @@
artifactId=core
groupId=eu.eudat
version=1.0.0-SNAPSHOT

View File

@ -1,33 +0,0 @@
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/

View File

@ -9,7 +9,7 @@ spring:
queue:
rabbitmq:
enable: false
app-id: ${QUEUE_APP_ID}
app-id: ${THE_API_ID}
durable: null
queue: null
exchange: null

View File

@ -9,7 +9,7 @@ spring:
queue:
rabbitmq:
enable: false
app-id: ${QUEUE_APP_ID}
app-id: ${THE_API_ID}
durable: null
queue: null
exchange: null

View File

@ -2,14 +2,10 @@ package gr.cite.notification.data;
import gr.cite.notification.common.enums.IsActive;
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.QueueInboxStatus;
import jakarta.persistence.*;
import org.hibernate.annotations.Type;
import org.hibernate.usertype.UserType;
import java.time.Instant;
import java.util.UUID;
@ -41,7 +37,6 @@ public class QueueInboxEntity implements QueueInbox {
private UUID messageId;
public final static String _messageId = "messageId";
@Type(JsonSQLType.class)
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
private String message;
public final static String _message = "message";

View File

@ -1,80 +0,0 @@
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;
}
}

View File

@ -48,5 +48,4 @@ public class AppRabbitConfigurer extends RabbitConfigurer {
return inboxRepository.create(params) != null;
};
}
}

View File

@ -4,30 +4,31 @@ import gr.cite.notification.integrationevent.inbox.InboxProperties;
import gr.cite.notification.integrationevent.inbox.InboxRepositoryImpl;
import gr.cite.queueinbox.InboxConfigurer;
import gr.cite.queueinbox.repository.InboxRepository;
import jakarta.persistence.EntityManagerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;
@Configuration
@EnableConfigurationProperties({InboxProperties.class})
@ConditionalOnProperty(prefix = "queue.task.listener", name = "enable", matchIfMissing = false)
public class InboxIntegrationEventConfigurer extends InboxConfigurer {
private ApplicationContext applicationContext;
private InboxProperties inboxProperties;
private ApplicationContext applicationContext;
public InboxIntegrationEventConfigurer(ApplicationContext applicationContext, InboxProperties inboxProperties) {
this.applicationContext = applicationContext;
this.inboxProperties = inboxProperties;
}
private InboxProperties inboxProperties;
public InboxIntegrationEventConfigurer(ApplicationContext applicationContext, InboxProperties inboxProperties) {
this.applicationContext = applicationContext;
this.inboxProperties = inboxProperties;
}
@Bean
public InboxRepository inboxRepositoryCreator() {
return new InboxRepositoryImpl(this.applicationContext, this.inboxProperties);
}
@Bean
public InboxRepository inboxRepositoryCreator() {
return new InboxRepositoryImpl(this.applicationContext, this.inboxProperties);
}
}

View File

@ -21,9 +21,6 @@ public class NotifyIntegrationEvent extends TrackedEvent {
private String provenanceRef;
public NotifyIntegrationEvent() {
}
public UUID getUserId() {
return userId;
}

View File

@ -150,7 +150,7 @@ public class NotifyIntegrationEventHandlerImpl implements NotifyIntegrationEvent
} catch (Exception ex) {
logger.error("Problem getting list of queue outbox. Skipping: {}", ex.getMessage(), ex);
}
return EventProcessingStatus.Success;
return null;
}
}

View File

@ -130,7 +130,7 @@
<dependency>
<groupId>gr.cite</groupId>
<artifactId>rabbitmq-core</artifactId>
<version>2.1.1</version>
<version>1.0.0</version>
</dependency>
<dependency>

View File

@ -9,7 +9,7 @@ spring:
queue:
rabbitmq:
enable: false
app-id: ${QUEUE_APP_ID}
app-id: ${THE_API_ID}
durable: null
queue: null
exchange: null