Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-03-29 16:31:36 +02:00
commit 1a74939321
63 changed files with 402 additions and 543 deletions

View File

@ -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>

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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>

View File

@ -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>

View File

@ -66,7 +66,7 @@ public enum FieldType implements DatabaseEnum<String> {
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){

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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";

View File

@ -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";

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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 {

View File

@ -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<String> 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<String> getTags() {
return tags;
}
public void setTags(List<String> tags) {
this.tags = tags;
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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<DmpContactPersist> contacts;
private Map<UUID, DmpBlueprintValuePersist> dmpBlueprintValues;
private String description;
private String language;
private UUID blueprint;
private DmpAccessType accessType;
private List<DmpDescriptionTemplatePersist> 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<DmpContactPersist> getContacts() {
return contacts;
}
public void setContacts(List<DmpContactPersist> contacts) {
this.contacts = contacts;
}
public Map<UUID, DmpBlueprintValuePersist> getDmpBlueprintValues() {
return dmpBlueprintValues;
}
public void setDmpBlueprintValues(Map<UUID, DmpBlueprintValuePersist> 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<DmpDescriptionTemplatePersist> getDescriptionTemplates() {
return descriptionTemplates;
}
public void setDescriptionTemplates(List<DmpDescriptionTemplatePersist> descriptionTemplates) {
this.descriptionTemplates = descriptionTemplates;
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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";

View File

@ -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";

View File

@ -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);

View File

@ -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);

View File

@ -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>
@ -412,6 +391,19 @@
</property>
</activation>
</profile>
<profile>
<id>cite-dev</id>
<repositories>
<repository>
<id>cite-maven</id>
<name>CITE Maven Repository</name>
<url>https://crepo.cite.gr/repository/cite-maven/</url>
</repository>
</repositories>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
</project>

View File

@ -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);

View File

@ -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:

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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 { }

View File

@ -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:

View File

@ -1,3 +1 @@
<app-dataset-description [form]="formGroup" [visibilityRules]="visibilityRules" *ngIf="formGroup">
</app-dataset-description>
<app-description-form *ngIf="formGroup" [propertiesFormGroup]="previewPropertiesFormGroup" [descriptionTemplate]="descriptionTemplate" [visibilityRulesService]="visibilityRulesService"></app-description-form>

View File

@ -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();
// }
}

View File

@ -223,7 +223,7 @@
<div class="col-12" *ngIf="(selectedTocEntry.type === tocEntryEnumValues.Section) || (selectedTocEntry.type === tocEntryEnumValues.FieldSet)">
<app-description-template-editor-section-fieldset-component
[tocentry]="selectedTocEntry"
[viewOnly]="viewOnly"
[viewOnly]="formGroup.disabled"
[datasetProfileId]="datasetProfileId"
[validationErrorModel]="editorModel.validationErrorModel"
[validationRootPath]="selectedTocEntry.validationRootPath"
@ -268,7 +268,7 @@
<div class="col-9">
<div class="col">
<div class="col-12">
<app-final-preview-component [formGroup]="formGroup" [visibilityRules]="visibilityRules">
<app-final-preview-component [formGroup]="formGroup" [visibilityRules]="visibilityRules" [descriptionTemplatePersist]="formGroup.getRawValue()">
</app-final-preview-component>
</div>

View File

@ -33,7 +33,7 @@ export class DescriptionFormAnnotationService extends BaseService {
}
public getCount(anchor: string) {
if (this.annotationsPerAnchor != null && this.annotationsPerAnchor.has(anchor)) {
if (this.annotationsPerAnchor?.has(anchor)) {
return this.annotationsPerAnchor.get(anchor);
} else {
return 0;

View File

@ -296,7 +296,7 @@
<div class="heading">{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}</div>
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}}</mat-label>
<app-multiple-auto-complete placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}}" [hidePlaceholder]="true" required='true' [formControl]="formGroup.get('descriptionTemplates').get(section.id)" [configuration]="descriptionTemplateService.descriptionTempalteGroupMultipleAutocompleteConfiguration" (optionRemoved)="onRemoveDescriptionTemplate($event, i)" (optionActionClicked)="onPreviewDescriptionTemplate($event, i)">
<app-multiple-auto-complete placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}}" [hidePlaceholder]="true" required='true' [formControl]="formGroup.get('descriptionTemplates').get(section.id)" [configuration]="descriptionTemplateService.descriptionTempalteGroupMultipleAutocompleteConfiguration" (optionActionClicked)="onPreviewDescriptionTemplate($event, i)">
</app-multiple-auto-complete>
<mat-error *ngIf="formGroup.get('descriptionTemplates').get(section.id).hasError('backendError')">{{formGroup.get('descriptionTemplates').get(section.id).getError('backendError').message}}</mat-error>
<mat-error *ngIf="formGroup.get('descriptionTemplates').get(section.id).hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>

View File

@ -451,12 +451,6 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> 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',

View File

@ -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());

View File

@ -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));

View File

@ -39,9 +39,6 @@ cache:
enableRecordStats: false
expireAfterWriteSeconds: 60
mapCaches:
- names: [ cacheB ]
allowNullValues: true
storeByValue: true
apiKey:
name: apikey
keyPattern: resolve_$keyhash$:v0

View File

@ -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_

View File

@ -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}

View File

@ -37,3 +37,5 @@ idpclient:
- type: azp
Authorities:
- type: authorities
ExternalProviderName:
- type: identity_provider

View File

@ -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

View File

@ -0,0 +1,6 @@
web:
security:
idp:
resource:
jwt:
audiences: [ "dmp_notification" ]

View File

@ -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}

View File

@ -1,3 +1,13 @@
server:
port: ${WEB_PORT}
forward-headers-strategy: NONE
tomcat:
threads:
max: 20
max-connections: 10000
spring:
servlet:
multipart:
max-file-size: 10MB
max-request-size: 10MB

View File

@ -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>

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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>