update queues to use smallint enums
This commit is contained in:
parent
21e6015f89
commit
102141aa0d
|
@ -62,7 +62,7 @@
|
|||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>oidc-authn</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
|
@ -72,7 +72,7 @@
|
|||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>oidc-authz</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
|
@ -82,7 +82,7 @@
|
|||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>validation</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<QueueInboxStatus, Short> {
|
||||
@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);
|
||||
}
|
||||
}
|
|
@ -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<QueueOutboxNotifyStatus, Short> {
|
||||
@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);
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<version>3.2.1</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@ -136,18 +136,18 @@
|
|||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>rabbitmq-core</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>queue-inbox</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>queue-outbox</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.1.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -65,12 +65,12 @@
|
|||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>queue-inbox</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>queue-outbox</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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<QueueInboxStatus, Short> {
|
||||
@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);
|
||||
}
|
||||
}
|
|
@ -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<QueueOutboxNotifyStatus, Short> {
|
||||
@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);
|
||||
}
|
||||
}
|
|
@ -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<UUID> descriptions = Lists.newArrayList();
|
||||
private List<UUID> descriptions = new ArrayList<>();
|
||||
|
||||
public static final String _descriptions = "descriptions";
|
||||
|
||||
|
|
|
@ -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<UUID> descriptions = Lists.newArrayList();
|
||||
private List<UUID> descriptions = new ArrayList<>();
|
||||
|
||||
public static final String _descriptions = "descriptions";
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<version>3.2.1</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@ -41,7 +41,7 @@
|
|||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20230227</version>
|
||||
<version>20240303</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
@ -92,7 +92,7 @@
|
|||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>7.6.0</version>
|
||||
<version>7.17.19</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate.orm</groupId>
|
||||
|
@ -109,7 +109,7 @@
|
|||
<dependency>
|
||||
<groupId>com.jayway.jsonpath</groupId>
|
||||
<artifactId>json-path</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.9.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
@ -153,24 +153,8 @@
|
|||
<version>3.5</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.xmlgraphics/fop -->
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>fop</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
|
@ -190,11 +174,6 @@
|
|||
<version>1.0.6</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/fr.opensagres.xdocreport.itext.extension -->
|
||||
<dependency>
|
||||
<groupId>fr.opensagres.xdocreport</groupId>
|
||||
<artifactId>fr.opensagres.xdocreport.itext.extension</artifactId>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
|
@ -356,18 +335,18 @@
|
|||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>queue-inbox</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>queue-outbox</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>rabbitmq-core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.1.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -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:
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -71,10 +71,10 @@ public class InAppNotificationController {
|
|||
@PostMapping("query")
|
||||
public QueryResult<InAppNotification> 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<InAppNotificationEntity> 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());
|
||||
|
|
|
@ -66,7 +66,7 @@ public class UserNotificationPreferenceController {
|
|||
public QueryResult<UserNotificationPreference> 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<UserNotificationPreferenceEntity> 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));
|
||||
|
|
|
@ -39,9 +39,6 @@ cache:
|
|||
enableRecordStats: false
|
||||
expireAfterWriteSeconds: 60
|
||||
mapCaches:
|
||||
- names: [ cacheB ]
|
||||
allowNullValues: true
|
||||
storeByValue: true
|
||||
apiKey:
|
||||
name: apikey
|
||||
keyPattern: resolve_$keyhash$:v0
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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:}
|
||||
address: ${MAIL_ADDRESS}
|
|
@ -37,3 +37,5 @@ idpclient:
|
|||
- type: azp
|
||||
Authorities:
|
||||
- type: authorities
|
||||
ExternalProviderName:
|
||||
- type: identity_provider
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
web:
|
||||
security:
|
||||
idp:
|
||||
resource:
|
||||
jwt:
|
||||
audiences: [ "dmp_notification" ]
|
|
@ -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:}
|
||||
issuer-uri: ${IDP_ISSUER_URI}
|
||||
validIssuer: ${IDP_ISSUER_URI}
|
|
@ -1,3 +1,13 @@
|
|||
server:
|
||||
port: ${WEB_PORT}
|
||||
forward-headers-strategy: NONE
|
||||
forward-headers-strategy: NONE
|
||||
tomcat:
|
||||
threads:
|
||||
max: 20
|
||||
max-connections: 10000
|
||||
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
|
@ -63,7 +63,7 @@
|
|||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>oidc-authn</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
|
@ -73,7 +73,7 @@
|
|||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>oidc-authz</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<QueueInboxStatus, Short> {
|
||||
@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);
|
||||
}
|
||||
}
|
|
@ -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<QueueOutboxNotifyStatus, Short> {
|
||||
@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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<UUID> ids) {
|
||||
try {
|
||||
logger.debug(new DataLogEntry("marking as read in-app notifications", ids));
|
||||
|
||||
UUID userId = this.userScope.getUserId();
|
||||
List<InAppNotificationEntity> items = this.queryFactory.query(InAppNotificationQuery.class)
|
||||
.ids(ids)
|
||||
.userId(userId)
|
||||
.collect();
|
||||
|
||||
Instant now = Instant.now();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<version>3.2.1</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@ -136,18 +136,18 @@
|
|||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>rabbitmq-core</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>queue-inbox</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>queue-outbox</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
Loading…
Reference in New Issue