diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/AuthenticationConfigurationEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/AuthenticationConfigurationEntity.java similarity index 97% rename from dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/AuthenticationConfigurationEntity.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/AuthenticationConfigurationEntity.java index 2af7bf7f4..5aa33059a 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/AuthenticationConfigurationEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/AuthenticationConfigurationEntity.java @@ -1,4 +1,4 @@ -package eu.eudat.commons.types.referencetype; +package eu.eudat.commons.types.externalfetcher; import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType; import eu.eudat.service.remotefetcher.config.entities.AuthenticationConfiguration; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeSourceExternalApiConfigurationEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ExternalFetcherApiSourceConfigurationEntity.java similarity index 91% rename from dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeSourceExternalApiConfigurationEntity.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ExternalFetcherApiSourceConfigurationEntity.java index 2905e2b33..05d27847b 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeSourceExternalApiConfigurationEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ExternalFetcherApiSourceConfigurationEntity.java @@ -1,4 +1,4 @@ -package eu.eudat.commons.types.referencetype; +package eu.eudat.commons.types.externalfetcher; import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType; @@ -7,7 +7,7 @@ import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import java.util.List; -public class ReferenceTypeSourceExternalApiConfigurationEntity extends ReferenceTypeSourceBaseConfigurationEntity implements SourceExternalApiConfiguration { +public class ExternalFetcherApiSourceConfigurationEntity extends ExternalFetcherBaseSourceConfigurationEntity implements SourceExternalApiConfiguration { private String url; private ResultsConfigurationEntity results; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeSourceBaseConfigurationEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ExternalFetcherBaseSourceConfigurationEntity.java similarity index 90% rename from dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeSourceBaseConfigurationEntity.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ExternalFetcherBaseSourceConfigurationEntity.java index 0ee03d506..dfa3ddb50 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeSourceBaseConfigurationEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ExternalFetcherBaseSourceConfigurationEntity.java @@ -1,4 +1,4 @@ -package eu.eudat.commons.types.referencetype; +package eu.eudat.commons.types.externalfetcher; import eu.eudat.commons.enums.ReferenceTypeSourceType; import eu.eudat.service.remotefetcher.config.entities.SourceBaseConfiguration; @@ -8,7 +8,7 @@ import jakarta.xml.bind.annotation.XmlElementWrapper; import java.util.List; import java.util.UUID; -public abstract class ReferenceTypeSourceBaseConfigurationEntity implements SourceBaseConfiguration { +public abstract class ExternalFetcherBaseSourceConfigurationEntity implements SourceBaseConfiguration { private String key; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ExternalFetcherStaticOptionSourceConfigurationEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ExternalFetcherStaticOptionSourceConfigurationEntity.java new file mode 100644 index 000000000..79d17a0c3 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ExternalFetcherStaticOptionSourceConfigurationEntity.java @@ -0,0 +1,22 @@ +package eu.eudat.commons.types.externalfetcher; + +import eu.eudat.service.remotefetcher.config.entities.SourceStaticOptionConfiguration; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; + +import java.util.List; + +public class ExternalFetcherStaticOptionSourceConfigurationEntity extends ExternalFetcherBaseSourceConfigurationEntity implements SourceStaticOptionConfiguration { + + List options; + + public List getOptions() { + return options; + } + + @XmlElementWrapper + @XmlElement(name = "option") + public void setOptions(List options) { + this.options = options; + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/QueryCaseConfigEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/QueryCaseConfigEntity.java similarity index 96% rename from dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/QueryCaseConfigEntity.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/QueryCaseConfigEntity.java index db7fa254b..5a6863f72 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/QueryCaseConfigEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/QueryCaseConfigEntity.java @@ -1,4 +1,4 @@ -package eu.eudat.commons.types.referencetype; +package eu.eudat.commons.types.externalfetcher; import eu.eudat.service.remotefetcher.config.entities.QueryCaseConfig; import jakarta.xml.bind.annotation.XmlElement; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/QueryConfigEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/QueryConfigEntity.java similarity index 87% rename from dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/QueryConfigEntity.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/QueryConfigEntity.java index 7d103b28f..3ab26d175 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/QueryConfigEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/QueryConfigEntity.java @@ -1,12 +1,10 @@ -package eu.eudat.commons.types.referencetype; +package eu.eudat.commons.types.externalfetcher; -import eu.eudat.service.remotefetcher.config.entities.QueryCaseConfig; import eu.eudat.service.remotefetcher.config.entities.QueryConfig; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import java.util.List; -import java.util.UUID; public class QueryConfigEntity implements QueryConfig { diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ResultFieldsMappingConfigurationEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ResultFieldsMappingConfigurationEntity.java similarity index 93% rename from dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ResultFieldsMappingConfigurationEntity.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ResultFieldsMappingConfigurationEntity.java index e988a9ee6..7b9f0d359 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ResultFieldsMappingConfigurationEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ResultFieldsMappingConfigurationEntity.java @@ -1,4 +1,4 @@ -package eu.eudat.commons.types.referencetype; +package eu.eudat.commons.types.externalfetcher; import eu.eudat.service.remotefetcher.config.entities.ResultFieldsMappingConfiguration; import jakarta.xml.bind.annotation.XmlElement; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ResultsConfigurationEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ResultsConfigurationEntity.java similarity index 88% rename from dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ResultsConfigurationEntity.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ResultsConfigurationEntity.java index 7e8071ba6..5584084d6 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ResultsConfigurationEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/ResultsConfigurationEntity.java @@ -1,5 +1,6 @@ -package eu.eudat.commons.types.referencetype; +package eu.eudat.commons.types.externalfetcher; +import eu.eudat.commons.types.externalfetcher.ResultFieldsMappingConfigurationEntity; import eu.eudat.service.remotefetcher.config.entities.ResultsConfiguration; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeStaticOptionEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/StaticOptionEntity.java similarity index 81% rename from dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeStaticOptionEntity.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/StaticOptionEntity.java index f5b85c170..b9defc849 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeStaticOptionEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/StaticOptionEntity.java @@ -1,9 +1,9 @@ -package eu.eudat.commons.types.referencetype; +package eu.eudat.commons.types.externalfetcher; import eu.eudat.service.remotefetcher.config.entities.StaticOption; import jakarta.xml.bind.annotation.XmlElement; -public class ReferenceTypeStaticOptionEntity implements StaticOption { +public class StaticOptionEntity implements StaticOption { private String code; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/prefilling/PrefillingEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/prefillingsource/PrefillingEntity.java similarity index 96% rename from dmp-backend/core/src/main/java/eu/eudat/commons/types/prefilling/PrefillingEntity.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/prefillingsource/PrefillingEntity.java index 3fbed3abe..fa17dcea1 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/prefilling/PrefillingEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/prefillingsource/PrefillingEntity.java @@ -1,4 +1,4 @@ -package eu.eudat.commons.types.prefilling; +package eu.eudat.commons.types.prefillingsource; import eu.eudat.commons.JsonHandlingService; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/prefillingsource/PrefillingSourceDefinition.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/prefillingsource/PrefillingSourceDefinition.java new file mode 100644 index 000000000..798f8e7e5 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/prefillingsource/PrefillingSourceDefinition.java @@ -0,0 +1,35 @@ +package eu.eudat.commons.types.prefillingsource; + +import eu.eudat.model.referencetypedefinition.ReferenceTypeSourceExternalApiConfiguration; + +import java.util.List; + +public class PrefillingSourceDefinition { + private ReferenceTypeSourceExternalApiConfiguration searchConfiguration; + private ReferenceTypeSourceExternalApiConfiguration getConfiguration; + private List fields; + + public ReferenceTypeSourceExternalApiConfiguration getSearchConfiguration() { + return searchConfiguration; + } + + public void setSearchConfiguration(ReferenceTypeSourceExternalApiConfiguration searchConfiguration) { + this.searchConfiguration = searchConfiguration; + } + + public ReferenceTypeSourceExternalApiConfiguration getGetConfiguration() { + return getConfiguration; + } + + public void setGetConfiguration(ReferenceTypeSourceExternalApiConfiguration getConfiguration) { + this.getConfiguration = getConfiguration; + } + + public List getFields() { + return fields; + } + + public void setFields(List fields) { + this.fields = fields; + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/prefillingsource/PrefillingSourceDefinitionField.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/prefillingsource/PrefillingSourceDefinitionField.java new file mode 100644 index 000000000..d54480049 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/prefillingsource/PrefillingSourceDefinitionField.java @@ -0,0 +1,49 @@ +package eu.eudat.commons.types.prefillingsource; + +public class PrefillingSourceDefinitionField { + private String code; + private String systemFieldTarget; + private String semanticTarget; + private String trimRegex; + private String fixedValue; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getSystemFieldTarget() { + return systemFieldTarget; + } + + public void setSystemFieldTarget(String systemFieldTarget) { + this.systemFieldTarget = systemFieldTarget; + } + + public String getSemanticTarget() { + return semanticTarget; + } + + public void setSemanticTarget(String semanticTarget) { + this.semanticTarget = semanticTarget; + } + + public String getTrimRegex() { + return trimRegex; + } + + public void setTrimRegex(String trimRegex) { + this.trimRegex = trimRegex; + } + + public String getFixedValue() { + return fixedValue; + } + + public void setFixedValue(String fixedValue) { + this.fixedValue = fixedValue; + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeDefinitionEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeDefinitionEntity.java index 78de3ab50..90c1cd765 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeDefinitionEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeDefinitionEntity.java @@ -1,8 +1,9 @@ package eu.eudat.commons.types.referencetype; -import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.ReferenceTypeSourceType; -import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.*; +import eu.eudat.commons.types.externalfetcher.ExternalFetcherBaseSourceConfigurationEntity; +import eu.eudat.commons.types.externalfetcher.ExternalFetcherApiSourceConfigurationEntity; +import eu.eudat.commons.types.externalfetcher.ExternalFetcherStaticOptionSourceConfigurationEntity; import jakarta.xml.bind.annotation.*; import java.util.List; @@ -16,10 +17,10 @@ public class ReferenceTypeDefinitionEntity { @XmlElementWrapper(name = "sources") @XmlElements({ - @XmlElement(name = ReferenceTypeSourceType.Names.API, type = ReferenceTypeSourceExternalApiConfigurationEntity.class), - @XmlElement(name = ReferenceTypeSourceType.Names.STATIC, type = ReferenceTypeSourceStaticOptionConfigurationEntity.class), + @XmlElement(name = ReferenceTypeSourceType.Names.API, type = ExternalFetcherApiSourceConfigurationEntity.class), + @XmlElement(name = ReferenceTypeSourceType.Names.STATIC, type = ExternalFetcherStaticOptionSourceConfigurationEntity.class), }) - private List sources; + private List sources; public List getFields() { return fields; @@ -29,11 +30,11 @@ public class ReferenceTypeDefinitionEntity { this.fields = fields; } - public List getSources() { + public List getSources() { return sources; } - public void setSources(List sources) { + public void setSources(List sources) { this.sources = sources; } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeSourceStaticOptionConfigurationEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeSourceStaticOptionConfigurationEntity.java deleted file mode 100644 index f8f141068..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/referencetype/ReferenceTypeSourceStaticOptionConfigurationEntity.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.eudat.commons.types.referencetype; - -import eu.eudat.service.remotefetcher.config.entities.SourceStaticOptionConfiguration; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElementWrapper; - -import java.util.List; - -public class ReferenceTypeSourceStaticOptionConfigurationEntity extends ReferenceTypeSourceBaseConfigurationEntity implements SourceStaticOptionConfiguration { - - List options; - - public List getOptions() { - return options; - } - - @XmlElementWrapper - @XmlElement(name = "option") - public void setOptions(List options) { - this.options = options; - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/PrefillingBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/PrefillingBuilder.java index 5acf91950..c302467b0 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/PrefillingBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/PrefillingBuilder.java @@ -1,11 +1,9 @@ package eu.eudat.model.builder; import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.commons.enums.ContactInfoType; -import eu.eudat.commons.types.prefilling.PrefillingEntity; +import eu.eudat.commons.types.prefillingsource.PrefillingEntity; import eu.eudat.convention.ConventionService; import eu.eudat.data.UserEntity; -import eu.eudat.model.DmpAssociatedUser; import eu.eudat.model.Prefilling; import eu.eudat.model.User; import eu.eudat.model.UserContactInfo; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/AuthenticationConfigurationBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/AuthenticationConfigurationBuilder.java index bbff69bd9..cccc2a8c0 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/AuthenticationConfigurationBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/AuthenticationConfigurationBuilder.java @@ -1,15 +1,10 @@ package eu.eudat.model.builder.referencetypedefinition; import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.authorization.Permission; -import eu.eudat.commons.types.referencetype.AuthenticationConfigurationEntity; -import eu.eudat.commons.types.referencetype.QueryConfigEntity; +import eu.eudat.commons.types.externalfetcher.AuthenticationConfigurationEntity; import eu.eudat.convention.ConventionService; import eu.eudat.model.builder.BaseBuilder; import eu.eudat.model.referencetypedefinition.AuthenticationConfiguration; -import eu.eudat.model.referencetypedefinition.QueryConfig; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/QueryCaseConfigBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/QueryCaseConfigBuilder.java index a661580c7..90dee4e59 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/QueryCaseConfigBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/QueryCaseConfigBuilder.java @@ -1,7 +1,7 @@ package eu.eudat.model.builder.referencetypedefinition; import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.commons.types.referencetype.QueryCaseConfigEntity; +import eu.eudat.commons.types.externalfetcher.QueryCaseConfigEntity; import eu.eudat.convention.ConventionService; import eu.eudat.model.ReferenceType; import eu.eudat.model.builder.BaseBuilder; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/QueryConfigBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/QueryConfigBuilder.java index bf3638cc4..5e45543e8 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/QueryConfigBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/QueryConfigBuilder.java @@ -1,7 +1,7 @@ package eu.eudat.model.builder.referencetypedefinition; import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.commons.types.referencetype.QueryConfigEntity; +import eu.eudat.commons.types.externalfetcher.QueryConfigEntity; import eu.eudat.convention.ConventionService; import eu.eudat.model.builder.BaseBuilder; import eu.eudat.model.referencetypedefinition.QueryConfig; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeDefinitionBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeDefinitionBuilder.java index 2af7379ae..a55aed47e 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeDefinitionBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeDefinitionBuilder.java @@ -3,8 +3,8 @@ package eu.eudat.model.builder.referencetypedefinition; import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.commons.enums.ReferenceTypeSourceType; import eu.eudat.commons.types.referencetype.ReferenceTypeDefinitionEntity; -import eu.eudat.commons.types.referencetype.ReferenceTypeSourceExternalApiConfigurationEntity; -import eu.eudat.commons.types.referencetype.ReferenceTypeSourceStaticOptionConfigurationEntity; +import eu.eudat.commons.types.externalfetcher.ExternalFetcherApiSourceConfigurationEntity; +import eu.eudat.commons.types.externalfetcher.ExternalFetcherStaticOptionSourceConfigurationEntity; import eu.eudat.convention.ConventionService; import eu.eudat.model.builder.BaseBuilder; import eu.eudat.model.referencetypedefinition.ReferenceTypeDefinition; @@ -56,8 +56,8 @@ public class ReferenceTypeDefinitionBuilder extends BaseBuilder externalApiConfigEntities = d.getSources().stream().filter(x-> ReferenceTypeSourceType.API.equals(x.getType())).map(x-> (ReferenceTypeSourceExternalApiConfigurationEntity)x).toList(); - List staticOptionConfigEntities = d.getSources().stream().filter(x-> ReferenceTypeSourceType.STATIC.equals(x.getType())).map(x-> (ReferenceTypeSourceStaticOptionConfigurationEntity)x).toList(); + List externalApiConfigEntities = d.getSources().stream().filter(x-> ReferenceTypeSourceType.API.equals(x.getType())).map(x-> (ExternalFetcherApiSourceConfigurationEntity)x).toList(); + List staticOptionConfigEntities = d.getSources().stream().filter(x-> ReferenceTypeSourceType.STATIC.equals(x.getType())).map(x-> (ExternalFetcherStaticOptionSourceConfigurationEntity)x).toList(); m.setSources(new ArrayList<>()); m.getSources().addAll(this.builderFactory.builder(ReferenceTypeSourceExternalApiConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, externalApiConfigEntities)); m.getSources().addAll(this.builderFactory.builder(ReferenceTypeSourceStaticOptionConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, staticOptionConfigEntities)); diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceBaseConfigurationBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceBaseConfigurationBuilder.java index 6b16b4dca..700f641b2 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceBaseConfigurationBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceBaseConfigurationBuilder.java @@ -1,10 +1,8 @@ package eu.eudat.model.builder.referencetypedefinition; import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.commons.types.referencetype.ReferenceTypeSourceBaseConfigurationEntity; +import eu.eudat.commons.types.externalfetcher.ExternalFetcherBaseSourceConfigurationEntity; import eu.eudat.convention.ConventionService; -import eu.eudat.data.ReferenceEntity; -import eu.eudat.model.Reference; import eu.eudat.model.ReferenceType; import eu.eudat.model.builder.BaseBuilder; import eu.eudat.model.builder.ReferenceTypeBuilder; @@ -27,7 +25,7 @@ import java.util.stream.Collectors; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public abstract class ReferenceTypeSourceBaseConfigurationBuilder extends BaseBuilder { +public abstract class ReferenceTypeSourceBaseConfigurationBuilder extends BaseBuilder { protected EnumSet authorize = EnumSet.of(AuthorizationFlags.None); protected final BuilderFactory builderFactory; @@ -90,7 +88,7 @@ public abstract class ReferenceTypeSourceBaseConfigurationBuilder itemMap; if (!fields.hasOtherField(this.asIndexer(ReferenceType._id))) { itemMap = this.asEmpty( - data.stream().filter(x-> x.getReferenceTypeDependencyIds() != null).map(ReferenceTypeSourceBaseConfigurationEntity::getReferenceTypeDependencyIds).flatMap(List::stream).distinct().collect(Collectors.toList()), + data.stream().filter(x-> x.getReferenceTypeDependencyIds() != null).map(ExternalFetcherBaseSourceConfigurationEntity::getReferenceTypeDependencyIds).flatMap(List::stream).distinct().collect(Collectors.toList()), x -> { ReferenceType item = new ReferenceType(); item.setId(x); @@ -99,7 +97,7 @@ public abstract class ReferenceTypeSourceBaseConfigurationBuilder x.getReferenceTypeDependencyIds() != null).map(ReferenceTypeSourceBaseConfigurationEntity::getReferenceTypeDependencyIds).flatMap(List::stream).distinct().collect(Collectors.toList())); + ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).authorize(this.authorize).ids(data.stream().filter(x-> x.getReferenceTypeDependencyIds() != null).map(ExternalFetcherBaseSourceConfigurationEntity::getReferenceTypeDependencyIds).flatMap(List::stream).distinct().collect(Collectors.toList())); itemMap = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(this.authorize).asForeignKey(q, clone, ReferenceType::getId); } if (!fields.hasField(ReferenceType._id)) { diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceExternalApiConfigurationBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceExternalApiConfigurationBuilder.java index 8519d1e64..8add166f7 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceExternalApiConfigurationBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceExternalApiConfigurationBuilder.java @@ -2,7 +2,7 @@ package eu.eudat.model.builder.referencetypedefinition; import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.Permission; -import eu.eudat.commons.types.referencetype.ReferenceTypeSourceExternalApiConfigurationEntity; +import eu.eudat.commons.types.externalfetcher.ExternalFetcherApiSourceConfigurationEntity; import eu.eudat.convention.ConventionService; import eu.eudat.model.referencetypedefinition.ReferenceTypeSourceExternalApiConfiguration; import gr.cite.commons.web.authz.service.AuthorizationService; @@ -20,7 +20,7 @@ import java.util.*; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class ReferenceTypeSourceExternalApiConfigurationBuilder extends ReferenceTypeSourceBaseConfigurationBuilder { +public class ReferenceTypeSourceExternalApiConfigurationBuilder extends ReferenceTypeSourceBaseConfigurationBuilder { private final BuilderFactory builderFactory; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @@ -41,7 +41,7 @@ public class ReferenceTypeSourceExternalApiConfigurationBuilder extends Referenc } @Override - protected ReferenceTypeSourceExternalApiConfiguration buildChild(FieldSet fields, ReferenceTypeSourceExternalApiConfigurationEntity d, ReferenceTypeSourceExternalApiConfiguration m) { + protected ReferenceTypeSourceExternalApiConfiguration buildChild(FieldSet fields, ExternalFetcherApiSourceConfigurationEntity d, ReferenceTypeSourceExternalApiConfiguration m) { FieldSet resultsFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeSourceExternalApiConfiguration._results)); FieldSet authFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeSourceExternalApiConfiguration._auth)); FieldSet queriesFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeSourceExternalApiConfiguration._queries)); diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceStaticOptionConfigurationBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceStaticOptionConfigurationBuilder.java index fba2b87ed..374923a87 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceStaticOptionConfigurationBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeSourceStaticOptionConfigurationBuilder.java @@ -2,7 +2,7 @@ package eu.eudat.model.builder.referencetypedefinition; import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.Permission; -import eu.eudat.commons.types.referencetype.ReferenceTypeSourceStaticOptionConfigurationEntity; +import eu.eudat.commons.types.externalfetcher.ExternalFetcherStaticOptionSourceConfigurationEntity; import eu.eudat.convention.ConventionService; import eu.eudat.model.referencetypedefinition.ReferenceTypeSourceStaticOptionConfiguration; import gr.cite.commons.web.authz.service.AuthorizationService; @@ -20,7 +20,7 @@ import java.util.EnumSet; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class ReferenceTypeSourceStaticOptionConfigurationBuilder extends ReferenceTypeSourceBaseConfigurationBuilder { +public class ReferenceTypeSourceStaticOptionConfigurationBuilder extends ReferenceTypeSourceBaseConfigurationBuilder { private final BuilderFactory builderFactory; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @@ -41,7 +41,7 @@ public class ReferenceTypeSourceStaticOptionConfigurationBuilder extends Referen } @Override - protected ReferenceTypeSourceStaticOptionConfiguration buildChild(FieldSet fields, ReferenceTypeSourceStaticOptionConfigurationEntity d, ReferenceTypeSourceStaticOptionConfiguration m) { + protected ReferenceTypeSourceStaticOptionConfiguration buildChild(FieldSet fields, ExternalFetcherStaticOptionSourceConfigurationEntity d, ReferenceTypeSourceStaticOptionConfiguration m) { FieldSet optionsFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeSourceStaticOptionConfiguration._options)); if(!authorizationService.authorize(Permission.EditReferenceType)) return m; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeStaticOptionBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeStaticOptionBuilder.java index f8851bbdf..f85238878 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeStaticOptionBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeStaticOptionBuilder.java @@ -1,7 +1,7 @@ package eu.eudat.model.builder.referencetypedefinition; import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.commons.types.referencetype.ReferenceTypeStaticOptionEntity; +import eu.eudat.commons.types.externalfetcher.StaticOptionEntity; import eu.eudat.convention.ConventionService; import eu.eudat.model.builder.BaseBuilder; import eu.eudat.model.referencetypedefinition.ReferenceTypeStaticOption; @@ -19,7 +19,7 @@ import java.util.*; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class ReferenceTypeStaticOptionBuilder extends BaseBuilder { +public class ReferenceTypeStaticOptionBuilder extends BaseBuilder { private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @@ -34,14 +34,14 @@ public class ReferenceTypeStaticOptionBuilder extends BaseBuilder build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); List models = new ArrayList<>(); - for (ReferenceTypeStaticOptionEntity d : data) { + for (StaticOptionEntity d : data) { ReferenceTypeStaticOption m = new ReferenceTypeStaticOption(); if (fields.hasField(this.asIndexer(ReferenceTypeStaticOption._code))) m.setCode(d.getCode()); if (fields.hasField(this.asIndexer(ReferenceTypeStaticOption._value))) m.setValue(d.getValue()); diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ResultFieldsMappingConfigurationBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ResultFieldsMappingConfigurationBuilder.java index 15b90d2f5..d2d0c28f3 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ResultFieldsMappingConfigurationBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ResultFieldsMappingConfigurationBuilder.java @@ -1,7 +1,7 @@ package eu.eudat.model.builder.referencetypedefinition; import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.commons.types.referencetype.ResultFieldsMappingConfigurationEntity; +import eu.eudat.commons.types.externalfetcher.ResultFieldsMappingConfigurationEntity; import eu.eudat.convention.ConventionService; import eu.eudat.model.builder.BaseBuilder; import eu.eudat.model.referencetypedefinition.ResultFieldsMappingConfiguration; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ResultsConfigurationBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ResultsConfigurationBuilder.java index 82d85c927..6c0f52690 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ResultsConfigurationBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ResultsConfigurationBuilder.java @@ -1,7 +1,7 @@ package eu.eudat.model.builder.referencetypedefinition; import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.commons.types.referencetype.ResultsConfigurationEntity; +import eu.eudat.commons.types.externalfetcher.ResultsConfigurationEntity; import eu.eudat.convention.ConventionService; import eu.eudat.model.builder.BaseBuilder; import eu.eudat.model.referencetypedefinition.ResultsConfiguration; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/referencetypedefinition/QueryCaseConfigPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/referencetypedefinition/QueryCaseConfigPersist.java index 84234dcf2..67967a0c5 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/referencetypedefinition/QueryCaseConfigPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/referencetypedefinition/QueryCaseConfigPersist.java @@ -1,11 +1,6 @@ package eu.eudat.model.persist.referencetypedefinition; -import eu.eudat.commons.enums.FieldType; -import eu.eudat.commons.types.referencetype.QueryCaseConfigEntity; import eu.eudat.commons.validation.BaseValidator; -import eu.eudat.model.persist.ReferencePersist; -import eu.eudat.model.persist.descriptionproperties.FieldPersist; -import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; import eu.eudat.convention.ConventionService; import eu.eudat.errorcode.ErrorThesaurusProperties; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/referencetypedefinition/QueryCaseConfig.java b/dmp-backend/core/src/main/java/eu/eudat/model/referencetypedefinition/QueryCaseConfig.java index 9579fe7a9..c2c67d54f 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/referencetypedefinition/QueryCaseConfig.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/referencetypedefinition/QueryCaseConfig.java @@ -1,11 +1,8 @@ package eu.eudat.model.referencetypedefinition; -import eu.eudat.commons.types.referencetype.QueryCaseConfigEntity; import eu.eudat.model.ReferenceType; -import java.util.List; - public class QueryCaseConfig { public final static String _likePattern = "likePattern"; diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/prefilling/PrefillingServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/prefilling/PrefillingServiceImpl.java index 21ae669cb..06e360481 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/prefilling/PrefillingServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/prefilling/PrefillingServiceImpl.java @@ -3,11 +3,10 @@ package eu.eudat.service.prefilling; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.commons.JsonHandlingService; import eu.eudat.commons.XmlHandlingService; import eu.eudat.commons.types.descriptiontemplate.FieldEntity; import eu.eudat.commons.types.descriptiontemplate.FieldSetEntity; -import eu.eudat.commons.types.prefilling.PrefillingEntity; +import eu.eudat.commons.types.prefillingsource.PrefillingEntity; import eu.eudat.convention.ConventionService; import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.model.*; @@ -20,11 +19,9 @@ import eu.eudat.model.descriptionproperties.PropertyDefinitionFieldSetItem; import eu.eudat.model.persist.DescriptionProfilingRequest; import eu.eudat.model.persist.DescriptionProfilingWithDataRequest; import eu.eudat.service.remotefetcher.ExternalUrlConfigProvider; -import eu.eudat.service.remotefetcher.RemoteFetcherService; import eu.eudat.service.remotefetcher.config.entities.*; import eu.eudat.service.remotefetcher.criteria.ExternalReferenceCriteria; import gr.cite.tools.data.builder.BuilderFactory; -import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.exception.MyNotFoundException; import gr.cite.tools.fieldset.BaseFieldSet; diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/referencetype/ReferenceTypeServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/referencetype/ReferenceTypeServiceImpl.java index 8c663c878..4503725cb 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/referencetype/ReferenceTypeServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/referencetype/ReferenceTypeServiceImpl.java @@ -5,6 +5,7 @@ import eu.eudat.authorization.Permission; import eu.eudat.commons.XmlHandlingService; import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.ReferenceTypeSourceType; +import eu.eudat.commons.types.externalfetcher.*; import eu.eudat.commons.types.referencetype.*; import eu.eudat.convention.ConventionService; import eu.eudat.data.ReferenceTypeEntity; @@ -134,13 +135,13 @@ public class ReferenceTypeServiceImpl implements ReferenceTypeService { return data; } - private @NotNull ReferenceTypeSourceBaseConfigurationEntity buildSourceBaseConfigEntity(ReferenceTypeSourceBaseConfigurationPersist persist){ - if (persist == null) return new ReferenceTypeSourceExternalApiConfigurationEntity(); + private @NotNull ExternalFetcherBaseSourceConfigurationEntity buildSourceBaseConfigEntity(ReferenceTypeSourceBaseConfigurationPersist persist){ + if (persist == null) return new ExternalFetcherApiSourceConfigurationEntity(); - ReferenceTypeSourceBaseConfigurationEntity data; + ExternalFetcherBaseSourceConfigurationEntity data; if (ReferenceTypeSourceType.API.equals(persist.getType())) { - ReferenceTypeSourceExternalApiConfigurationEntity apiEntity = new ReferenceTypeSourceExternalApiConfigurationEntity(); + ExternalFetcherApiSourceConfigurationEntity apiEntity = new ExternalFetcherApiSourceConfigurationEntity(); apiEntity.setUrl(((ReferenceTypeSourceExternalApiConfigurationPersist) persist).getUrl()); if (((ReferenceTypeSourceExternalApiConfigurationPersist) persist).getResults() != null ) { @@ -164,7 +165,7 @@ public class ReferenceTypeServiceImpl implements ReferenceTypeService { data = apiEntity; }else { - ReferenceTypeSourceStaticOptionConfigurationEntity staticEntity = new ReferenceTypeSourceStaticOptionConfigurationEntity(); + ExternalFetcherStaticOptionSourceConfigurationEntity staticEntity = new ExternalFetcherStaticOptionSourceConfigurationEntity(); if (!this.conventionService.isListNullOrEmpty(((ReferenceTypeSourceStaticOptionConfigurationPersist) persist).getOptions())){ staticEntity.setOptions(new ArrayList<>()); @@ -254,8 +255,8 @@ public class ReferenceTypeServiceImpl implements ReferenceTypeService { return data; } - private @NotNull ReferenceTypeStaticOptionEntity buildStaticOptionEntity(ReferenceTypeStaticOptionPersist persist){ - ReferenceTypeStaticOptionEntity data = new ReferenceTypeStaticOptionEntity(); + private @NotNull StaticOptionEntity buildStaticOptionEntity(ReferenceTypeStaticOptionPersist persist){ + StaticOptionEntity data = new StaticOptionEntity(); if (persist == null) return data; data.setCode(persist.getCode());