From 102141aa0dda2704878f13910b5ae92f60dea33b Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Fri, 29 Mar 2024 14:32:47 +0200 Subject: [PATCH 1/4] update queues to use smallint enums --- annotation-service/annotation/pom.xml | 6 +-- .../annotation/data/QueueInboxEntity.java | 15 +++---- .../annotation/data/QueueOutboxEntity.java | 12 +++--- .../conventers/QueueInboxStatusConverter.java | 19 +++++++++ .../QueueOutboxNotifyStatusConverter.java | 19 +++++++++ annotation-service/pom.xml | 8 ++-- dmp-backend/core/pom.xml | 4 +- .../db/NamingStrategyProperties.java | 20 +++++++++ .../db/PrefixPhysicalNamingStrategy.java | 30 +++++++++++++ .../java/eu/eudat/data/QueueInboxEntity.java | 14 +++---- .../java/eu/eudat/data/QueueOutboxEntity.java | 12 +++--- .../enums/QueueInboxStatusConverter.java | 19 +++++++++ .../QueueOutboxNotifyStatusConverter.java | 19 +++++++++ .../eudat/model/persist/CloneDmpPersist.java | 4 +- .../model/persist/NewVersionDmpPersist.java | 4 +- dmp-backend/pom.xml | 35 ++++------------ .../web/src/main/resources/config/db.yml | 5 ++- .../updates/00.01.029_addQueueOutbox.sql | 2 +- .../updates/00.01.030_addQueueInbox.sql | 8 ++-- .../updates/00.01.037_add_ntf_QueueInbox.sql | 8 ++-- .../updates/00.01.038_add_ntf_QueueOutbox.sql | 2 +- .../updates/00.01.049_Add_ant_QueueInbox.sql | 8 ++-- .../updates/00.01.050_Add_ant_QueueOutbox.sql | 2 +- .../InAppNotificationController.java | 15 +++---- .../UserNotificationPreferenceController.java | 4 +- .../src/main/resources/config/cache.yml | 3 -- .../src/main/resources/config/db.yml | 7 +++- .../src/main/resources/config/email.yml | 14 +++---- .../src/main/resources/config/idpclaims.yml | 2 + .../src/main/resources/config/permissions.yml | 42 ++++++++----------- .../main/resources/config/security-devel.yml | 6 +++ .../src/main/resources/config/security.yml | 16 +++---- .../src/main/resources/config/server.yml | 12 +++++- notification-service/notification/pom.xml | 4 +- .../notification/data/QueueInboxEntity.java | 15 +++---- .../notification/data/QueueOutboxEntity.java | 14 +++---- .../conventers/QueueInboxStatusConverter.java | 19 +++++++++ .../QueueOutboxNotifyStatusConverter.java | 19 +++++++++ .../java/gr/cite/notification/model/User.java | 2 - .../censorship/InAppNotificationCensor.java | 8 +++- .../model/censorship/UserCensor.java | 3 -- .../UserNotificationPreferenceCensor.java | 8 +++- .../InAppNotificationServiceImpl.java | 8 +++- notification-service/pom.xml | 8 ++-- 44 files changed, 334 insertions(+), 170 deletions(-) create mode 100644 annotation-service/annotation/src/main/java/gr/cite/annotation/data/conventers/QueueInboxStatusConverter.java create mode 100644 annotation-service/annotation/src/main/java/gr/cite/annotation/data/conventers/QueueOutboxNotifyStatusConverter.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/configurations/db/NamingStrategyProperties.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/configurations/db/PrefixPhysicalNamingStrategy.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/QueueInboxStatusConverter.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/QueueOutboxNotifyStatusConverter.java create mode 100644 notification-service/notification-web/src/main/resources/config/security-devel.yml create mode 100644 notification-service/notification/src/main/java/gr/cite/notification/data/conventers/QueueInboxStatusConverter.java create mode 100644 notification-service/notification/src/main/java/gr/cite/notification/data/conventers/QueueOutboxNotifyStatusConverter.java diff --git a/annotation-service/annotation/pom.xml b/annotation-service/annotation/pom.xml index 5a116402f..aefe1aef0 100644 --- a/annotation-service/annotation/pom.xml +++ b/annotation-service/annotation/pom.xml @@ -62,7 +62,7 @@ gr.cite oidc-authn - 1.0.0 + 2.2.1 gr.cite @@ -72,7 +72,7 @@ gr.cite oidc-authz - 1.0.0 + 2.1.0 gr.cite @@ -82,7 +82,7 @@ gr.cite validation - 3.0.2 + 3.0.3 diff --git a/annotation-service/annotation/src/main/java/gr/cite/annotation/data/QueueInboxEntity.java b/annotation-service/annotation/src/main/java/gr/cite/annotation/data/QueueInboxEntity.java index 3b16254b7..4847bc080 100644 --- a/annotation-service/annotation/src/main/java/gr/cite/annotation/data/QueueInboxEntity.java +++ b/annotation-service/annotation/src/main/java/gr/cite/annotation/data/QueueInboxEntity.java @@ -2,6 +2,7 @@ package gr.cite.annotation.data; import gr.cite.annotation.common.enums.IsActive; import gr.cite.annotation.data.conventers.IsActiveConverter; +import gr.cite.annotation.data.conventers.QueueInboxStatusConverter; import gr.cite.annotation.data.types.JsonSQLType; import gr.cite.queueinbox.entity.QueueInbox; import gr.cite.queueinbox.entity.QueueInboxStatus; @@ -21,17 +22,17 @@ public class QueueInboxEntity implements QueueInbox { public static final String _id = "id"; - @Column(name = "\"queue\"", nullable = false, length = 50) + @Column(name = "\"queue\"", nullable = false, length = 200) private String queue; public static final String _queue = "queue"; - @Column(name = "\"exchange\"", nullable = false, length = 50) + @Column(name = "\"exchange\"", nullable = false, length = 200) private String exchange; public static final String _exchange = "exchange"; - @Column(name = "\"route\"", nullable = false, length = 50) + @Column(name = "\"route\"", nullable = false, length = 200) private String route; public static final String _route = "route"; @@ -62,11 +63,11 @@ public class QueueInboxEntity implements QueueInbox { public static final String _tenantId = "tenantId"; - @Column(name = "\"status\"", length = 50, nullable = false) - @Enumerated(EnumType.STRING) + @Column(name = "\"status\"", nullable = false) + @Convert(converter = QueueInboxStatusConverter.class) private QueueInboxStatus status; + public final static String _status = "status"; - public static final String _status = "status"; @Column(name = "\"created_at\"", nullable = false) private Instant createdAt; @@ -79,7 +80,7 @@ public class QueueInboxEntity implements QueueInbox { public static final String _updatedAt = "updatedAt"; - @Column(name = "\"is_active\"", length = 20, nullable = false) + @Column(name = "\"is_active\"", nullable = false) @Convert(converter = IsActiveConverter.class) private IsActive isActive; diff --git a/annotation-service/annotation/src/main/java/gr/cite/annotation/data/QueueOutboxEntity.java b/annotation-service/annotation/src/main/java/gr/cite/annotation/data/QueueOutboxEntity.java index bef7a6c94..b25ca4edb 100644 --- a/annotation-service/annotation/src/main/java/gr/cite/annotation/data/QueueOutboxEntity.java +++ b/annotation-service/annotation/src/main/java/gr/cite/annotation/data/QueueOutboxEntity.java @@ -2,6 +2,7 @@ package gr.cite.annotation.data; import gr.cite.annotation.common.enums.IsActive; import gr.cite.annotation.data.conventers.IsActiveConverter; +import gr.cite.annotation.data.conventers.QueueOutboxNotifyStatusConverter; import gr.cite.queueoutbox.entity.QueueOutbox; import gr.cite.queueoutbox.entity.QueueOutboxNotifyStatus; import jakarta.persistence.*; @@ -19,12 +20,12 @@ public class QueueOutboxEntity implements QueueOutbox { public static final String _id = "id"; - @Column(name = "\"exchange\"", nullable = false, length = 50) + @Column(name = "\"exchange\"", nullable = false, length = 200) private String exchange; public static final String _exchange = "exchange"; - @Column(name = "\"route\"", length = 50) + @Column(name = "\"route\"", length = 200) private String route; public static final String _route = "route"; @@ -39,11 +40,10 @@ public class QueueOutboxEntity implements QueueOutbox { public static final String _message = "message"; - @Column(name = "\"notify_status\"", length = 20, nullable = false) - @Enumerated(EnumType.STRING) + @Column(name = "\"notify_status\"", nullable = false) + @Convert(converter = QueueOutboxNotifyStatusConverter.class) private QueueOutboxNotifyStatus notifyStatus; - - public static final String _notifyStatus = "notifyStatus"; + public final static String _notifyStatus = "notifyStatus"; @Column(name = "\"retry_count\"", nullable = false) private Integer retryCount; diff --git a/annotation-service/annotation/src/main/java/gr/cite/annotation/data/conventers/QueueInboxStatusConverter.java b/annotation-service/annotation/src/main/java/gr/cite/annotation/data/conventers/QueueInboxStatusConverter.java new file mode 100644 index 000000000..2089859d8 --- /dev/null +++ b/annotation-service/annotation/src/main/java/gr/cite/annotation/data/conventers/QueueInboxStatusConverter.java @@ -0,0 +1,19 @@ +package gr.cite.annotation.data.conventers; + +import gr.cite.queueinbox.entity.QueueInboxStatus; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +@Converter +public class QueueInboxStatusConverter implements AttributeConverter { + @Override + public Short convertToDatabaseColumn(QueueInboxStatus value) { + if (value == null) throw new IllegalArgumentException("Value could not be null for: " + this.getClass().getSimpleName()); + return value.getValue(); + } + + @Override + public QueueInboxStatus convertToEntityAttribute(Short dbData) { + return QueueInboxStatus.of(dbData); + } +} diff --git a/annotation-service/annotation/src/main/java/gr/cite/annotation/data/conventers/QueueOutboxNotifyStatusConverter.java b/annotation-service/annotation/src/main/java/gr/cite/annotation/data/conventers/QueueOutboxNotifyStatusConverter.java new file mode 100644 index 000000000..a356181d1 --- /dev/null +++ b/annotation-service/annotation/src/main/java/gr/cite/annotation/data/conventers/QueueOutboxNotifyStatusConverter.java @@ -0,0 +1,19 @@ +package gr.cite.annotation.data.conventers; + +import gr.cite.queueoutbox.entity.QueueOutboxNotifyStatus; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +@Converter +public class QueueOutboxNotifyStatusConverter implements AttributeConverter { + @Override + public Short convertToDatabaseColumn(QueueOutboxNotifyStatus value) { + if (value == null) throw new IllegalArgumentException("Value could not be null for: " + this.getClass().getSimpleName()); + return value.getValue(); + } + + @Override + public QueueOutboxNotifyStatus convertToEntityAttribute(Short dbData) { + return QueueOutboxNotifyStatus.of(dbData); + } +} diff --git a/annotation-service/pom.xml b/annotation-service/pom.xml index c9662c360..47d35f3bb 100644 --- a/annotation-service/pom.xml +++ b/annotation-service/pom.xml @@ -13,7 +13,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.2 + 3.2.1 @@ -136,18 +136,18 @@ gr.cite rabbitmq-core - 2.1.1 + 2.1.2 gr.cite queue-inbox - 1.0.0 + 2.1.1 gr.cite queue-outbox - 1.0.0 + 2.1.1 diff --git a/dmp-backend/core/pom.xml b/dmp-backend/core/pom.xml index 9dcacf260..711c9c8de 100644 --- a/dmp-backend/core/pom.xml +++ b/dmp-backend/core/pom.xml @@ -65,12 +65,12 @@ gr.cite queue-inbox - 1.0.0 + 2.1.1 gr.cite queue-outbox - 1.0.0 + 2.1.1 diff --git a/dmp-backend/core/src/main/java/eu/eudat/configurations/db/NamingStrategyProperties.java b/dmp-backend/core/src/main/java/eu/eudat/configurations/db/NamingStrategyProperties.java new file mode 100644 index 000000000..d13980dbb --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/configurations/db/NamingStrategyProperties.java @@ -0,0 +1,20 @@ +package eu.eudat.configurations.db; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.bind.ConstructorBinding; + +@ConfigurationProperties(prefix = "naming-strategy") +public class NamingStrategyProperties { + + private final String prefix; + + @ConstructorBinding + public NamingStrategyProperties(String prefix) { + this.prefix = prefix; + } + + public String getPrefix() { + return prefix; + } + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/configurations/db/PrefixPhysicalNamingStrategy.java b/dmp-backend/core/src/main/java/eu/eudat/configurations/db/PrefixPhysicalNamingStrategy.java new file mode 100644 index 000000000..140062448 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/configurations/db/PrefixPhysicalNamingStrategy.java @@ -0,0 +1,30 @@ +package eu.eudat.configurations.db; + +import eu.eudat.convention.ConventionService; +import org.hibernate.boot.model.naming.Identifier; +import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl; +import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@EnableConfigurationProperties({NamingStrategyProperties.class}) +public class PrefixPhysicalNamingStrategy extends PhysicalNamingStrategyStandardImpl { + + private final NamingStrategyProperties namingStrategyProperties; + private final ConventionService conventionService; + + public PrefixPhysicalNamingStrategy(NamingStrategyProperties namingStrategyProperties, ConventionService conventionService) { + this.namingStrategyProperties = namingStrategyProperties; + this.conventionService = conventionService; + } + + @Override + public Identifier toPhysicalTableName(Identifier logicalName, JdbcEnvironment context) { + if (conventionService.isNullOrEmpty(namingStrategyProperties.getPrefix())) + return super.toPhysicalTableName(logicalName, context); + Identifier identifier = new Identifier(namingStrategyProperties.getPrefix() + logicalName.getText(), logicalName.isQuoted()); + return super.toPhysicalTableName(identifier, context); + } + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/QueueInboxEntity.java b/dmp-backend/core/src/main/java/eu/eudat/data/QueueInboxEntity.java index 43a44bbd6..29d5cb627 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/data/QueueInboxEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/data/QueueInboxEntity.java @@ -2,6 +2,7 @@ package eu.eudat.data; import eu.eudat.commons.enums.IsActive; import eu.eudat.data.converters.enums.IsActiveConverter; +import eu.eudat.data.converters.enums.QueueInboxStatusConverter; import eu.eudat.data.types.JsonSQLType; import gr.cite.queueinbox.entity.QueueInbox; import gr.cite.queueinbox.entity.QueueInboxStatus; @@ -19,15 +20,15 @@ public class QueueInboxEntity implements QueueInbox { private UUID id; public final static String _id = "id"; - @Column(name = "\"queue\"", nullable = false, length = 50) + @Column(name = "\"queue\"", nullable = false, length = 200) private String queue; public final static String _queue = "queue"; - @Column(name = "\"exchange\"", nullable = false, length = 50) + @Column(name = "\"exchange\"", nullable = false, length = 200) private String exchange; public final static String _exchange = "exchange"; - @Column(name = "\"route\"", nullable = false, length = 50) + @Column(name = "\"route\"", nullable = false, length = 200) private String route; public final static String _route = "route"; @@ -52,14 +53,13 @@ public class QueueInboxEntity implements QueueInbox { private UUID tenantId; public final static String _tenantId = "tenantId"; - @Column(name = "\"is_active\"", length = 20, nullable = false) + @Column(name = "\"is_active\"", nullable = false) @Convert(converter = IsActiveConverter.class) private IsActive isActive; public final static String _isActive = "isActive"; - //TODO: as integer - @Column(name = "\"status\"", length = 50, nullable = false) - @Enumerated(EnumType.STRING) + @Column(name = "\"status\"", nullable = false) + @Convert(converter = QueueInboxStatusConverter.class) private QueueInboxStatus status; public final static String _status = "status"; diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/QueueOutboxEntity.java b/dmp-backend/core/src/main/java/eu/eudat/data/QueueOutboxEntity.java index 721d5c94d..daf463a5d 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/data/QueueOutboxEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/data/QueueOutboxEntity.java @@ -2,6 +2,7 @@ package eu.eudat.data; import eu.eudat.commons.enums.IsActive; import eu.eudat.data.converters.enums.IsActiveConverter; +import eu.eudat.data.converters.enums.QueueOutboxNotifyStatusConverter; import gr.cite.queueoutbox.entity.QueueOutbox; import gr.cite.queueoutbox.entity.QueueOutboxNotifyStatus; @@ -17,11 +18,11 @@ public class QueueOutboxEntity implements QueueOutbox { private UUID id; public final static String _id = "id"; - @Column(name = "\"exchange\"", nullable = false, length = 50) + @Column(name = "\"exchange\"", nullable = false, length = 200) private String exchange; public final static String _exchange = "exchange"; - @Column(name = "\"route\"", length = 50) + @Column(name = "\"route\"", length = 200) private String route; public final static String _route = "route"; @@ -33,9 +34,8 @@ public class QueueOutboxEntity implements QueueOutbox { private String message; public final static String _message = "message"; - //TODO: as integer - @Column(name = "\"notify_status\"", length = 20, nullable = false) - @Enumerated(EnumType.STRING) + @Column(name = "\"notify_status\"", nullable = false) + @Convert(converter = QueueOutboxNotifyStatusConverter.class) private QueueOutboxNotifyStatus notifyStatus; public final static String _notifyStatus = "notifyStatus"; @@ -55,7 +55,7 @@ public class QueueOutboxEntity implements QueueOutbox { private UUID tenantId; public final static String _tenantId = "tenantId"; - @Column(name = "\"is_active\"", length = 20, nullable = false) + @Column(name = "\"is_active\"", nullable = false) @Convert(converter = IsActiveConverter.class) private IsActive isActive; public final static String _isActive = "isActive"; diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/QueueInboxStatusConverter.java b/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/QueueInboxStatusConverter.java new file mode 100644 index 000000000..387c57ad1 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/QueueInboxStatusConverter.java @@ -0,0 +1,19 @@ +package eu.eudat.data.converters.enums; + +import gr.cite.queueinbox.entity.QueueInboxStatus; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +@Converter +public class QueueInboxStatusConverter implements AttributeConverter { + @Override + public Short convertToDatabaseColumn(QueueInboxStatus value) { + if (value == null) throw new IllegalArgumentException("Value could not be null for: " + this.getClass().getSimpleName()); + return value.getValue(); + } + + @Override + public QueueInboxStatus convertToEntityAttribute(Short dbData) { + return QueueInboxStatus.of(dbData); + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/QueueOutboxNotifyStatusConverter.java b/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/QueueOutboxNotifyStatusConverter.java new file mode 100644 index 000000000..9e822930d --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/QueueOutboxNotifyStatusConverter.java @@ -0,0 +1,19 @@ +package eu.eudat.data.converters.enums; + +import gr.cite.queueoutbox.entity.QueueOutboxNotifyStatus; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +@Converter +public class QueueOutboxNotifyStatusConverter implements AttributeConverter { + @Override + public Short convertToDatabaseColumn(QueueOutboxNotifyStatus value) { + if (value == null) throw new IllegalArgumentException("Value could not be null for: " + this.getClass().getSimpleName()); + return value.getValue(); + } + + @Override + public QueueOutboxNotifyStatus convertToEntityAttribute(Short dbData) { + return QueueOutboxNotifyStatus.of(dbData); + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/CloneDmpPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/CloneDmpPersist.java index 2994eac69..cbda577f6 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/CloneDmpPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/CloneDmpPersist.java @@ -4,13 +4,13 @@ import eu.eudat.commons.validation.BaseValidator; import gr.cite.tools.validation.specification.Specification; import eu.eudat.convention.ConventionService; import eu.eudat.errorcode.ErrorThesaurusProperties; -import org.apache.commons.compress.utils.Lists; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Scope; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Component; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; @@ -29,7 +29,7 @@ public class CloneDmpPersist { public static final String _description = "description"; - private List descriptions = Lists.newArrayList(); + private List descriptions = new ArrayList<>(); public static final String _descriptions = "descriptions"; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/NewVersionDmpPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/NewVersionDmpPersist.java index 5adc9b923..15953fd68 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/NewVersionDmpPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/NewVersionDmpPersist.java @@ -5,13 +5,13 @@ import gr.cite.tools.validation.specification.Specification; import eu.eudat.convention.ConventionService; import eu.eudat.data.DmpEntity; import eu.eudat.errorcode.ErrorThesaurusProperties; -import org.apache.commons.compress.utils.Lists; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Scope; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Component; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; @@ -33,7 +33,7 @@ public class NewVersionDmpPersist { public static final String _blueprintId = "blueprintId"; - private List descriptions = Lists.newArrayList(); + private List descriptions = new ArrayList<>(); public static final String _descriptions = "descriptions"; diff --git a/dmp-backend/pom.xml b/dmp-backend/pom.xml index f8049f2c1..b3bf79193 100644 --- a/dmp-backend/pom.xml +++ b/dmp-backend/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.2 + 3.2.1 @@ -41,7 +41,7 @@ org.json json - 20230227 + 20240303 org.springframework @@ -92,7 +92,7 @@ org.elasticsearch.client elasticsearch-rest-high-level-client - 7.6.0 + 7.17.19 org.hibernate.orm @@ -109,7 +109,7 @@ com.jayway.jsonpath json-path - 2.4.0 + 2.9.0 @@ -153,24 +153,8 @@ 3.5 - - org.apache.poi - poi-ooxml - 4.1.2 - - - - org.apache.poi - poi - 4.1.2 - - - org.apache.xmlgraphics - fop - 2.3 - org.jsoup @@ -190,11 +174,6 @@ 1.0.6 - - fr.opensagres.xdocreport - fr.opensagres.xdocreport.itext.extension - 2.0.4 - commons-io @@ -356,18 +335,18 @@ gr.cite queue-inbox - 1.0.0 + 2.1.1 gr.cite queue-outbox - 1.0.0 + 2.1.1 gr.cite rabbitmq-core - 1.0.0 + 2.1.2 diff --git a/dmp-backend/web/src/main/resources/config/db.yml b/dmp-backend/web/src/main/resources/config/db.yml index 519502f2d..fcc2c426e 100644 --- a/dmp-backend/web/src/main/resources/config/db.yml +++ b/dmp-backend/web/src/main/resources/config/db.yml @@ -16,7 +16,7 @@ spring: dialect: org.hibernate.dialect.PostgreSQLDialect hibernate: naming: - physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl + physical-strategy: eu.eudat.configurations.db.PrefixPhysicalNamingStrategy implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy datasource: url: ${DB_URL:} @@ -29,3 +29,6 @@ spring: maximum-pool-size: 10 idle-timeout: 600000 max-lifetime: 1800000 + +naming-strategy: + prefix: \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.029_addQueueOutbox.sql b/dmp-db-scema/updates/00.01.029_addQueueOutbox.sql index 7a227c7c6..3409653d8 100644 --- a/dmp-db-scema/updates/00.01.029_addQueueOutbox.sql +++ b/dmp-db-scema/updates/00.01.029_addQueueOutbox.sql @@ -10,7 +10,7 @@ BEGIN exchange character varying(200) COLLATE pg_catalog."default" NOT NULL, route character varying(200) COLLATE pg_catalog."default" NOT NULL, message_id uuid NOT NULL, - notify_status character varying(100) COLLATE pg_catalog."default" NOT NULL, + notify_status smallint NOT NULL, retry_count integer NOT NULL, published_at timestamp without time zone, confirmed_at timestamp without time zone, diff --git a/dmp-db-scema/updates/00.01.030_addQueueInbox.sql b/dmp-db-scema/updates/00.01.030_addQueueInbox.sql index 13bdb9a53..e2296b850 100644 --- a/dmp-db-scema/updates/00.01.030_addQueueInbox.sql +++ b/dmp-db-scema/updates/00.01.030_addQueueInbox.sql @@ -7,14 +7,14 @@ BEGIN CREATE TABLE public."QueueInbox" ( id uuid NOT NULL, - queue character varying(50) COLLATE pg_catalog."default" NOT NULL, - exchange character varying(50) COLLATE pg_catalog."default" NOT NULL, - route character varying(50) COLLATE pg_catalog."default" NOT NULL, + queue character varying(200) COLLATE pg_catalog."default" NOT NULL, + exchange character varying(200) COLLATE pg_catalog."default" NOT NULL, + route character varying(200) COLLATE pg_catalog."default" NOT NULL, application_id character varying(100) COLLATE pg_catalog."default" NOT NULL, message_id uuid NOT NULL, message json NOT NULL, retry_count integer, - status character varying(50) COLLATE pg_catalog."default" NOT NULL, + status smallint NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, tenant uuid, diff --git a/dmp-db-scema/updates/00.01.037_add_ntf_QueueInbox.sql b/dmp-db-scema/updates/00.01.037_add_ntf_QueueInbox.sql index ffbf7d7e6..5aa40b82a 100644 --- a/dmp-db-scema/updates/00.01.037_add_ntf_QueueInbox.sql +++ b/dmp-db-scema/updates/00.01.037_add_ntf_QueueInbox.sql @@ -7,14 +7,14 @@ BEGIN CREATE TABLE public."ntf_QueueInbox" ( id uuid NOT NULL, - queue character varying(50) COLLATE pg_catalog."default" NOT NULL, - exchange character varying(50) COLLATE pg_catalog."default" NOT NULL, - route character varying(50) COLLATE pg_catalog."default" NOT NULL, + queue character varying(200) COLLATE pg_catalog."default" NOT NULL, + exchange character varying(200) COLLATE pg_catalog."default" NOT NULL, + route character varying(200) COLLATE pg_catalog."default" NOT NULL, application_id character varying(100) COLLATE pg_catalog."default" NOT NULL, message_id uuid NOT NULL, message json NOT NULL, retry_count integer, - status character varying(50) COLLATE pg_catalog."default" NOT NULL, + status smallint NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, tenant uuid, diff --git a/dmp-db-scema/updates/00.01.038_add_ntf_QueueOutbox.sql b/dmp-db-scema/updates/00.01.038_add_ntf_QueueOutbox.sql index 6720b85e2..53f79fce0 100644 --- a/dmp-db-scema/updates/00.01.038_add_ntf_QueueOutbox.sql +++ b/dmp-db-scema/updates/00.01.038_add_ntf_QueueOutbox.sql @@ -10,7 +10,7 @@ BEGIN exchange character varying(200) COLLATE pg_catalog."default" NOT NULL, route character varying(200) COLLATE pg_catalog."default" NOT NULL, message_id uuid NOT NULL, - notify_status character varying(100) COLLATE pg_catalog."default" NOT NULL, + notify_status smallint NOT NULL, retry_count integer NOT NULL, published_at timestamp without time zone, confirmed_at timestamp without time zone, diff --git a/dmp-db-scema/updates/00.01.049_Add_ant_QueueInbox.sql b/dmp-db-scema/updates/00.01.049_Add_ant_QueueInbox.sql index 48f593f0b..4fd7093bd 100644 --- a/dmp-db-scema/updates/00.01.049_Add_ant_QueueInbox.sql +++ b/dmp-db-scema/updates/00.01.049_Add_ant_QueueInbox.sql @@ -7,14 +7,14 @@ BEGIN CREATE TABLE public."ant_QueueInbox" ( id uuid NOT NULL, - queue character varying(50) COLLATE pg_catalog."default" NOT NULL, - exchange character varying(50) COLLATE pg_catalog."default" NOT NULL, - route character varying(50) COLLATE pg_catalog."default" NOT NULL, + queue character varying(200) COLLATE pg_catalog."default" NOT NULL, + exchange character varying(200) COLLATE pg_catalog."default" NOT NULL, + route character varying(200) COLLATE pg_catalog."default" NOT NULL, application_id character varying(100) COLLATE pg_catalog."default" NOT NULL, message_id uuid NOT NULL, message json NOT NULL, retry_count integer, - status character varying(50) COLLATE pg_catalog."default" NOT NULL, + status smallint NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, tenant uuid, diff --git a/dmp-db-scema/updates/00.01.050_Add_ant_QueueOutbox.sql b/dmp-db-scema/updates/00.01.050_Add_ant_QueueOutbox.sql index a90e251ae..7bcd5e500 100644 --- a/dmp-db-scema/updates/00.01.050_Add_ant_QueueOutbox.sql +++ b/dmp-db-scema/updates/00.01.050_Add_ant_QueueOutbox.sql @@ -10,7 +10,7 @@ BEGIN exchange character varying(200) COLLATE pg_catalog."default" NOT NULL, route character varying(200) COLLATE pg_catalog."default" NOT NULL, message_id uuid NOT NULL, - notify_status character varying(100) COLLATE pg_catalog."default" NOT NULL, + notify_status smallint NOT NULL, retry_count integer NOT NULL, published_at timestamp without time zone, confirmed_at timestamp without time zone, diff --git a/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/InAppNotificationController.java b/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/InAppNotificationController.java index 519148da3..4ec5aee6b 100644 --- a/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/InAppNotificationController.java +++ b/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/InAppNotificationController.java @@ -71,10 +71,10 @@ public class InAppNotificationController { @PostMapping("query") public QueryResult Query(@RequestBody InAppNotificationLookup lookup) throws MyApplicationException, MyForbiddenException, InvalidApplicationException { logger.debug("querying {}", InAppNotification.class.getSimpleName()); - - this.censorFactory.censor(InAppNotificationCensor.class).censor(lookup.getProject()); - UUID userId = this.userScope.getUserId(); + + this.censorFactory.censor(InAppNotificationCensor.class).censor(lookup.getProject(), userId); + if (userId == null) throw new MyForbiddenException(this.errors.getNonPersonPrincipal().getCode(), this.errors.getNonPersonPrincipal().getMessage()); InAppNotificationQuery query = lookup.enrich(this.queryFactory).userId(userId); List data = query.collectAs(lookup.getProject()); @@ -88,12 +88,13 @@ public class InAppNotificationController { @GetMapping("{id}") @Transactional - public InAppNotification Get(@PathVariable UUID id, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException { + public InAppNotification Get(@PathVariable UUID id, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException { logger.debug(new MapLogEntry("retrieving" + InAppNotification.class.getSimpleName()).And("id", id).And("fields", fieldSet)); - this.censorFactory.censor(InAppNotificationCensor.class).censor(fieldSet); + UUID userId = this.userScope.getUserId(); + this.censorFactory.censor(InAppNotificationCensor.class).censor(fieldSet, userId); - InAppNotificationQuery query = this.queryFactory.query(InAppNotificationQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).ids(id); + InAppNotificationQuery query = this.queryFactory.query(InAppNotificationQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).userId(userId).ids(id); InAppNotification model = this.builderFactory.builder(InAppNotificationBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet)); if (model == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Notification.class.getSimpleName()}, LocaleContextHolder.getLocale())); @@ -142,7 +143,7 @@ public class InAppNotificationController { UUID userId = this.userScope.getUserId(); if (userId == null) throw new MyForbiddenException(this.errors.getNonPersonPrincipal().getCode(), this.errors.getNonPersonPrincipal().getMessage()); - this.censorFactory.censor(InAppNotificationCensor.class).censor(new BaseFieldSet(InAppNotification.Field.ID)); + this.censorFactory.censor(InAppNotificationCensor.class).censor(new BaseFieldSet(InAppNotification.Field.ID), userId); InAppNotificationQuery query = this.queryFactory.query(InAppNotificationQuery.class).isActive(IsActive.Active).trackingState(NotificationInAppTracking.STORED).userId(userId); int count = Math.toIntExact(query.count()); diff --git a/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/UserNotificationPreferenceController.java b/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/UserNotificationPreferenceController.java index 8ff1323fe..d09539f67 100644 --- a/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/UserNotificationPreferenceController.java +++ b/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/UserNotificationPreferenceController.java @@ -66,7 +66,7 @@ public class UserNotificationPreferenceController { public QueryResult query(@RequestBody UserNotificationPreferenceLookup lookup) throws MyApplicationException, MyForbiddenException { logger.debug("querying {}", UserNotificationPreference.class.getSimpleName()); - this.censorFactory.censor(UserNotificationPreferenceCensor.class).censor(lookup.getProject()); + this.censorFactory.censor(UserNotificationPreferenceCensor.class).censor(lookup.getProject(), null); UserNotificationPreferenceQuery query = lookup.enrich(this.queryFactory); List data = query.collectAs(lookup.getProject()); @@ -83,7 +83,7 @@ public class UserNotificationPreferenceController { public UserNotificationPreference current(@PathVariable UUID userId, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException { logger.debug(new MapLogEntry("retrieving" + UserNotificationPreference.class.getSimpleName()).And("userId", userId).And("fields", fieldSet)); - this.censorFactory.censor(UserNotificationPreferenceCensor.class).censor(fieldSet); + this.censorFactory.censor(UserNotificationPreferenceCensor.class).censor(fieldSet, userId); UserNotificationPreferenceQuery query = this.queryFactory.query(UserNotificationPreferenceQuery.class).userId(userId); UserNotificationPreference model = this.builderFactory.builder(UserNotificationPreferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet)); diff --git a/notification-service/notification-web/src/main/resources/config/cache.yml b/notification-service/notification-web/src/main/resources/config/cache.yml index 69541500e..ec7370d42 100644 --- a/notification-service/notification-web/src/main/resources/config/cache.yml +++ b/notification-service/notification-web/src/main/resources/config/cache.yml @@ -39,9 +39,6 @@ cache: enableRecordStats: false expireAfterWriteSeconds: 60 mapCaches: - - names: [ cacheB ] - allowNullValues: true - storeByValue: true apiKey: name: apikey keyPattern: resolve_$keyhash$:v0 diff --git a/notification-service/notification-web/src/main/resources/config/db.yml b/notification-service/notification-web/src/main/resources/config/db.yml index aa3caed0b..0de4aa778 100644 --- a/notification-service/notification-web/src/main/resources/config/db.yml +++ b/notification-service/notification-web/src/main/resources/config/db.yml @@ -1,7 +1,11 @@ spring: jpa: properties: + org: + hibernate: + flushMode: MANUAL hibernate: + globally_quoted_identifiers: true ddl-auto: validate dialect: org.hibernate.dialect.PostgreSQLDialect hibernate: @@ -16,9 +20,10 @@ spring: hikari: connection-timeout: 30000 minimum-idle: 3 - maximum-pool-size: 5 + maximum-pool-size: 10 idle-timeout: 600000 max-lifetime: 1800000 + naming-strategy: prefix: ntf_ diff --git a/notification-service/notification-web/src/main/resources/config/email.yml b/notification-service/notification-web/src/main/resources/config/email.yml index fb7c94ba0..364788161 100644 --- a/notification-service/notification-web/src/main/resources/config/email.yml +++ b/notification-service/notification-web/src/main/resources/config/email.yml @@ -1,14 +1,14 @@ spring: mail: - host: ${MAIL_HOST:} - port: ${MAIL_PORT:} - username: ${MAIL_USERNAME:} - password: ${MAIL_PASSWORD:} + host: ${MAIL_HOST} + port: ${MAIL_PORT} + username: ${MAIL_USERNAME} + password: ${MAIL_PASSWORD} properties: mail: smtp: - auth: ${MAIL_AUTH:} + auth: ${MAIL_AUTH} starttls: - enable: ${MAIL_TLS:} + enable: ${MAIL_TLS} email: - address: ${MAIL_ADDRESS:} \ No newline at end of file + address: ${MAIL_ADDRESS} \ No newline at end of file diff --git a/notification-service/notification-web/src/main/resources/config/idpclaims.yml b/notification-service/notification-web/src/main/resources/config/idpclaims.yml index 3372e4ca7..97ff4a10e 100644 --- a/notification-service/notification-web/src/main/resources/config/idpclaims.yml +++ b/notification-service/notification-web/src/main/resources/config/idpclaims.yml @@ -37,3 +37,5 @@ idpclient: - type: azp Authorities: - type: authorities + ExternalProviderName: + - type: identity_provider \ No newline at end of file diff --git a/notification-service/notification-web/src/main/resources/config/permissions.yml b/notification-service/notification-web/src/main/resources/config/permissions.yml index d7247f8d8..a6d600777 100644 --- a/notification-service/notification-web/src/main/resources/config/permissions.yml +++ b/notification-service/notification-web/src/main/resources/config/permissions.yml @@ -5,26 +5,26 @@ permissions: # Tenants BrowseTenant: roles: - - ic-sti-superuser + - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false EditTenant: roles: - - ic-sti-superuser + - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false DeleteTenant: roles: - - ic-sti-superuser + - Admin claims: [ ] clients: [ ] allowAnonymous: false allowAuthenticated: false AllowNoTenant: roles: - - ic-sti-superuser + - Admin claims: [ ] clients: [ ] allowAnonymous: false @@ -32,21 +32,19 @@ permissions: # Users BrowseUser: roles: - - ic-sti-superuser - - tenantadmin + - Admin clients: [ ] allowAnonymous: true allowAuthenticated: false EditUser: roles: - - admin - - ic-sti-superuser + - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false DeleteUser: roles: - - ic-sti-superuser + - Admin claims: [ ] clients: [ ] allowAnonymous: false @@ -54,20 +52,19 @@ permissions: # UserContactInfo BrowseUserContactInfo: roles: - - ic-sti-superuser + - Admin clients: [ ] allowAnonymous: true allowAuthenticated: false EditUserContactInfo: roles: - - ic-sti-superuser - - user + - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false DeleteUserContactInfo: roles: - - ic-sti-superuser + - Admin claims: [ ] clients: [ ] allowAnonymous: false @@ -94,27 +91,26 @@ permissions: #Tenant Configuration BrowseTenantConfiguration: roles: - - ic-sti-superuser + - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false EditTenantConfiguration: roles: - - ic-sti-superuser + - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false #User Notification Preference BrowseUserNotificationPreference: roles: - - ic-sti-superuser + - Admin clients: [ ] allowAnonymous: true allowAuthenticated: false EditUserNotificationPreference: roles: - - ic-sti-superuser - - user + - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false @@ -122,26 +118,25 @@ permissions: # ViewPage Permissions ViewNotificationPage: roles: - - ic-sti-superuser + - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false ViewNotificationEventRulePage: roles: - - ic-sti-superuser + - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false ViewInAppNotificationPage: roles: - - ic-sti-superuser - - tenantadmin + - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false ViewNotificationTemplatePage: roles: - - ic-sti-superuser + - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false @@ -170,7 +165,6 @@ permissions: BrowseInAppNotification: roles: - Admin - - User clients: [ ] allowAnonymous: false allowAuthenticated: false diff --git a/notification-service/notification-web/src/main/resources/config/security-devel.yml b/notification-service/notification-web/src/main/resources/config/security-devel.yml new file mode 100644 index 000000000..dbb097b19 --- /dev/null +++ b/notification-service/notification-web/src/main/resources/config/security-devel.yml @@ -0,0 +1,6 @@ +web: + security: + idp: + resource: + jwt: + audiences: [ "dmp_notification" ] \ No newline at end of file diff --git a/notification-service/notification-web/src/main/resources/config/security.yml b/notification-service/notification-web/src/main/resources/config/security.yml index 3024921aa..8f41034ac 100644 --- a/notification-service/notification-web/src/main/resources/config/security.yml +++ b/notification-service/notification-web/src/main/resources/config/security.yml @@ -2,19 +2,13 @@ web: security: enabled: true authorized-endpoints: [ api ] - allowed-endpoints: [ public, dataset, master-item, test ] + allowed-endpoints: [ public ] idp: api-key: - enabled: true - authorization-header: Authorization - client-id: ${IDP_APIKEY_CLIENT_ID} - client-secret: ${IDP_APIKEY_CLIENT_SECRET} - scope: ${IDP_APIKEY_SCOPE} + enabled: false resource: - token-type: JWT - opaque: - client-id: ${IDP_OPAQUE_CLIENT_ID} - client-secret: ${IDP_OPAQUE_CLIENT_SECRET} + token-type: JWT #| opaque jwt: claims: [ role, x-role ] - issuer-uri: ${IDP_ISSUER_URI:} \ No newline at end of file + issuer-uri: ${IDP_ISSUER_URI} + validIssuer: ${IDP_ISSUER_URI} \ No newline at end of file diff --git a/notification-service/notification-web/src/main/resources/config/server.yml b/notification-service/notification-web/src/main/resources/config/server.yml index bc9a15d9f..9a4a97cbc 100644 --- a/notification-service/notification-web/src/main/resources/config/server.yml +++ b/notification-service/notification-web/src/main/resources/config/server.yml @@ -1,3 +1,13 @@ server: port: ${WEB_PORT} - forward-headers-strategy: NONE \ No newline at end of file + forward-headers-strategy: NONE + tomcat: + threads: + max: 20 + max-connections: 10000 + + spring: + servlet: + multipart: + max-file-size: 10MB + max-request-size: 10MB \ No newline at end of file diff --git a/notification-service/notification/pom.xml b/notification-service/notification/pom.xml index d820e9b6f..da75fb081 100644 --- a/notification-service/notification/pom.xml +++ b/notification-service/notification/pom.xml @@ -63,7 +63,7 @@ gr.cite oidc-authn - 1.0.0 + 2.2.1 gr.cite @@ -73,7 +73,7 @@ gr.cite oidc-authz - 1.0.0 + 2.1.0 gr.cite diff --git a/notification-service/notification/src/main/java/gr/cite/notification/data/QueueInboxEntity.java b/notification-service/notification/src/main/java/gr/cite/notification/data/QueueInboxEntity.java index c59bccb11..97126f92d 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/data/QueueInboxEntity.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/data/QueueInboxEntity.java @@ -2,6 +2,7 @@ package gr.cite.notification.data; import gr.cite.notification.common.enums.IsActive; import gr.cite.notification.data.conventers.IsActiveConverter; +import gr.cite.notification.data.conventers.QueueInboxStatusConverter; import gr.cite.notification.data.types.JsonSQLType; import gr.cite.queueinbox.entity.QueueInbox; import gr.cite.queueinbox.entity.QueueInboxStatus; @@ -21,17 +22,17 @@ public class QueueInboxEntity implements QueueInbox { public static final String _id = "id"; - @Column(name = "\"queue\"", nullable = false, length = 50) + @Column(name = "\"queue\"", nullable = false, length = 200) private String queue; public static final String _queue = "queue"; - @Column(name = "\"exchange\"", nullable = false, length = 50) + @Column(name = "\"exchange\"", nullable = false, length = 200) private String exchange; public static final String _exchange = "exchange"; - @Column(name = "\"route\"", nullable = false, length = 50) + @Column(name = "\"route\"", nullable = false, length = 200) private String route; public static final String _route = "route"; @@ -62,11 +63,11 @@ public class QueueInboxEntity implements QueueInbox { public static final String _tenantId = "tenantId"; - @Column(name = "\"status\"", length = 50, nullable = false) - @Enumerated(EnumType.STRING) + @Column(name = "\"status\"", nullable = false) + @Convert(converter = QueueInboxStatusConverter.class) private QueueInboxStatus status; + public final static String _status = "status"; - public static final String _status = "status"; @Column(name = "\"created_at\"", nullable = false) private Instant createdAt; @@ -79,7 +80,7 @@ public class QueueInboxEntity implements QueueInbox { public static final String _updatedAt = "updatedAt"; - @Column(name = "\"is_active\"", length = 20, nullable = false) + @Column(name = "\"is_active\"", nullable = false) @Convert(converter = IsActiveConverter.class) private IsActive isActive; diff --git a/notification-service/notification/src/main/java/gr/cite/notification/data/QueueOutboxEntity.java b/notification-service/notification/src/main/java/gr/cite/notification/data/QueueOutboxEntity.java index e62f2ec4d..232aa169f 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/data/QueueOutboxEntity.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/data/QueueOutboxEntity.java @@ -2,6 +2,7 @@ package gr.cite.notification.data; import gr.cite.notification.common.enums.IsActive; import gr.cite.notification.data.conventers.IsActiveConverter; +import gr.cite.notification.data.conventers.QueueOutboxNotifyStatusConverter; import gr.cite.queueoutbox.entity.QueueOutbox; import gr.cite.queueoutbox.entity.QueueOutboxNotifyStatus; import jakarta.persistence.*; @@ -19,12 +20,12 @@ public class QueueOutboxEntity implements QueueOutbox { public static final String _id = "id"; - @Column(name = "\"exchange\"", nullable = false, length = 50) + @Column(name = "\"exchange\"", nullable = false, length = 200) private String exchange; public static final String _exchange = "exchange"; - @Column(name = "\"route\"", length = 50) + @Column(name = "\"route\"", length = 200) private String route; public static final String _route = "route"; @@ -39,11 +40,10 @@ public class QueueOutboxEntity implements QueueOutbox { public static final String _message = "message"; - @Column(name = "\"notify_status\"", length = 20, nullable = false) - @Enumerated(EnumType.STRING) + @Column(name = "\"notify_status\"", nullable = false) + @Convert(converter = QueueOutboxNotifyStatusConverter.class) private QueueOutboxNotifyStatus notifyStatus; - - public static final String _notifyStatus = "notifyStatus"; + public final static String _notifyStatus = "notifyStatus"; @Column(name = "\"retry_count\"", nullable = false) private Integer retryCount; @@ -75,7 +75,7 @@ public class QueueOutboxEntity implements QueueOutbox { public static final String _updatedAt = "updatedAt"; - @Column(name = "\"is_active\"", length = 20, nullable = false) + @Column(name = "\"is_active\"", nullable = false) @Convert(converter = IsActiveConverter.class) private IsActive isActive; diff --git a/notification-service/notification/src/main/java/gr/cite/notification/data/conventers/QueueInboxStatusConverter.java b/notification-service/notification/src/main/java/gr/cite/notification/data/conventers/QueueInboxStatusConverter.java new file mode 100644 index 000000000..27e108488 --- /dev/null +++ b/notification-service/notification/src/main/java/gr/cite/notification/data/conventers/QueueInboxStatusConverter.java @@ -0,0 +1,19 @@ +package gr.cite.notification.data.conventers; + +import gr.cite.queueinbox.entity.QueueInboxStatus; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +@Converter +public class QueueInboxStatusConverter implements AttributeConverter { + @Override + public Short convertToDatabaseColumn(QueueInboxStatus value) { + if (value == null) throw new IllegalArgumentException("Value could not be null for: " + this.getClass().getSimpleName()); + return value.getValue(); + } + + @Override + public QueueInboxStatus convertToEntityAttribute(Short dbData) { + return QueueInboxStatus.of(dbData); + } +} diff --git a/notification-service/notification/src/main/java/gr/cite/notification/data/conventers/QueueOutboxNotifyStatusConverter.java b/notification-service/notification/src/main/java/gr/cite/notification/data/conventers/QueueOutboxNotifyStatusConverter.java new file mode 100644 index 000000000..e7c5bfb52 --- /dev/null +++ b/notification-service/notification/src/main/java/gr/cite/notification/data/conventers/QueueOutboxNotifyStatusConverter.java @@ -0,0 +1,19 @@ +package gr.cite.notification.data.conventers; + +import gr.cite.queueoutbox.entity.QueueOutboxNotifyStatus; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +@Converter +public class QueueOutboxNotifyStatusConverter implements AttributeConverter { + @Override + public Short convertToDatabaseColumn(QueueOutboxNotifyStatus value) { + if (value == null) throw new IllegalArgumentException("Value could not be null for: " + this.getClass().getSimpleName()); + return value.getValue(); + } + + @Override + public QueueOutboxNotifyStatus convertToEntityAttribute(Short dbData) { + return QueueOutboxNotifyStatus.of(dbData); + } +} diff --git a/notification-service/notification/src/main/java/gr/cite/notification/model/User.java b/notification-service/notification/src/main/java/gr/cite/notification/model/User.java index 3ea51b87c..7d3596491 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/model/User.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/model/User.java @@ -29,8 +29,6 @@ public class User { public static final String _hash = "hash"; private String hash; - public static final String _tenantUsers = "tenantUsers"; - public UUID getId() { return id; } diff --git a/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/InAppNotificationCensor.java b/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/InAppNotificationCensor.java index d20a14b4c..20b4ad8cf 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/InAppNotificationCensor.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/InAppNotificationCensor.java @@ -1,6 +1,7 @@ package gr.cite.notification.model.censorship; import gr.cite.commons.web.authz.service.AuthorizationService; +import gr.cite.notification.authorization.OwnedResource; import gr.cite.notification.authorization.Permission; import gr.cite.notification.convention.ConventionService; import gr.cite.tools.fieldset.FieldSet; @@ -12,6 +13,9 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.UUID; + @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class InAppNotificationCensor extends BaseCensor { @@ -24,9 +28,9 @@ public class InAppNotificationCensor extends BaseCensor { this.authService = authService; } - public void censor(FieldSet fields) { + public void censor(FieldSet fields, UUID userId) { logger.debug(new DataLogEntry("censoring fields", fields)); if (this.isEmpty(fields)) return; - this.authService.authorizeForce(Permission.BrowseInAppNotification); + this.authService.authorizeAtLeastOneForce(userId != null ? List.of(new OwnedResource(userId)) : null, Permission.BrowseInAppNotification); } } diff --git a/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/UserCensor.java b/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/UserCensor.java index ffe0677b3..11afb5a08 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/UserCensor.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/UserCensor.java @@ -43,8 +43,5 @@ public class UserCensor extends BaseCensor { logger.debug(new DataLogEntry("censoring fields", fields)); if (this.isEmpty(fields)) return; this.authService.authorizeAtLeastOneForce(userId != null ? List.of(new OwnedResource(userId)) : null, Permission.BrowseUser); - FieldSet tenantUsersFields = fields.extractPrefixed(this.asIndexerPrefix(User._tenantUsers)); - //FieldSet indicatorAccessesFields = fields.extractPrefixed(this.asIndexerPrefix(User._indicatorAccesses)); - //this.censorFactory.censor(IndicatorAccessCensor.class).censor(indicatorAccessesFields, userId); } } diff --git a/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/UserNotificationPreferenceCensor.java b/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/UserNotificationPreferenceCensor.java index 99f0a7090..13847a527 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/UserNotificationPreferenceCensor.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/UserNotificationPreferenceCensor.java @@ -1,6 +1,7 @@ package gr.cite.notification.model.censorship; import gr.cite.commons.web.authz.service.AuthorizationService; +import gr.cite.notification.authorization.OwnedResource; import gr.cite.notification.authorization.Permission; import gr.cite.notification.convention.ConventionService; import gr.cite.tools.fieldset.FieldSet; @@ -12,6 +13,9 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.UUID; + @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class UserNotificationPreferenceCensor extends BaseCensor { @@ -24,9 +28,9 @@ public class UserNotificationPreferenceCensor extends BaseCensor { this.authService = authService; } - public void censor(FieldSet fields) { + public void censor(FieldSet fields, UUID userId) { logger.debug(new DataLogEntry("censoring fields", fields)); if (this.isEmpty(fields)) return; - this.authService.authorizeForce(Permission.BrowseUserNotificationPreference); + this.authService.authorizeAtLeastOneForce(userId != null ? List.of(new OwnedResource(userId)) : null, Permission.BrowseUserNotificationPreference); } } diff --git a/notification-service/notification/src/main/java/gr/cite/notification/service/inappnotification/InAppNotificationServiceImpl.java b/notification-service/notification/src/main/java/gr/cite/notification/service/inappnotification/InAppNotificationServiceImpl.java index c6c349d6e..1c928e53a 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/service/inappnotification/InAppNotificationServiceImpl.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/service/inappnotification/InAppNotificationServiceImpl.java @@ -3,6 +3,7 @@ package gr.cite.notification.service.inappnotification; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.notification.authorization.Permission; import gr.cite.notification.common.enums.NotificationInAppTracking; +import gr.cite.notification.common.scope.user.UserScope; import gr.cite.notification.data.InAppNotificationEntity; import gr.cite.notification.data.TenantScopedEntityManager; import gr.cite.notification.model.deleter.InAppNotificationDeleter; @@ -36,13 +37,15 @@ public class InAppNotificationServiceImpl implements InAppNotificationService { private final AuthorizationService authService; private final DeleterFactory deleterFactory; + private final UserScope userScope; @Autowired - public InAppNotificationServiceImpl(QueryFactory queryFactory, TenantScopedEntityManager entityManager, AuthorizationService authService, DeleterFactory deleterFactory) { + public InAppNotificationServiceImpl(QueryFactory queryFactory, TenantScopedEntityManager entityManager, AuthorizationService authService, DeleterFactory deleterFactory, UserScope userScope) { this.queryFactory = queryFactory; this.entityManager = entityManager; this.authService = authService; this.deleterFactory = deleterFactory; + this.userScope = userScope; } public void markAsRead(UUID id) { @@ -52,9 +55,10 @@ public class InAppNotificationServiceImpl implements InAppNotificationService { public void markAsRead(List ids) { try { logger.debug(new DataLogEntry("marking as read in-app notifications", ids)); - + UUID userId = this.userScope.getUserId(); List items = this.queryFactory.query(InAppNotificationQuery.class) .ids(ids) + .userId(userId) .collect(); Instant now = Instant.now(); diff --git a/notification-service/pom.xml b/notification-service/pom.xml index a8e1700a0..ea8cdafce 100644 --- a/notification-service/pom.xml +++ b/notification-service/pom.xml @@ -13,7 +13,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.2 + 3.2.1 @@ -136,18 +136,18 @@ gr.cite rabbitmq-core - 2.1.1 + 2.1.2 gr.cite queue-inbox - 1.0.0 + 2.1.1 gr.cite queue-outbox - 1.0.0 + 2.1.1 From 0778842f38e252bf2d03e63a9030d0f18b197ff5 Mon Sep 17 00:00:00 2001 From: Diamantis Tziotzios Date: Fri, 29 Mar 2024 15:46:19 +0200 Subject: [PATCH 2/4] small fixes --- .../src/main/java/eu/eudat/controllers/LockController.java | 2 +- .../description-form/description-form-annotation.service.ts | 2 +- .../ui/dmp/dmp-editor-blueprint/dmp-editor.component.html | 2 +- .../app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts | 6 ------ 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/LockController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/LockController.java index f8818d5c3..d77822317 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/LockController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/LockController.java @@ -185,7 +185,7 @@ public class LockController { } @Transactional - @DeleteMapping("target/touch/{id}") + @GetMapping("target/touch/{id}") public boolean touch(@PathVariable("id") UUID targetId) throws Exception { AffiliatedResource affiliatedResourceDmp = this.authorizationContentResolver.dmpAffiliation(targetId); AffiliatedResource affiliatedResourceDescription = this.authorizationContentResolver.descriptionAffiliation(targetId); diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/description-form-annotation.service.ts b/dmp-frontend/src/app/ui/description/editor/description-form/description-form-annotation.service.ts index 3662abe15..3ce850251 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/description-form-annotation.service.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/description-form-annotation.service.ts @@ -33,7 +33,7 @@ export class DescriptionFormAnnotationService extends BaseService { } public getCount(anchor: string) { - if (this.annotationsPerAnchor.has(anchor)) { + if (this.annotationsPerAnchor?.has(anchor)) { return this.annotationsPerAnchor.get(anchor); } else { return 0; diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html index 81556c080..292d42b67 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html @@ -296,7 +296,7 @@
{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}
{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}} - + {{formGroup.get('descriptionTemplates').get(section.id).getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts index b3ba32856..8724729c4 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts @@ -451,12 +451,6 @@ export class DmpEditorComponent extends BaseEditor implemen // // - onRemoveDescriptionTemplate(event, sectionIndex: number) { - let found = false; - const section = this.selectedBlueprint.definition.sections[sectionIndex]; - let sectionDescriptionTemplates = (this.formGroup.get('descriptionTemplates') as UntypedFormArray).controls.find(x => x.get('sectionId').value === event.id); - } - onPreviewDescriptionTemplate(event, sectionIndex: number) { // const dialogRef = this.dialog.open(DatasetPreviewDialogComponent, { // width: '590px', From 2339b51c24b44ea45ad5a4831065fe2617bc2fee Mon Sep 17 00:00:00 2001 From: amentis Date: Fri, 29 Mar 2024 16:22:31 +0200 Subject: [PATCH 3/4] description template final preview changes (in progress) --- .../eu/eudat/commons/enums/FieldType.java | 2 +- dmp-backend/pom.xml | 13 +++++ .../description-template.module.ts | 5 +- ...ription-template-editor-field.component.ts | 1 - .../final-preview.component.html | 4 +- .../final-preview/final-preview.component.ts | 48 +++++++++++++++++-- ...description-template-editor.component.html | 4 +- 7 files changed, 64 insertions(+), 13 deletions(-) diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java index d803cb38e..a871ac74f 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java @@ -66,7 +66,7 @@ public enum FieldType implements DatabaseEnum { public static boolean isTextType(FieldType fieldType){ return fieldType.equals(FieldType.FREE_TEXT) || fieldType.equals(FieldType.CHECK_BOX) || fieldType.equals(FieldType.TEXT_AREA) || fieldType.equals(FieldType.RICH_TEXT_AREA) || fieldType.equals(FieldType.UPLOAD) || fieldType.equals(FieldType.BOOLEAN_DECISION) || - fieldType.equals(FieldType.RADIO_BOX) || fieldType.equals(FieldType.CURRENCY) || fieldType.equals(FieldType.SELECT); + fieldType.equals(FieldType.RADIO_BOX) || fieldType.equals(FieldType.CURRENCY); } public static boolean isTextListType(FieldType fieldType){ diff --git a/dmp-backend/pom.xml b/dmp-backend/pom.xml index b3bf79193..148dc2c77 100644 --- a/dmp-backend/pom.xml +++ b/dmp-backend/pom.xml @@ -391,6 +391,19 @@ + + cite-dev + + + cite-maven + CITE Maven Repository + https://crepo.cite.gr/repository/cite-maven/ + + + + true + + \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/description-template/description-template.module.ts b/dmp-frontend/src/app/ui/admin/description-template/description-template.module.ts index a054fab17..27ae25a54 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/description-template.module.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/description-template.module.ts @@ -31,6 +31,7 @@ import { DescriptionTemplateListingFiltersComponent } from "./listing/filters/de import { ImportDescriptionTemplateDialogComponent } from './listing/import-description-template/import-description-template.dialog.component'; import { DescriptionTemplateEditorReferenceTypeFieldComponent } from './editor/components/field-type/reference-type/description-template-editor-reference-type-field.component'; import { DescriptionFormModule } from '@app/ui/description/editor/description-form/description-form.module'; +import { FinalPreviewComponent } from './editor/components/final-preview/final-preview.component'; @NgModule({ imports: [ @@ -70,7 +71,9 @@ import { DescriptionFormModule } from '@app/ui/description/editor/description-fo DescriptionTemplateEditorLabelAndMultiplicityFieldComponent, DescriptionTemplateEditorRadioBoxFieldComponent, DescriptionTemplateEditorExternalDatasetsFieldComponent, - DescriptionTemplateEditorUploadFieldComponent + DescriptionTemplateEditorUploadFieldComponent, + + FinalPreviewComponent ] }) export class DescriptionTemplateModule { } diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts index 8f6c30ba0..e2586572f 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts @@ -93,7 +93,6 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple switch (this.fieldType) { case DescriptionTemplateFieldType.TEXT_AREA: case DescriptionTemplateFieldType.RICH_TEXT_AREA: - case DescriptionTemplateFieldType.UPLOAD: case DescriptionTemplateFieldType.FREE_TEXT: case DescriptionTemplateFieldType.BOOLEAN_DECISION: case DescriptionTemplateFieldType.RADIO_BOX: diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.html index 39882e08c..be1d8a544 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.html @@ -1,3 +1 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.ts index b73a1231b..ee6504887 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.ts @@ -1,5 +1,9 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { Rule } from '@app/ui/description/editor/description-form/visibility-rules/models/rule'; +import { Component, Input, OnInit, SimpleChanges } from '@angular/core'; +import { UntypedFormGroup } from '@angular/forms'; +import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; +import { DescriptionTemplatePersist } from '@app/core/model/description-template/description-template-persist'; +import { Description } from '@app/core/model/description/description'; +import { DescriptionEditorModel } from '@app/ui/description/editor/description-editor.model'; import { VisibilityRulesService } from '@app/ui/description/editor/description-form/visibility-rules/visibility-rules.service'; @@ -13,19 +17,53 @@ import { VisibilityRulesService } from '@app/ui/description/editor/description-f export class FinalPreviewComponent implements OnInit { - @Input() descriptionTempaltePersist = null; + @Input() descriptionTemplatePersist: DescriptionTemplatePersist; + descriptionTemplate: DescriptionTemplate; - visibilityRules: Rule[] = []; + previewPropertiesFormGroup @Input() formGroup = null; constructor(private visibilityRulesService: VisibilityRulesService) { } + private generatePreviewForm() { + + this.descriptionTemplate = this.buildDescriptionTemplate(this.descriptionTemplatePersist); + + const mockDescription: Description = { + descriptionTemplate: this.descriptionTemplate + } + const descriptionEditorModel = new DescriptionEditorModel().fromModel(mockDescription, mockDescription.descriptionTemplate); + this.previewPropertiesFormGroup = descriptionEditorModel.properties.buildForm() as UntypedFormGroup; + + this.visibilityRulesService.setContext(this.descriptionTemplate.definition, this.previewPropertiesFormGroup); + + } + + private buildDescriptionTemplate(persist: DescriptionTemplatePersist) : DescriptionTemplate{ + if (persist == null) return null; + return { + id: persist.id, + label: persist.label, + description: persist.description, + groupId: undefined, + version: undefined, + language: persist.language, + type: undefined, + status: persist.status, + definition: persist.definition, + users: persist.users + } + } ngOnInit(): void { - this.visibilityRulesService.buildVisibilityRules(this.visibilityRules, this.formGroup); + this.generatePreviewForm(); } + // ngOnChanges(changes: SimpleChanges) { + // if(changes['descriptionTemplatePersist']) this.generatePreviewForm(); + // } + } diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html index 065ede96c..3350341c6 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html @@ -223,7 +223,7 @@
- +
From aa6768e67dc41885230a374c1fa38a7443aa3b3d Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Fri, 29 Mar 2024 16:27:27 +0200 Subject: [PATCH 4/4] remove integration event descriptiontouched integration event --- ...nEntityTouchedIntegrationEventHandler.java | 5 - .../DescriptionTouchedIntegrationEvent.java | 102 --------------- ...riptionTouchedIntegrationEventHandler.java | 23 ---- ...ionTouchedIntegrationEventHandlerImpl.java | 34 ----- .../DmpTouchedIntegrationEvent.java | 116 ------------------ .../DmpTouchedIntegrationEventHandler.java | 24 ---- ...DmpTouchedIntegrationEventHandlerImpl.java | 35 ------ .../description/DescriptionServiceImpl.java | 7 +- .../eu/eudat/service/dmp/DmpServiceImpl.java | 6 - 9 files changed, 1 insertion(+), 351 deletions(-) delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEvent.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandler.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandlerImpl.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEvent.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandler.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandlerImpl.java diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandler.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandler.java index 592ea1c3c..3fa6cd7aa 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandler.java +++ b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandler.java @@ -1,10 +1,5 @@ package eu.eudat.integrationevent.outbox.annotationentitytouch; -import eu.eudat.integrationevent.outbox.dmptouched.DmpTouchedIntegrationEvent; -import eu.eudat.model.persist.DmpPersist; - -import java.util.ArrayList; -import java.util.List; import java.util.UUID; public interface AnnotationEntityTouchedIntegrationEventHandler { diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEvent.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEvent.java deleted file mode 100644 index 469fd7f5e..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEvent.java +++ /dev/null @@ -1,102 +0,0 @@ -package eu.eudat.integrationevent.outbox.descriptiontouched; - -import eu.eudat.commons.enums.DescriptionStatus; -import eu.eudat.integrationevent.TrackedEvent; -import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist; - -import java.util.List; -import java.util.UUID; - -public class DescriptionTouchedIntegrationEvent extends TrackedEvent { - - private UUID id; - - private String label; - - private UUID dmpId; - - private UUID dmpDescriptionTemplateId; - - private UUID descriptionTemplateId; - - private DescriptionStatus status; - - private String description; - - private PropertyDefinitionPersist properties; - - private List tags; - - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public UUID getDmpId() { - return dmpId; - } - - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; - } - - public UUID getDmpDescriptionTemplateId() { - return dmpDescriptionTemplateId; - } - - public void setDmpDescriptionTemplateId(UUID dmpDescriptionTemplateId) { - this.dmpDescriptionTemplateId = dmpDescriptionTemplateId; - } - - public UUID getDescriptionTemplateId() { - return descriptionTemplateId; - } - - public void setDescriptionTemplateId(UUID descriptionTemplateId) { - this.descriptionTemplateId = descriptionTemplateId; - } - - public DescriptionStatus getStatus() { - return status; - } - - public void setStatus(DescriptionStatus status) { - this.status = status; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public PropertyDefinitionPersist getProperties() { - return properties; - } - - public void setProperties(PropertyDefinitionPersist properties) { - this.properties = properties; - } - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandler.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandler.java deleted file mode 100644 index d2fb9fcdf..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.eudat.integrationevent.outbox.descriptiontouched; - -import eu.eudat.model.persist.DescriptionPersist; - -public interface DescriptionTouchedIntegrationEventHandler { - - void handle(DescriptionTouchedIntegrationEvent event); - - static DescriptionTouchedIntegrationEvent buildEventFromPersistModel(DescriptionPersist persist) { - DescriptionTouchedIntegrationEvent event = new DescriptionTouchedIntegrationEvent(); - event.setId(persist.getId()); - event.setLabel(persist.getLabel()); - event.setDmpId(persist.getDmpId()); - event.setDmpDescriptionTemplateId(persist.getDmpDescriptionTemplateId()); - event.setDescriptionTemplateId(persist.getDescriptionTemplateId()); - event.setStatus(persist.getStatus()); - event.setDescription(persist.getDescription()); - event.setProperties(persist.getProperties()); - event.setTags(persist.getTags()); - return event; - } - -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandlerImpl.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandlerImpl.java deleted file mode 100644 index 34e206558..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandlerImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -package eu.eudat.integrationevent.outbox.descriptiontouched; - -import eu.eudat.integrationevent.outbox.OutboxIntegrationEvent; -import eu.eudat.integrationevent.outbox.OutboxService; -import gr.cite.tools.logging.LoggerService; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - -import java.util.UUID; - -@Component -@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DescriptionTouchedIntegrationEventHandlerImpl implements DescriptionTouchedIntegrationEventHandler { - - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DescriptionTouchedIntegrationEventHandlerImpl.class)); - - private final OutboxService outboxService; - - public DescriptionTouchedIntegrationEventHandlerImpl(OutboxService outboxService) { - this.outboxService = outboxService; - } - - @Override - public void handle(DescriptionTouchedIntegrationEvent event) { - OutboxIntegrationEvent message = new OutboxIntegrationEvent(); - message.setMessageId(UUID.randomUUID()); - message.setType(OutboxIntegrationEvent.DESCRIPTION_TOUCH); - message.setEvent(event); - this.outboxService.publish(message); - } - -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEvent.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEvent.java deleted file mode 100644 index d33c07df6..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEvent.java +++ /dev/null @@ -1,116 +0,0 @@ -package eu.eudat.integrationevent.outbox.dmptouched; - -import eu.eudat.commons.enums.DmpAccessType; -import eu.eudat.commons.enums.DmpStatus; -import eu.eudat.integrationevent.TrackedEvent; -import eu.eudat.model.persist.DmpDescriptionTemplatePersist; -import eu.eudat.model.persist.dmpproperties.DmpBlueprintValuePersist; -import eu.eudat.model.persist.dmpproperties.DmpContactPersist; - -import java.util.List; -import java.util.Map; -import java.util.UUID; - -public class DmpTouchedIntegrationEvent extends TrackedEvent { - - private UUID id; - - private String label; - - private DmpStatus status; - - private List contacts; - - private Map dmpBlueprintValues; - - private String description; - - private String language; - - private UUID blueprint; - - private DmpAccessType accessType; - - private List descriptionTemplates; - - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public DmpStatus getStatus() { - return status; - } - - public void setStatus(DmpStatus status) { - this.status = status; - } - - public List getContacts() { - return contacts; - } - - public void setContacts(List contacts) { - this.contacts = contacts; - } - - public Map getDmpBlueprintValues() { - return dmpBlueprintValues; - } - - public void setDmpBlueprintValues(Map dmpBlueprintValues) { - this.dmpBlueprintValues = dmpBlueprintValues; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public UUID getBlueprint() { - return blueprint; - } - - public void setBlueprint(UUID blueprint) { - this.blueprint = blueprint; - } - - public DmpAccessType getAccessType() { - return accessType; - } - - public void setAccessType(DmpAccessType accessType) { - this.accessType = accessType; - } - - public List getDescriptionTemplates() { - return descriptionTemplates; - } - - public void setDescriptionTemplates(List descriptionTemplates) { - this.descriptionTemplates = descriptionTemplates; - } - -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandler.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandler.java deleted file mode 100644 index 4c70fb8f9..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -package eu.eudat.integrationevent.outbox.dmptouched; - -import eu.eudat.model.persist.DmpPersist; - -public interface DmpTouchedIntegrationEventHandler { - - void handle(DmpTouchedIntegrationEvent event); - - static DmpTouchedIntegrationEvent buildEventFromPersistModel(DmpPersist persist) { - DmpTouchedIntegrationEvent event = new DmpTouchedIntegrationEvent(); - event.setId(persist.getId()); - event.setLabel(persist.getLabel()); - event.setStatus(persist.getStatus()); - event.setContacts(persist.getProperties().getContacts()); - event.setDmpBlueprintValues(persist.getProperties().getDmpBlueprintValues()); - event.setDescription(persist.getDescription()); - event.setLanguage(persist.getLanguage()); - event.setBlueprint(persist.getBlueprint()); - event.setAccessType(persist.getAccessType()); - event.setDescriptionTemplates(persist.getDescriptionTemplates()); - return event; - } - -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandlerImpl.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandlerImpl.java deleted file mode 100644 index 5d45a42e0..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandlerImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -package eu.eudat.integrationevent.outbox.dmptouched; - -import eu.eudat.integrationevent.outbox.OutboxIntegrationEvent; -import eu.eudat.integrationevent.outbox.OutboxService; -import eu.eudat.integrationevent.outbox.tenantremoval.TenantRemovalIntegrationEventHandlerImpl; -import gr.cite.tools.logging.LoggerService; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - -import java.util.UUID; - -@Component -@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpTouchedIntegrationEventHandlerImpl implements DmpTouchedIntegrationEventHandler { - - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpTouchedIntegrationEventHandlerImpl.class)); - - private final OutboxService outboxService; - - public DmpTouchedIntegrationEventHandlerImpl(OutboxService outboxService) { - this.outboxService = outboxService; - } - - @Override - public void handle(DmpTouchedIntegrationEvent event) { - OutboxIntegrationEvent message = new OutboxIntegrationEvent(); - message.setMessageId(UUID.randomUUID()); - message.setType(OutboxIntegrationEvent.DMP_TOUCH); - message.setEvent(event); - this.outboxService.publish(message); - } - -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java index a40643460..3ca3616ff 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java @@ -24,7 +24,6 @@ import eu.eudat.event.DescriptionTouchedEvent; import eu.eudat.event.EventBroker; import eu.eudat.integrationevent.outbox.annotationentityremoval.AnnotationEntityRemovalIntegrationEventHandler; import eu.eudat.integrationevent.outbox.annotationentitytouch.AnnotationEntityTouchedIntegrationEventHandler; -import eu.eudat.integrationevent.outbox.descriptiontouched.DescriptionTouchedIntegrationEventHandler; import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent; import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler; import eu.eudat.model.*; @@ -99,7 +98,6 @@ public class DescriptionServiceImpl implements DescriptionService { private final ValidatorFactory validatorFactory; private final StorageFileProperties storageFileConfig; private final StorageFileService storageFileService; - private final DescriptionTouchedIntegrationEventHandler descriptionTouchedIntegrationEventHandler; private final AuthorizationContentResolver authorizationContentResolver; private final AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler; private final AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler; @@ -117,7 +115,7 @@ public class DescriptionServiceImpl implements DescriptionService { QueryFactory queryFactory, JsonHandlingService jsonHandlingService, UserScope userScope, - XmlHandlingService xmlHandlingService, NotifyIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, FileTransformerService fileTransformerService, ElasticService elasticService, ValidatorFactory validatorFactory, StorageFileProperties storageFileConfig, StorageFileService storageFileService, DescriptionTouchedIntegrationEventHandler descriptionTouchedIntegrationEventHandler, AuthorizationContentResolver authorizationContentResolver, AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler, AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler) { + XmlHandlingService xmlHandlingService, NotifyIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, FileTransformerService fileTransformerService, ElasticService elasticService, ValidatorFactory validatorFactory, StorageFileProperties storageFileConfig, StorageFileService storageFileService, AuthorizationContentResolver authorizationContentResolver, AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler, AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler) { this.entityManager = entityManager; this.authorizationService = authorizationService; this.deleterFactory = deleterFactory; @@ -137,7 +135,6 @@ public class DescriptionServiceImpl implements DescriptionService { this.validatorFactory = validatorFactory; this.storageFileConfig = storageFileConfig; this.storageFileService = storageFileService; - this.descriptionTouchedIntegrationEventHandler = descriptionTouchedIntegrationEventHandler; this.authorizationContentResolver = authorizationContentResolver; this.annotationEntityTouchedIntegrationEventHandler = annotationEntityTouchedIntegrationEventHandler; this.annotationEntityRemovalIntegrationEventHandler = annotationEntityRemovalIntegrationEventHandler; @@ -234,8 +231,6 @@ public class DescriptionServiceImpl implements DescriptionService { //this.deleteOldFilesAndAddNew(datasetWizardModel, userInfo); //TODO this.eventBroker.emit(new DescriptionTouchedEvent(data.getId())); - this.descriptionTouchedIntegrationEventHandler.handle(DescriptionTouchedIntegrationEventHandler.buildEventFromPersistModel(model)); - this.annotationEntityTouchedIntegrationEventHandler.handleDescription(data.getId()); this.elasticService.persistDescription(data); diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java index 25d5fd36a..c5734e065 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java @@ -26,7 +26,6 @@ import eu.eudat.event.DmpTouchedEvent; import eu.eudat.event.EventBroker; import eu.eudat.integrationevent.outbox.annotationentityremoval.AnnotationEntityRemovalIntegrationEventHandler; import eu.eudat.integrationevent.outbox.annotationentitytouch.AnnotationEntityTouchedIntegrationEventHandler; -import eu.eudat.integrationevent.outbox.dmptouched.DmpTouchedIntegrationEventHandler; import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent; import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler; import eu.eudat.model.*; @@ -122,7 +121,6 @@ public class DmpServiceImpl implements DmpService { private final ElasticService elasticService; - private final DmpTouchedIntegrationEventHandler dmpTouchedIntegrationEventHandler; private final AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler; private final AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler; @@ -149,7 +147,6 @@ public class DmpServiceImpl implements DmpService { FileTransformerService fileTransformerService, ValidatorFactory validatorFactory, ElasticService elasticService, - DmpTouchedIntegrationEventHandler dmpTouchedIntegrationEventHandler, AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler, AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler, AuthorizationContentResolver authorizationContentResolver) { this.entityManager = entityManager; this.authorizationService = authorizationService; @@ -170,7 +167,6 @@ public class DmpServiceImpl implements DmpService { this.actionConfirmationService = actionConfirmationService; this.validatorFactory = validatorFactory; this.elasticService = elasticService; - this.dmpTouchedIntegrationEventHandler = dmpTouchedIntegrationEventHandler; this.annotationEntityTouchedIntegrationEventHandler = annotationEntityTouchedIntegrationEventHandler; this.annotationEntityRemovalIntegrationEventHandler = annotationEntityRemovalIntegrationEventHandler; this.authorizationContentResolver = authorizationContentResolver; @@ -203,8 +199,6 @@ public class DmpServiceImpl implements DmpService { this.eventBroker.emit(new DmpTouchedEvent(data.getId())); - this.dmpTouchedIntegrationEventHandler.handle(DmpTouchedIntegrationEventHandler.buildEventFromPersistModel(model)); - this.sendNotification(data); this.assignUsers(data.getId(), this.inviteUserOrAssignUsers(data.getId(), model.getUsers(), false), null, false);