move configuration
This commit is contained in:
parent
eba8bc9cb6
commit
20f6ae27ed
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.locale;
|
package eu.eudat.commons.locale;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.locale;
|
package eu.eudat.commons.locale;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.notification;
|
package eu.eudat.commons.notification;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.notification;
|
package eu.eudat.commons.notification;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
package eu.eudat.configurations.transformer;
|
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@EnableConfigurationProperties({TransformerProperties.class, TransformerCacheOptions.class})
|
|
||||||
public class TransformerConfiguration {
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.db;
|
package eu.eudat.data.namingstrategy;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.db;
|
package eu.eudat.data.namingstrategy;
|
||||||
|
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import org.hibernate.boot.model.naming.Identifier;
|
import org.hibernate.boot.model.naming.Identifier;
|
|
@ -2,20 +2,14 @@ package eu.eudat.elastic.query;
|
||||||
import co.elastic.clients.elasticsearch._types.query_dsl.Query;
|
import co.elastic.clients.elasticsearch._types.query_dsl.Query;
|
||||||
import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
|
import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.authorization.Permission;
|
|
||||||
import eu.eudat.commons.enums.DescriptionStatus;
|
import eu.eudat.commons.enums.DescriptionStatus;
|
||||||
import eu.eudat.commons.enums.DmpAccessType;
|
import eu.eudat.commons.enums.DmpAccessType;
|
||||||
import eu.eudat.commons.enums.DmpStatus;
|
import eu.eudat.commons.enums.DmpStatus;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.configurations.elastic.AppElasticProperties;
|
import eu.eudat.service.elastic.AppElasticProperties;
|
||||||
import eu.eudat.data.DescriptionEntity;
|
|
||||||
import eu.eudat.elastic.data.DescriptionElasticEntity;
|
import eu.eudat.elastic.data.DescriptionElasticEntity;
|
||||||
import eu.eudat.elastic.data.DmpElasticEntity;
|
import eu.eudat.elastic.data.DmpElasticEntity;
|
||||||
import eu.eudat.elastic.data.nested.NestedDmpElasticEntity;
|
import eu.eudat.elastic.data.nested.NestedDmpElasticEntity;
|
||||||
import eu.eudat.query.DescriptionQuery;
|
|
||||||
import eu.eudat.query.DmpDescriptionTemplateQuery;
|
|
||||||
import eu.eudat.query.DmpQuery;
|
|
||||||
import eu.eudat.service.elastic.ElasticService;
|
import eu.eudat.service.elastic.ElasticService;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
|
@ -35,7 +29,6 @@ import org.springframework.stereotype.Component;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
//Like in C# make it Transient
|
//Like in C# make it Transient
|
||||||
|
|
|
@ -6,15 +6,10 @@ import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.commons.enums.DmpAccessType;
|
import eu.eudat.commons.enums.DmpAccessType;
|
||||||
import eu.eudat.commons.enums.DmpStatus;
|
import eu.eudat.commons.enums.DmpStatus;
|
||||||
import eu.eudat.commons.enums.DmpVersionStatus;
|
import eu.eudat.commons.enums.DmpVersionStatus;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.configurations.elastic.AppElasticProperties;
|
import eu.eudat.service.elastic.AppElasticProperties;
|
||||||
import eu.eudat.data.DmpEntity;
|
|
||||||
import eu.eudat.elastic.data.DescriptionElasticEntity;
|
|
||||||
import eu.eudat.elastic.data.DmpElasticEntity;
|
import eu.eudat.elastic.data.DmpElasticEntity;
|
||||||
import eu.eudat.elastic.data.nested.NestedDescriptionElasticEntity;
|
import eu.eudat.elastic.data.nested.NestedDescriptionElasticEntity;
|
||||||
import eu.eudat.query.DmpQuery;
|
|
||||||
import eu.eudat.query.utils.QueryUtilsService;
|
|
||||||
import eu.eudat.service.elastic.ElasticService;
|
import eu.eudat.service.elastic.ElasticService;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
|
@ -22,8 +17,6 @@ import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.elastic.configuration.ElasticProperties;
|
import gr.cite.tools.elastic.configuration.ElasticProperties;
|
||||||
import gr.cite.tools.elastic.mapper.FieldBasedMapper;
|
import gr.cite.tools.elastic.mapper.FieldBasedMapper;
|
||||||
import gr.cite.tools.elastic.query.*;
|
import gr.cite.tools.elastic.query.*;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import eu.eudat.commons.enums.ContactInfoType;
|
||||||
import eu.eudat.commons.enums.notification.NotificationContactType;
|
import eu.eudat.commons.enums.notification.NotificationContactType;
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.commons.types.notification.*;
|
import eu.eudat.commons.types.notification.*;
|
||||||
import eu.eudat.configurations.notification.NotificationProperties;
|
import eu.eudat.commons.notification.NotificationProperties;
|
||||||
import eu.eudat.data.UserContactInfoEntity;
|
import eu.eudat.data.UserContactInfoEntity;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||||
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.deposit;
|
package eu.eudat.service.deposit;
|
||||||
|
|
||||||
import gr.cite.tools.cache.CacheOptions;
|
import gr.cite.tools.cache.CacheOptions;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.deposit;
|
package eu.eudat.service.deposit;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.deposit;
|
package eu.eudat.service.deposit;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
|
@ -7,8 +7,6 @@ import eu.eudat.commonmodels.models.FileEnvelopeModel;
|
||||||
import eu.eudat.commonmodels.models.dmp.DmpModel;
|
import eu.eudat.commonmodels.models.dmp.DmpModel;
|
||||||
import eu.eudat.commons.enums.StorageType;
|
import eu.eudat.commons.enums.StorageType;
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.configurations.deposit.DepositProperties;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.data.DmpEntity;
|
import eu.eudat.data.DmpEntity;
|
||||||
import eu.eudat.depositinterface.repository.DepositClient;
|
import eu.eudat.depositinterface.repository.DepositClient;
|
||||||
import eu.eudat.depositinterface.repository.DepositConfiguration;
|
import eu.eudat.depositinterface.repository.DepositConfiguration;
|
||||||
|
|
|
@ -16,7 +16,7 @@ import eu.eudat.commons.types.descriptiontemplate.fielddata.ReferenceTypeDataEnt
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.UploadDataEntity;
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.UploadDataEntity;
|
||||||
import eu.eudat.commons.types.notification.*;
|
import eu.eudat.commons.types.notification.*;
|
||||||
import eu.eudat.commons.types.reference.DefinitionEntity;
|
import eu.eudat.commons.types.reference.DefinitionEntity;
|
||||||
import eu.eudat.configurations.notification.NotificationProperties;
|
import eu.eudat.commons.notification.NotificationProperties;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.data.*;
|
import eu.eudat.data.*;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.ReferenceTypeDataEntity;
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.ReferenceTypeDataEntity;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.importexport.*;
|
import eu.eudat.commons.types.descriptiontemplate.importexport.*;
|
||||||
import eu.eudat.commons.types.notification.*;
|
import eu.eudat.commons.types.notification.*;
|
||||||
import eu.eudat.configurations.notification.NotificationProperties;
|
import eu.eudat.commons.notification.NotificationProperties;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.data.*;
|
import eu.eudat.data.*;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
@ -51,6 +51,7 @@ import gr.cite.tools.logging.MapLogEntry;
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import jakarta.xml.bind.JAXBException;
|
import jakarta.xml.bind.JAXBException;
|
||||||
|
import org.apache.commons.lang3.NotImplementedException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -61,7 +62,6 @@ import org.springframework.stereotype.Service;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
import javax.management.InvalidApplicationException;
|
||||||
import javax.ws.rs.NotSupportedException;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -405,7 +405,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
|
|
||||||
if (FieldType.isTextType(fieldType)) {
|
if (FieldType.isTextType(fieldType)) {
|
||||||
if (FieldType.UPLOAD.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())){
|
if (FieldType.UPLOAD.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())){
|
||||||
throw new NotSupportedException("Upload not supported");
|
throw new NotImplementedException("Upload not supported");
|
||||||
} else {
|
} else {
|
||||||
data.setTextValue(persist.getTextValue());
|
data.setTextValue(persist.getTextValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import eu.eudat.commons.types.dmpreference.DmpReferenceDataEntity;
|
||||||
import eu.eudat.commons.types.notification.*;
|
import eu.eudat.commons.types.notification.*;
|
||||||
import eu.eudat.commons.types.reference.DefinitionEntity;
|
import eu.eudat.commons.types.reference.DefinitionEntity;
|
||||||
import eu.eudat.commons.types.reference.FieldEntity;
|
import eu.eudat.commons.types.reference.FieldEntity;
|
||||||
import eu.eudat.configurations.notification.NotificationProperties;
|
import eu.eudat.commons.notification.NotificationProperties;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.data.*;
|
import eu.eudat.data.*;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.elastic;
|
package eu.eudat.service.elastic;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.elastic;
|
package eu.eudat.service.elastic;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import co.elastic.clients.elasticsearch._types.mapping.TypeMapping;
|
||||||
import co.elastic.clients.elasticsearch.indices.*;
|
import co.elastic.clients.elasticsearch.indices.*;
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.configurations.elastic.AppElasticProperties;
|
|
||||||
import eu.eudat.data.DescriptionEntity;
|
import eu.eudat.data.DescriptionEntity;
|
||||||
import eu.eudat.data.DmpEntity;
|
import eu.eudat.data.DmpEntity;
|
||||||
import eu.eudat.elastic.data.DescriptionElasticEntity;
|
import eu.eudat.elastic.data.DescriptionElasticEntity;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.keycloak;
|
package eu.eudat.service.keycloak;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package eu.eudat.configurations.keycloak;
|
package eu.eudat.service.keycloak;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties(KeycloakResourcesProperties.class)
|
@EnableConfigurationProperties(KeycloakResourcesProperties.class)
|
||||||
public class KeycloakResourcesConfiguration {
|
public class KeycloakResourcesConfiguration {
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.keycloak;
|
package eu.eudat.service.keycloak;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
@ -1,8 +1,5 @@
|
||||||
package eu.eudat.service.keycloak;
|
package eu.eudat.service.keycloak;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import eu.eudat.configurations.keycloak.KeycloakAuthorityProperties;
|
|
||||||
import eu.eudat.configurations.keycloak.KeycloakResourcesConfiguration;
|
|
||||||
import gr.cite.commons.web.keycloak.api.configuration.KeycloakClientConfiguration;
|
import gr.cite.commons.web.keycloak.api.configuration.KeycloakClientConfiguration;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -12,10 +9,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class KeycloakServiceImpl implements KeycloakService {
|
public class KeycloakServiceImpl implements KeycloakService {
|
||||||
|
@ -61,7 +55,7 @@ public class KeycloakServiceImpl implements KeycloakService {
|
||||||
if (clientId == null)
|
if (clientId == null)
|
||||||
clientId = clientConfiguration.getProperties().getClientId();
|
clientId = clientConfiguration.getProperties().getClientId();
|
||||||
UserRepresentation user = api.users().findUserById(subjectId.toString());
|
UserRepresentation user = api.users().findUserById(subjectId.toString());
|
||||||
user.getClientRoles().computeIfAbsent(clientId, k -> Lists.newArrayList());
|
user.getClientRoles().computeIfAbsent(clientId, k -> new ArrayList<>());
|
||||||
Set<String> clientRoles = new HashSet<>(Set.copyOf(user.getClientRoles().get(clientId)));
|
Set<String> clientRoles = new HashSet<>(Set.copyOf(user.getClientRoles().get(clientId)));
|
||||||
clientRoles.add(role.name());
|
clientRoles.add(role.name());
|
||||||
user.getClientRoles().get(clientId).clear();
|
user.getClientRoles().get(clientId).clear();
|
||||||
|
@ -73,7 +67,7 @@ public class KeycloakServiceImpl implements KeycloakService {
|
||||||
public void removeClientRoleFromUser(UUID subjectId, String clientId, KeycloakRole role) {
|
public void removeClientRoleFromUser(UUID subjectId, String clientId, KeycloakRole role) {
|
||||||
if (clientId == null) clientId = clientConfiguration.getProperties().getClientId();
|
if (clientId == null) clientId = clientConfiguration.getProperties().getClientId();
|
||||||
UserRepresentation user = api.users().findUserById(subjectId.toString());
|
UserRepresentation user = api.users().findUserById(subjectId.toString());
|
||||||
user.getClientRoles().computeIfAbsent(clientId, k -> Lists.newArrayList());
|
user.getClientRoles().computeIfAbsent(clientId, k -> new ArrayList<>());
|
||||||
Set<String> clientRoles = new HashSet<>(Set.copyOf(user.getClientRoles().get(clientId)));
|
Set<String> clientRoles = new HashSet<>(Set.copyOf(user.getClientRoles().get(clientId)));
|
||||||
clientRoles.remove(role.name());
|
clientRoles.remove(role.name());
|
||||||
user.getClientRoles().get(clientId).clear();
|
user.getClientRoles().get(clientId).clear();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.lock;
|
package eu.eudat.service.lock;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.lock;
|
package eu.eudat.service.lock;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.authorization.authorizationcontentresolver.AuthorizationContentResolver;
|
import eu.eudat.authorization.authorizationcontentresolver.AuthorizationContentResolver;
|
||||||
import eu.eudat.commons.enums.LockTargetType;
|
import eu.eudat.commons.enums.LockTargetType;
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.configurations.lock.LockProperties;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.data.LockEntity;
|
import eu.eudat.data.LockEntity;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.tenant;
|
package eu.eudat.service.tenant;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.tenant;
|
package eu.eudat.service.tenant;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
|
@ -5,7 +5,6 @@ import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.commons.XmlHandlingService;
|
import eu.eudat.commons.XmlHandlingService;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.commons.types.tenant.*;
|
import eu.eudat.commons.types.tenant.*;
|
||||||
import eu.eudat.configurations.tenant.TenantProperties;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.data.TenantEntity;
|
import eu.eudat.data.TenantEntity;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package eu.eudat.configurations.transformer;
|
package eu.eudat.service.transformer;
|
||||||
|
|
||||||
import gr.cite.tools.cache.CacheOptions;
|
import gr.cite.tools.cache.CacheOptions;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
@ConfigurationProperties(prefix = "cache.transformer")
|
@ConfigurationProperties(prefix = "cache.transformer")
|
||||||
public class TransformerCacheOptions extends CacheOptions {
|
public class FileTransformerCacheOptions extends CacheOptions {
|
||||||
}
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package eu.eudat.service.transformer;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableConfigurationProperties({FileTransformerProperties.class, FileTransformerCacheOptions.class})
|
||||||
|
public class FileTransformerConfiguration {
|
||||||
|
}
|
|
@ -1,19 +1,15 @@
|
||||||
package eu.eudat.service.transformer;
|
package eu.eudat.service.transformer;
|
||||||
|
|
||||||
|
|
||||||
import eu.eudat.configurations.deposit.DepositCacheOptions;
|
|
||||||
import eu.eudat.configurations.transformer.TransformerCacheOptions;
|
|
||||||
import eu.eudat.model.file.TransformerCacheModel;
|
import eu.eudat.model.file.TransformerCacheModel;
|
||||||
import gr.cite.tools.cache.CacheService;
|
import gr.cite.tools.cache.CacheService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class FileTransformerConfigurationCache extends CacheService<TransformerCacheModel> {
|
public class FileTransformerConfigurationCache extends CacheService<TransformerCacheModel> {
|
||||||
@Autowired
|
@Autowired
|
||||||
public FileTransformerConfigurationCache(TransformerCacheOptions options) {
|
public FileTransformerConfigurationCache(FileTransformerCacheOptions options) {
|
||||||
super(options);
|
super(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.configurations.transformer;
|
package eu.eudat.service.transformer;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||||
|
@ -6,12 +6,12 @@ import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ConfigurationProperties(prefix = "transformer")
|
@ConfigurationProperties(prefix = "transformer")
|
||||||
public class TransformerProperties {
|
public class FileTransformerProperties {
|
||||||
|
|
||||||
private final List<TransformerSource> sources;
|
private final List<TransformerSource> sources;
|
||||||
|
|
||||||
@ConstructorBinding
|
@ConstructorBinding
|
||||||
public TransformerProperties(List<TransformerSource> sources) {
|
public FileTransformerProperties(List<TransformerSource> sources) {
|
||||||
this.sources = sources;
|
this.sources = sources;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,7 @@ import eu.eudat.commonmodels.models.FileEnvelopeModel;
|
||||||
import eu.eudat.commonmodels.models.description.DescriptionModel;
|
import eu.eudat.commonmodels.models.description.DescriptionModel;
|
||||||
import eu.eudat.commonmodels.models.dmp.DmpModel;
|
import eu.eudat.commonmodels.models.dmp.DmpModel;
|
||||||
import eu.eudat.commons.enums.StorageType;
|
import eu.eudat.commons.enums.StorageType;
|
||||||
import eu.eudat.configurations.transformer.TransformerProperties;
|
|
||||||
import eu.eudat.file.transformer.interfaces.FileTransformerConfiguration;
|
import eu.eudat.file.transformer.interfaces.FileTransformerConfiguration;
|
||||||
import eu.eudat.file.transformer.models.misc.FileFormat;
|
|
||||||
import eu.eudat.model.Description;
|
import eu.eudat.model.Description;
|
||||||
import eu.eudat.model.Dmp;
|
import eu.eudat.model.Dmp;
|
||||||
import eu.eudat.model.builder.commonmodels.description.DescriptionCommonModelBuilder;
|
import eu.eudat.model.builder.commonmodels.description.DescriptionCommonModelBuilder;
|
||||||
|
@ -43,7 +41,7 @@ import java.util.*;
|
||||||
public class FileTransformerServiceImpl implements FileTransformerService {
|
public class FileTransformerServiceImpl implements FileTransformerService {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(FileTransformerServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(FileTransformerServiceImpl.class);
|
||||||
|
|
||||||
private final TransformerProperties transformerProperties;
|
private final FileTransformerProperties fileTransformerProperties;
|
||||||
private final Map<String, TransformerRepository> clients;
|
private final Map<String, TransformerRepository> clients;
|
||||||
private final TokenExchangeCacheService tokenExchangeCacheService;
|
private final TokenExchangeCacheService tokenExchangeCacheService;
|
||||||
private final FileTransformerConfigurationCache fileTransformerConfigurationCache;
|
private final FileTransformerConfigurationCache fileTransformerConfigurationCache;
|
||||||
|
@ -54,9 +52,9 @@ public class FileTransformerServiceImpl implements FileTransformerService {
|
||||||
private final MessageSource messageSource;
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public FileTransformerServiceImpl(TransformerProperties transformerProperties, TokenExchangeCacheService tokenExchangeCacheService, FileTransformerConfigurationCache fileTransformerConfigurationCache, AuthorizationService authorizationService,
|
public FileTransformerServiceImpl(FileTransformerProperties fileTransformerProperties, TokenExchangeCacheService tokenExchangeCacheService, FileTransformerConfigurationCache fileTransformerConfigurationCache, AuthorizationService authorizationService,
|
||||||
QueryFactory queryFactory, BuilderFactory builderFactory, StorageFileService storageFileService, MessageSource messageSource) {
|
QueryFactory queryFactory, BuilderFactory builderFactory, StorageFileService storageFileService, MessageSource messageSource) {
|
||||||
this.transformerProperties = transformerProperties;
|
this.fileTransformerProperties = fileTransformerProperties;
|
||||||
this.tokenExchangeCacheService = tokenExchangeCacheService;
|
this.tokenExchangeCacheService = tokenExchangeCacheService;
|
||||||
this.fileTransformerConfigurationCache = fileTransformerConfigurationCache;
|
this.fileTransformerConfigurationCache = fileTransformerConfigurationCache;
|
||||||
this.authorizationService = authorizationService;
|
this.authorizationService = authorizationService;
|
||||||
|
@ -71,7 +69,7 @@ public class FileTransformerServiceImpl implements FileTransformerService {
|
||||||
if (this.clients.containsKey(repoId)) return this.clients.get(repoId);
|
if (this.clients.containsKey(repoId)) return this.clients.get(repoId);
|
||||||
|
|
||||||
//GK: It's register time
|
//GK: It's register time
|
||||||
TransformerProperties.TransformerSource source = transformerProperties.getSources().stream().filter(depositSource -> depositSource.getTransformerId().equals(repoId)).findFirst().orElse(null);
|
FileTransformerProperties.TransformerSource source = fileTransformerProperties.getSources().stream().filter(depositSource -> depositSource.getTransformerId().equals(repoId)).findFirst().orElse(null);
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
String host = URI.create(source.getUrl()).getHost();
|
String host = URI.create(source.getUrl()).getHost();
|
||||||
TokenExchangeModel tokenExchangeModel = new TokenExchangeModel(host + "_" + source.getClientId(), source.getIssuerUrl(), source.getClientId(), source.getClientSecret(), source.getScope());
|
TokenExchangeModel tokenExchangeModel = new TokenExchangeModel(host + "_" + source.getClientId(), source.getIssuerUrl(), source.getClientId(), source.getClientSecret(), source.getScope());
|
||||||
|
@ -105,7 +103,7 @@ public class FileTransformerServiceImpl implements FileTransformerService {
|
||||||
if (configs == null) {
|
if (configs == null) {
|
||||||
List<FileTransformerConfiguration> configurations = new ArrayList<>();
|
List<FileTransformerConfiguration> configurations = new ArrayList<>();
|
||||||
//GK: So much for lazy loading
|
//GK: So much for lazy loading
|
||||||
List<TransformerRepository> repositories = transformerProperties.getSources().stream().map(depositSource -> getRepository(depositSource.getTransformerId())).toList();
|
List<TransformerRepository> repositories = fileTransformerProperties.getSources().stream().map(depositSource -> getRepository(depositSource.getTransformerId())).toList();
|
||||||
|
|
||||||
repositories = new ArrayList<>(repositories);
|
repositories = new ArrayList<>(repositories);
|
||||||
repositories.forEach((client) -> {
|
repositories.forEach((client) -> {
|
||||||
|
|
|
@ -17,7 +17,7 @@ import eu.eudat.commons.types.actionconfirmation.RemoveCredentialRequestEntity;
|
||||||
import eu.eudat.commons.types.notification.*;
|
import eu.eudat.commons.types.notification.*;
|
||||||
import eu.eudat.commons.types.user.AdditionalInfoEntity;
|
import eu.eudat.commons.types.user.AdditionalInfoEntity;
|
||||||
import eu.eudat.commons.types.usercredential.UserCredentialDataEntity;
|
import eu.eudat.commons.types.usercredential.UserCredentialDataEntity;
|
||||||
import eu.eudat.configurations.notification.NotificationProperties;
|
import eu.eudat.commons.notification.NotificationProperties;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.data.*;
|
import eu.eudat.data.*;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
|
|
@ -3,8 +3,8 @@ package eu.eudat.service.visibility;
|
||||||
import eu.eudat.commons.types.description.PropertyDefinitionEntity;
|
import eu.eudat.commons.types.description.PropertyDefinitionEntity;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.*;
|
import eu.eudat.commons.types.descriptiontemplate.*;
|
||||||
import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist;
|
import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist;
|
||||||
|
import org.apache.commons.lang3.NotImplementedException;
|
||||||
|
|
||||||
import javax.ws.rs.NotSupportedException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class VisibilityServiceImpl implements VisibilityService {
|
public class VisibilityServiceImpl implements VisibilityService {
|
||||||
|
@ -349,7 +349,7 @@ public class VisibilityServiceImpl implements VisibilityService {
|
||||||
eu.eudat.commons.enums.FieldType fieldType = rule.getFieldEntity() != null && rule.getFieldEntity().getData() != null ? rule.getFieldEntity().getData().getFieldType() : eu.eudat.commons.enums.FieldType.FREE_TEXT;
|
eu.eudat.commons.enums.FieldType fieldType = rule.getFieldEntity() != null && rule.getFieldEntity().getData() != null ? rule.getFieldEntity().getData().getFieldType() : eu.eudat.commons.enums.FieldType.FREE_TEXT;
|
||||||
if (eu.eudat.commons.enums.FieldType.isTextType(fieldType) && field.getTextValue() != null && !field.getTextValue().isBlank()) {
|
if (eu.eudat.commons.enums.FieldType.isTextType(fieldType) && field.getTextValue() != null && !field.getTextValue().isBlank()) {
|
||||||
if (eu.eudat.commons.enums.FieldType.UPLOAD.equals(fieldType)){
|
if (eu.eudat.commons.enums.FieldType.UPLOAD.equals(fieldType)){
|
||||||
throw new NotSupportedException("Upload file rule not supported");
|
throw new NotImplementedException("Upload file rule not supported");
|
||||||
} else {
|
} else {
|
||||||
return field.getTextValue().equals(rule.getTextValue());
|
return field.getTextValue().equals(rule.getTextValue());
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ public class VisibilityServiceImpl implements VisibilityService {
|
||||||
}
|
}
|
||||||
else if (eu.eudat.commons.enums.FieldType.isDateType(fieldType) && field.getDateValue() != null) return field.getDateValue().equals(rule.getDateValue());
|
else if (eu.eudat.commons.enums.FieldType.isDateType(fieldType) && field.getDateValue() != null) return field.getDateValue().equals(rule.getDateValue());
|
||||||
else if (eu.eudat.commons.enums.FieldType.isExternalIdentifierType(fieldType) && field.getExternalIdentifier() != null) {
|
else if (eu.eudat.commons.enums.FieldType.isExternalIdentifierType(fieldType) && field.getExternalIdentifier() != null) {
|
||||||
throw new NotSupportedException("External identifier rule not supported");
|
throw new NotImplementedException("External identifier rule not supported");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import eu.eudat.commons.lock.LockByKeyManager;
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.commons.types.user.AdditionalInfoEntity;
|
import eu.eudat.commons.types.user.AdditionalInfoEntity;
|
||||||
import eu.eudat.commons.types.usercredential.UserCredentialDataEntity;
|
import eu.eudat.commons.types.usercredential.UserCredentialDataEntity;
|
||||||
import eu.eudat.configurations.locale.LocaleProperties;
|
import eu.eudat.commons.locale.LocaleProperties;
|
||||||
import eu.eudat.data.UserContactInfoEntity;
|
import eu.eudat.data.UserContactInfoEntity;
|
||||||
import eu.eudat.data.UserCredentialEntity;
|
import eu.eudat.data.UserCredentialEntity;
|
||||||
import eu.eudat.data.UserEntity;
|
import eu.eudat.data.UserEntity;
|
||||||
|
|
|
@ -16,7 +16,7 @@ spring:
|
||||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||||
hibernate:
|
hibernate:
|
||||||
naming:
|
naming:
|
||||||
physical-strategy: eu.eudat.configurations.db.PrefixPhysicalNamingStrategy
|
physical-strategy: eu.eudat.data.namingstrategy.PrefixPhysicalNamingStrategy
|
||||||
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
|
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
|
||||||
datasource:
|
datasource:
|
||||||
url: ${DB_URL:}
|
url: ${DB_URL:}
|
||||||
|
|
Loading…
Reference in New Issue