diff --git a/dmp-backend/core/src/main/java/eu/eudat/authorization/Permission.java b/dmp-backend/core/src/main/java/eu/eudat/authorization/Permission.java index 4a06422bd..e6ba36ad8 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/authorization/Permission.java +++ b/dmp-backend/core/src/main/java/eu/eudat/authorization/Permission.java @@ -62,15 +62,15 @@ public final class Permission { public static String ViewDescriptionTemplateTypePage = "ViewDescriptionTemplateTypePage"; public static String ViewDmpBlueprintPage = "ViewDmpBlueprintPage"; - //ExternalReference - public static String BrowseExternalReference = "BrowseExternalReference"; - public static String EditExternalReference = "EditExternalReference"; - public static String DeleteExternalReference = "DeleteExternalReference"; + //Reference + public static String BrowseReference = "BrowseReference"; + public static String EditReference = "EditReference"; + public static String DeleteReference = "DeleteReference"; - //DmpExternalReference - public static String BrowseDmpExternalReference = "BrowseDmpExternalReference"; - public static String EditDmpExternalReference = "EditDmpExternalReference"; - public static String DeleteDmpExternalReference = "DeleteDmpExternalReference"; + //DmpReference + public static String BrowseDmpReference = "BrowseDmpReference"; + public static String EditDmpReference = "EditDmpReference"; + public static String DeleteDmpReference = "DeleteDmpReference"; } diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/ExternalReferencesType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/ReferenceType.java similarity index 69% rename from dmp-backend/core/src/main/java/eu/eudat/commons/enums/ExternalReferencesType.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/enums/ReferenceType.java index 8fbaafbab..89b79c5d7 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/ExternalReferencesType.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/ReferenceType.java @@ -5,7 +5,7 @@ import eu.eudat.data.converters.enums.DatabaseEnum; import java.util.Map; -public enum ExternalReferencesType implements DatabaseEnum { +public enum ReferenceType implements DatabaseEnum { Taxonomies((short) 0), Licenses((short) 1), Publications((short) 2), @@ -22,7 +22,7 @@ public enum ExternalReferencesType implements DatabaseEnum { Researcher((short) 13); private final Short value; - ExternalReferencesType(Short value) { + ReferenceType(Short value) { this.value = value; } @@ -31,9 +31,9 @@ public enum ExternalReferencesType implements DatabaseEnum { return value; } - private static final Map map = EnumUtils.getEnumValueMap(ExternalReferencesType.class); + private static final Map map = EnumUtils.getEnumValueMap(ReferenceType.class); - public static ExternalReferencesType of(Short i) { + public static ReferenceType of(Short i) { return map.get(i); } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/ReferenceEntity.java b/dmp-backend/core/src/main/java/eu/eudat/data/ReferenceEntity.java index bb3b1db63..cf45ebfda 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/data/ReferenceEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/data/ReferenceEntity.java @@ -1,9 +1,9 @@ package eu.eudat.data; -import eu.eudat.commons.enums.ExternalReferencesType; +import eu.eudat.commons.enums.ReferenceType; import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.SourceType; -import eu.eudat.data.converters.enums.ExternalReferencesTypeConverter; +import eu.eudat.data.converters.enums.ReferenceTypeConverter; import eu.eudat.data.converters.enums.IsActiveConverter; import jakarta.persistence.*; import org.hibernate.annotations.Type; @@ -25,8 +25,8 @@ public class ReferenceEntity { public static final String _label = "label"; @Column(name = "type", nullable = false) - @Convert(converter = ExternalReferencesTypeConverter.class) - private ExternalReferencesType type; + @Convert(converter = ReferenceTypeConverter.class) + private ReferenceType type; public static final String _type = "type"; @Column(name = "description") @@ -87,11 +87,11 @@ public class ReferenceEntity { this.label = label; } - public ExternalReferencesType getType() { + public ReferenceType getType() { return type; } - public void setType(ExternalReferencesType type) { + public void setType(ReferenceType type) { this.type = type; } diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/ExternalReferencesTypeConverter.java b/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/ExternalReferencesTypeConverter.java deleted file mode 100644 index a15b2a130..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/ExternalReferencesTypeConverter.java +++ /dev/null @@ -1,11 +0,0 @@ -package eu.eudat.data.converters.enums; - -import eu.eudat.commons.enums.ExternalReferencesType; -import jakarta.persistence.Converter; - -@Converter -public class ExternalReferencesTypeConverter extends DatabaseEnumConverter { - public ExternalReferencesType of(Short i) { - return ExternalReferencesType.of(i); - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/ReferenceTypeConverter.java b/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/ReferenceTypeConverter.java new file mode 100644 index 000000000..a8adb12c7 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/ReferenceTypeConverter.java @@ -0,0 +1,11 @@ +package eu.eudat.data.converters.enums; + +import eu.eudat.commons.enums.ReferenceType; +import jakarta.persistence.Converter; + +@Converter +public class ReferenceTypeConverter extends DatabaseEnumConverter { + public ReferenceType of(Short i) { + return ReferenceType.of(i); + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/Dmp.java b/dmp-backend/core/src/main/java/eu/eudat/model/Dmp.java index c02eb147e..c95d19e32 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/Dmp.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/Dmp.java @@ -93,7 +93,7 @@ public class Dmp { public static final String _dmpDescriptions = "dmpDescriptions"; - public static final String _dmpExternalReferences = "dmpExternalReferences"; + public static final String _dmpReferences = "dmpReferences"; private List dmpReferences; public UUID getId() { @@ -264,11 +264,11 @@ public class Dmp { this.dmpDescriptions = dmpDescriptions; } - public List getDmpExternalReferences() { + public List getDmpReferences() { return dmpReferences; } - public void setDmpExternalReferences(List dmpReferences) { + public void setDmpReferences(List dmpReferences) { this.dmpReferences = dmpReferences; } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/DmpReference.java b/dmp-backend/core/src/main/java/eu/eudat/model/DmpReference.java index 77b3ff6b4..30b4eaeb3 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/DmpReference.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/DmpReference.java @@ -11,7 +11,7 @@ public class DmpReference { public static final String _dmp = "dmp"; private Reference reference; - public static final String _externalReference = "externalReference"; + public static final String _reference = "reference"; private String data; public static final String _data = "data"; @@ -32,11 +32,11 @@ public class DmpReference { this.dmp = dmp; } - public Reference getExternalReference() { + public Reference getReference() { return reference; } - public void setExternalReference(Reference reference) { + public void setReference(Reference reference) { this.reference = reference; } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/Reference.java b/dmp-backend/core/src/main/java/eu/eudat/model/Reference.java index 9343e8158..0b2a3beed 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/Reference.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/Reference.java @@ -1,6 +1,6 @@ package eu.eudat.model; -import eu.eudat.commons.enums.ExternalReferencesType; +import eu.eudat.commons.enums.ReferenceType; import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.SourceType; @@ -16,7 +16,7 @@ public class Reference { private String label; public static final String _label = "label"; - private ExternalReferencesType type; + private ReferenceType type; public static final String _type = "type"; private String description; @@ -50,7 +50,7 @@ public class Reference { //public static final String _createdBy = "createdBy"; private List dmpReferences; - public static final String _dmpExternalReferences = "dmpExternalReferences"; + public static final String _dmpReferences = "dmpReferences"; public UUID getId() { return id; @@ -68,11 +68,11 @@ public class Reference { this.label = label; } - public ExternalReferencesType getType() { + public ReferenceType getType() { return type; } - public void setType(ExternalReferencesType type) { + public void setType(ReferenceType type) { this.type = type; } @@ -148,11 +148,11 @@ public class Reference { this.updatedAt = updatedAt; } - public List getDmpExternalReferences() { + public List getDmpReferences() { return dmpReferences; } - public void setDmpExternalReferences(List dmpReferences) { + public void setDmpReferences(List dmpReferences) { this.dmpReferences = dmpReferences; } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/DmpBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/DmpBuilder.java index 3eff0fdd2..e1e6b4725 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/DmpBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/DmpBuilder.java @@ -57,7 +57,7 @@ public class DmpBuilder extends BaseBuilder { FieldSet dmpDescriptionsFields = fields.extractPrefixed(this.asPrefix(Dmp._dmpDescriptions)); Map> dmpDescriptionsMap = this.collectDmpDescriptions(dmpDescriptionsFields, data); - FieldSet dmpReferencesFields = fields.extractPrefixed(this.asPrefix(Reference._dmpExternalReferences)); + FieldSet dmpReferencesFields = fields.extractPrefixed(this.asPrefix(Reference._dmpReferences)); Map> dmpReferenceMap = this.collectDmpReferences(dmpReferencesFields, data); for (DmpEntity d : data) { @@ -98,7 +98,7 @@ public class DmpBuilder extends BaseBuilder { if (!dmpDescriptionsFields.isEmpty() && dmpDescriptionsMap != null && dmpDescriptionsMap.containsKey(d.getId())) m.setDmpDescriptions(dmpDescriptionsMap.get(d.getId())); - if (dmpReferenceMap != null && !dmpReferenceMap.isEmpty() && dmpReferenceMap.containsKey(d.getId())) m.setDmpExternalReferences(dmpReferenceMap.get(d.getId())); + if (dmpReferenceMap != null && !dmpReferenceMap.isEmpty() && dmpReferenceMap.containsKey(d.getId())) m.setDmpReferences(dmpReferenceMap.get(d.getId())); models.add(m); } this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/DmpReferenceBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/DmpReferenceBuilder.java index cbd3a58fd..16460d303 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/DmpReferenceBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/DmpReferenceBuilder.java @@ -52,7 +52,7 @@ public class DmpReferenceBuilder extends BaseBuilder(); - FieldSet referenceFields = fields.extractPrefixed(this.asPrefix(DmpReference._externalReference)); + FieldSet referenceFields = fields.extractPrefixed(this.asPrefix(DmpReference._reference)); Map referenceItemsMap = this.collectReferences(referenceFields, data); FieldSet dmpFields = fields.extractPrefixed(this.asPrefix(DmpReference._dmp)); @@ -64,7 +64,7 @@ public class DmpReferenceBuilder extends BaseBuilder{ if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); - //FieldSet userInfoFields = fields.extractPrefixed(this.asPrefix(ExternalReference._createdBy)); + //FieldSet userInfoFields = fields.extractPrefixed(this.asPrefix(Reference._createdBy)); - FieldSet dmpReferencesFields = fields.extractPrefixed(this.asPrefix(Reference._dmpExternalReferences)); + FieldSet dmpReferencesFields = fields.extractPrefixed(this.asPrefix(Reference._dmpReferences)); Map> dmpReferenceMap = this.collectDmpReferences(dmpReferencesFields, data); List models = new ArrayList<>(); @@ -74,7 +74,7 @@ public class ReferenceBuilder extends BaseBuilder{ // if (!userInfoFields.isEmpty() && d.getCreatedBy() != null){ // //ToDo // } - if (!dmpReferenceMap.isEmpty() && dmpReferenceMap != null && dmpReferenceMap.containsKey(d.getId())) m.setDmpExternalReferences(dmpReferenceMap.get(d.getId())); + if (!dmpReferenceMap.isEmpty() && dmpReferenceMap != null && dmpReferenceMap.containsKey(d.getId())) m.setDmpReferences(dmpReferenceMap.get(d.getId())); models.add(m); } this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); @@ -86,13 +86,13 @@ public class ReferenceBuilder extends BaseBuilder{ this.logger.debug("checking related - {}", DmpReference.class.getSimpleName()); Map> itemMap = null; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._externalReference, Reference._id)); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._reference, Reference._id)); DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).referenceIds(datas.stream().map(x -> x.getId()).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getExternalReference().getId()); + itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getReference().getId()); - if (!fields.hasField(this.asIndexer(DmpReference._externalReference, Reference._id))) { - itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getExternalReference() != null).map(x -> { - x.getExternalReference().setId(null); + if (!fields.hasField(this.asIndexer(DmpReference._reference, Reference._id))) { + itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getReference() != null).map(x -> { + x.getReference().setId(null); return x; }).collect(Collectors.toList()); } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/censorship/DmpCensor.java b/dmp-backend/core/src/main/java/eu/eudat/model/censorship/DmpCensor.java index e99138cb1..ecdd35220 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/censorship/DmpCensor.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/censorship/DmpCensor.java @@ -42,8 +42,8 @@ public class DmpCensor extends BaseCensor { FieldSet dmpDescriptionsFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._dmpDescriptions)); this.censorFactory.censor(DescriptionCensor.class).censor(dmpDescriptionsFields, userId); - FieldSet dmpExternalReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._dmpExternalReferences)); - this.censorFactory.censor(DmpReferenceCensor.class).censor(dmpExternalReferencesFields, userId); + FieldSet dmpReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._dmpReferences)); + this.censorFactory.censor(DmpReferenceCensor.class).censor(dmpReferencesFields, userId); } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/censorship/DmpReferenceCensor.java b/dmp-backend/core/src/main/java/eu/eudat/model/censorship/DmpReferenceCensor.java index 97364c931..1ea827b13 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/censorship/DmpReferenceCensor.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/censorship/DmpReferenceCensor.java @@ -37,11 +37,11 @@ public class DmpReferenceCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmpExternalReference); + this.authService.authorizeForce(Permission.BrowseDmpReference); FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(DmpReference._dmp)); this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId); - FieldSet externalReferenceFields = fields.extractPrefixed(this.asIndexerPrefix(DmpReference._externalReference)); - this.censorFactory.censor(ReferenceCensor.class).censor(externalReferenceFields, userId); + FieldSet referenceFields = fields.extractPrefixed(this.asIndexerPrefix(DmpReference._reference)); + this.censorFactory.censor(ReferenceCensor.class).censor(referenceFields, userId); } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/censorship/ReferenceCensor.java b/dmp-backend/core/src/main/java/eu/eudat/model/censorship/ReferenceCensor.java index 5b9ce98be..f8b54a291 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/censorship/ReferenceCensor.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/censorship/ReferenceCensor.java @@ -37,11 +37,11 @@ public class ReferenceCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseExternalReference); - FieldSet dmpExternalReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Reference._dmpExternalReferences)); - this.censorFactory.censor(DmpReferenceCensor.class).censor(dmpExternalReferencesFields, userId); + this.authService.authorizeForce(Permission.BrowseReference); + FieldSet dmpReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Reference._dmpReferences)); + this.censorFactory.censor(DmpReferenceCensor.class).censor(dmpReferencesFields, userId); //ToDo - //FieldSet definitionFields = fields.extractPrefixed(this.asIndexerPrefix(ExternalReference._createdBy)); + //FieldSet definitionFields = fields.extractPrefixed(this.asIndexerPrefix(Reference._createdBy)); //this.censorFactory.censor(UserInfo.class).censor(definitionFields, userId); } diff --git a/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java b/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java index 6ffddfec3..1fc160a6c 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java +++ b/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java @@ -1,7 +1,7 @@ package eu.eudat.query; import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.commons.enums.ExternalReferencesType; +import eu.eudat.commons.enums.ReferenceType; import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.SourceType; import eu.eudat.commons.scope.user.UserScope; @@ -32,7 +32,7 @@ public class ReferenceQuery extends QueryBase { private Collection sourceTypes; - private Collection externalReferenceTypes; + private Collection referenceTypes; private Collection excludedIds; @@ -73,18 +73,18 @@ public class ReferenceQuery extends QueryBase { return this; } - public ReferenceQuery externalReferenceTypes(ExternalReferencesType value) { - this.externalReferenceTypes = List.of(value); + public ReferenceQuery referenceTypes(ReferenceType value) { + this.referenceTypes = List.of(value); return this; } - public ReferenceQuery externalReferenceTypes(ExternalReferencesType... value) { - this.externalReferenceTypes = Arrays.asList(value); + public ReferenceQuery referenceTypes(ReferenceType... value) { + this.referenceTypes = Arrays.asList(value); return this; } - public ReferenceQuery externalReferenceTypes(Collection values) { - this.externalReferenceTypes = values; + public ReferenceQuery referenceTypes(Collection values) { + this.referenceTypes = values; return this; } @@ -142,7 +142,7 @@ public class ReferenceQuery extends QueryBase { @Override protected Boolean isFalseQuery() { - return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.excludedIds) || this.isEmpty(this.externalReferenceTypes) || this.isEmpty(this.sourceTypes); + return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.excludedIds) || this.isEmpty(this.referenceTypes) || this.isEmpty(this.sourceTypes); } @Override @@ -171,9 +171,9 @@ public class ReferenceQuery extends QueryBase { inClause.value(item); predicates.add(inClause); } - if (this.externalReferenceTypes != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._type)); - for (ExternalReferencesType item : this.externalReferenceTypes) + if (this.referenceTypes != null) { + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._type)); + for (ReferenceType item : this.referenceTypes) inClause.value(item); predicates.add(inClause); } @@ -205,7 +205,7 @@ public class ReferenceQuery extends QueryBase { item.setReference(QueryBase.convertSafe(tuple, columns, ReferenceEntity._reference, String.class)); item.setSource(QueryBase.convertSafe(tuple, columns, ReferenceEntity._source, String.class)); item.setSourceType(QueryBase.convertSafe(tuple, columns, ReferenceEntity._sourceType, SourceType.class)); - item.setType(QueryBase.convertSafe(tuple, columns, ReferenceEntity._type, ExternalReferencesType.class)); + item.setType(QueryBase.convertSafe(tuple, columns, ReferenceEntity._type, ReferenceType.class)); item.setCreatedBy(QueryBase.convertSafe(tuple, columns, ReferenceEntity._createdBy, UUID.class)); return item; } @@ -224,7 +224,7 @@ public class ReferenceQuery extends QueryBase { else if (item.match(ReferenceEntity._source)) return ReferenceEntity._source; else if (item.match(ReferenceEntity._sourceType)) return ReferenceEntity._sourceType; else if (item.match(ReferenceEntity._type)) return ReferenceEntity._type; - //else if (item.prefix(ExternalReferenceEntity._createdBy)) return ExternalReferenceEntity._createdBy; + //else if (item.prefix(ReferenceEntity._createdBy)) return ReferenceEntity._createdBy; else return null; } diff --git a/dmp-backend/core/src/main/java/eu/eudat/query/lookup/ReferenceLookup.java b/dmp-backend/core/src/main/java/eu/eudat/query/lookup/ReferenceLookup.java index d307d67b6..10b414b34 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/query/lookup/ReferenceLookup.java +++ b/dmp-backend/core/src/main/java/eu/eudat/query/lookup/ReferenceLookup.java @@ -1,6 +1,6 @@ package eu.eudat.query.lookup; -import eu.eudat.commons.enums.ExternalReferencesType; +import eu.eudat.commons.enums.ReferenceType; import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.SourceType; import eu.eudat.query.ReferenceQuery; @@ -19,7 +19,7 @@ public class ReferenceLookup extends Lookup { private Collection sourceTypes; - private Collection externalReferenceTypes; + private Collection referenceTypes; private List ids; @@ -65,19 +65,19 @@ public class ReferenceLookup extends Lookup { this.sourceTypes = sourceTypes; } - public Collection getExternalReferenceTypes() { - return externalReferenceTypes; + public Collection getReferenceTypes() { + return referenceTypes; } - public void setExternalReferenceTypes(Collection externalReferenceTypes) { - this.externalReferenceTypes = externalReferenceTypes; + public void setReferenceTypes(Collection referenceTypes) { + this.referenceTypes = referenceTypes; } public ReferenceQuery enrich(QueryFactory queryFactory) { ReferenceQuery query = queryFactory.query(ReferenceQuery.class); if (this.like != null) query.like(this.like); if (this.isActive != null) query.isActive(this.isActive); - if (this.externalReferenceTypes != null) query.externalReferenceTypes(this.externalReferenceTypes); + if (this.referenceTypes != null) query.referenceTypes(this.referenceTypes); if (this.sourceTypes != null) query.sourceTypes(this.sourceTypes); if (this.ids != null) query.ids(this.ids); if (this.excludedIds != null) query.excludedIds(this.excludedIds); diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceController.java index 49cfcd7ed..7c51ed60c 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceController.java @@ -3,7 +3,7 @@ package eu.eudat.controllers.v2; import eu.eudat.audit.AuditableAction; import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.Permission; -import eu.eudat.commons.enums.ExternalReferencesType; +import eu.eudat.commons.enums.ReferenceType; import eu.eudat.controllers.BaseController; import eu.eudat.data.ReferenceEntity; import eu.eudat.logic.proxy.config.exceptions.HugeResultSet; @@ -14,7 +14,7 @@ import eu.eudat.model.Reference; import eu.eudat.model.builder.ReferenceBuilder; import eu.eudat.model.censorship.ReferenceCensor; import eu.eudat.model.result.QueryResult; -import eu.eudat.models.data.FetcherExternalReference; +import eu.eudat.models.data.FetcherReference; import eu.eudat.models.data.helpers.responses.ResponseItem; import eu.eudat.query.ReferenceQuery; import eu.eudat.query.lookup.ReferenceLookup; @@ -46,7 +46,7 @@ import java.util.Map; import java.util.UUID; @RestController -@RequestMapping(path = {"api/external-references"}) +@RequestMapping(path = {"api/reference"}) public class ReferenceController extends BaseController { private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(ReferenceController.class)); @@ -113,15 +113,15 @@ public class ReferenceController extends BaseController { } @GetMapping(path = {"search/{externalType}"}, produces = "application/json") - public @ResponseBody ResponseEntity>> searchExternalReference(@PathVariable(value = "externalType") int externalType, - @RequestParam(value = "query", required = false) String query, - @RequestParam(value = "type", required = false) String type + public @ResponseBody ResponseEntity>> searchReference(@PathVariable(value = "externalType") int externalType, + @RequestParam(value = "query", required = false) String query, + @RequestParam(value = "type", required = false) String type ) throws HugeResultSet, NoURLFound, InvalidApplicationException { this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - ExternalReferencesType externalReferencesType = ExternalReferencesType.of((short) externalType); + ReferenceType referenceType = ReferenceType.of((short) externalType); - List fetcherExternalReferences = this.referenceService.searchExternalReference(externalReferencesType, query, type); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(fetcherExternalReferences)); + List fetcherReferences = this.referenceService.searchReference(referenceType, query, type); + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(fetcherReferences)); } @DeleteMapping("{id}") diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java index dbff82dd0..a629ec4e1 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; -import eu.eudat.commons.enums.ExternalReferencesType; +import eu.eudat.commons.enums.ReferenceType; import eu.eudat.logic.proxy.config.*; import eu.eudat.logic.proxy.config.configloaders.ConfigLoader; import eu.eudat.logic.proxy.config.entities.GenericUrls; @@ -51,7 +51,7 @@ public class RemoteFetcher { ).clientConnector(new ReactorClientHttpConnector(HttpClient.create().followRedirect(true))).build(); } - public List> get(ExternalReferencesType externalType, ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet { + public List> get(ReferenceType externalType, ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet { FetchStrategy fetchStrategy = null; GenericUrls exGenericUrls = this.getExternalUrls(externalType); List urlConfigs = key != null && !key.isEmpty() ? exGenericUrls.getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList()) @@ -60,7 +60,7 @@ public class RemoteFetcher { return getAll(urlConfigs, fetchStrategy, externalUrlCriteria); } - public GenericUrls getExternalUrls(ExternalReferencesType externalType) { + public GenericUrls getExternalUrls(ReferenceType externalType) { switch (externalType){ case Taxonomies: return configLoader.getExternalUrls().getTaxonomies(); case Licenses: return configLoader.getExternalUrls().getLicenses(); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ExternalReferencesCacheOptions.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ReferenceCacheOptions.java similarity index 65% rename from dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ExternalReferencesCacheOptions.java rename to dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ReferenceCacheOptions.java index a7a800a11..5bf2bda62 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ExternalReferencesCacheOptions.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ReferenceCacheOptions.java @@ -5,6 +5,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; @Configuration -@ConfigurationProperties(prefix = "cache.external-reference") -public class ExternalReferencesCacheOptions extends CacheOptions { +@ConfigurationProperties(prefix = "cache.reference") +public class ReferenceCacheOptions extends CacheOptions { } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ExternalReferencesCacheService.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ReferenceCacheService.java similarity index 57% rename from dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ExternalReferencesCacheService.java rename to dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ReferenceCacheService.java index f569f6631..df182cc74 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ExternalReferencesCacheService.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ReferenceCacheService.java @@ -9,27 +9,27 @@ import java.util.HashMap; import java.util.Locale; @Service -public class ExternalReferencesCacheService extends CacheService { +public class ReferenceCacheService extends CacheService { - public static class ExternalReferencesCacheValue { + public static class ReferenceCacheValue { - public ExternalReferencesCacheValue() {} + public ReferenceCacheValue() {} - public ExternalReferencesCacheValue(String externalType, ExternalUrlCriteria externalUrlCriteria) { - this.externalType = externalType; + public ReferenceCacheValue(String type, ExternalUrlCriteria externalUrlCriteria) { + this.type = type; this.externalUrlCriteria = externalUrlCriteria; } - private String externalType; + private String type; private ExternalUrlCriteria externalUrlCriteria; - public String getExternalType() { - return externalType; + public String getType() { + return type; } - public void setExternalType(String externalType) { - this.externalType = externalType; + public void setType(String type) { + this.type = type; } public ExternalUrlCriteria getExternalUrlCriteria() { @@ -42,15 +42,15 @@ public class ExternalReferencesCacheService extends CacheService valueClass() {return ExternalReferencesCacheValue.class;} + protected Class valueClass() {return ReferenceCacheValue.class;} - public String keyOf(ExternalReferencesCacheValue value) { - return this.buildKey(value.getExternalType(), value.getExternalUrlCriteria()); + public String keyOf(ReferenceCacheValue value) { + return this.buildKey(value.getType(), value.getExternalUrlCriteria()); } public String buildKey(String externalType, ExternalUrlCriteria externalUrlCriteria) { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ReferenceService.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ReferenceService.java index 9f61dd346..e531b4a60 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ReferenceService.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/services/references/ReferenceService.java @@ -1,7 +1,7 @@ package eu.eudat.logic.services.references; import eu.eudat.authorization.Permission; -import eu.eudat.commons.enums.ExternalReferencesType; +import eu.eudat.commons.enums.ReferenceType; import eu.eudat.commons.scope.user.UserScope; import eu.eudat.convention.ConventionService; import eu.eudat.data.dao.criteria.DataRepositoryCriteria; @@ -19,7 +19,7 @@ import eu.eudat.logic.proxy.config.exceptions.NoURLFound; import eu.eudat.logic.proxy.fetching.RemoteFetcher; import eu.eudat.logic.services.ApiContext; import eu.eudat.model.deleter.ReferenceDeleter; -import eu.eudat.models.data.FetcherExternalReference; +import eu.eudat.models.data.FetcherReference; import eu.eudat.queryable.QueryableList; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.builder.BuilderFactory; @@ -75,7 +75,7 @@ public class ReferenceService { public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException { logger.debug("deleting : {}", id); - this.authorizationService.authorizeForce(Permission.DeleteExternalReference); + this.authorizationService.authorizeForce(Permission.DeleteReference); this.deleterFactory.deleter(ReferenceDeleter.class).deleteAndSaveByIds(List.of(id)); } @@ -89,26 +89,26 @@ public class ReferenceService { // dataRepositories // registries, // services - public List searchExternalReference(ExternalReferencesType externalType, String query, String type) throws HugeResultSet, NoURLFound, InvalidApplicationException { + public List searchReference(ReferenceType externalType, String query, String type) throws HugeResultSet, NoURLFound, InvalidApplicationException { ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query); List> remoteRepos = null; - if (externalType.equals(ExternalReferencesType.Datasets)){ + if (externalType.equals(ReferenceType.Datasets)){ remoteRepos = remoteFetcher.getDatasets(externalUrlCriteria, type); }else { remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().get(externalType, externalUrlCriteria, type); } - List list = this.fetchFromDb(externalType, query, type, remoteRepos); + List list = this.fetchFromDb(externalType, query, type, remoteRepos); - list.addAll(remoteRepos.stream().map(FetcherExternalReference::fromRemoteModel).toList()); + list.addAll(remoteRepos.stream().map(FetcherReference::fromRemoteModel).toList()); list = list.stream().filter(x -> x.getName().toLowerCase().contains(query.toLowerCase())).collect(Collectors.toList()); - list.sort(Comparator.comparing(FetcherExternalReference::getName)); + list.sort(Comparator.comparing(FetcherReference::getName)); return list; } - private List fetchFromDb(ExternalReferencesType externalType, String query, String type, List> remoteRepos) throws InvalidApplicationException { - List list = new LinkedList<>(); + private List fetchFromDb(ReferenceType externalType, String query, String type, List> remoteRepos) throws InvalidApplicationException { + List list = new LinkedList<>(); switch (externalType) { case DataRepositories: case PubRepositories: @@ -118,7 +118,7 @@ public class ReferenceService { criteria.setCreationUserId(this.userScope.getUserId()); if (type.equals("")) { List dataRepositoryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().getWithCriteria(criteria)).toList(); - list = dataRepositoryList.stream().map(item -> new FetcherExternalReference().fromDataRepository(item)).collect(Collectors.toList()); + list = dataRepositoryList.stream().map(item -> new FetcherReference().fromDataRepository(item)).collect(Collectors.toList()); } } case Registries: { @@ -127,7 +127,7 @@ public class ReferenceService { criteria.setCreationUserId(this.userScope.getUserId()); if (type.equals("")) { List registryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao().getWithCriteria(criteria)).toList(); - list = registryList.stream().map(item -> new FetcherExternalReference().fromRegistry(item)).collect(Collectors.toList()); + list = registryList.stream().map(item -> new FetcherReference().fromRegistry(item)).collect(Collectors.toList()); } } case Services: @@ -139,7 +139,7 @@ public class ReferenceService { if (type.equals("")) { List serviceList = (this.apiContext.getOperationsContext().getDatabaseRepository().getServiceDao().getWithCriteria(criteria)).toList(); - list = serviceList.stream().map(item -> new FetcherExternalReference().fromService(item)).collect(Collectors.toList()); + list = serviceList.stream().map(item -> new FetcherReference().fromService(item)).collect(Collectors.toList()); } } case Datasets:{ @@ -149,7 +149,7 @@ public class ReferenceService { criteria.setCreationUserId(this.userScope.getUserId()); QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getExternalDatasetDao().getWithCriteria(criteria); - list = items.select(item -> new FetcherExternalReference().fromDataset(item)); + list = items.select(item -> new FetcherReference().fromDataset(item)); } case Taxonomies: case Publications: diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherExternalReference.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherReference.java similarity index 73% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherExternalReference.java rename to dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherReference.java index 4e3c785fe..747f3b496 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherExternalReference.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherReference.java @@ -4,7 +4,7 @@ import eu.eudat.data.old.*; import java.util.Map; -public class FetcherExternalReference { +public class FetcherReference { private String id; private String name; @@ -133,28 +133,28 @@ public class FetcherExternalReference { this.tag = tag; } - public static FetcherExternalReference fromRemoteModel(Map data) { - FetcherExternalReference fetcherExternalReference = new FetcherExternalReference(); - if (data == null) return fetcherExternalReference; + public static FetcherReference fromRemoteModel(Map data) { + FetcherReference fetcherReference = new FetcherReference(); + if (data == null) return fetcherReference; - fetcherExternalReference.setId(data.getOrDefault("id", null)); - fetcherExternalReference.setName(data.getOrDefault("name", null)); - fetcherExternalReference.setPid(data.getOrDefault("pid", null)); - fetcherExternalReference.setPidTypeField(data.getOrDefault("pidTypeField", null)); - fetcherExternalReference.setUri(data.getOrDefault("uri", null)); - fetcherExternalReference.setDescription(data.getOrDefault("description", null)); - fetcherExternalReference.setSource(data.getOrDefault("source", null)); - fetcherExternalReference.setCount(data.getOrDefault("count", null)); - fetcherExternalReference.setPath(data.getOrDefault("path", null)); - fetcherExternalReference.setHost(data.getOrDefault("host", null)); - fetcherExternalReference.setTypes(data.getOrDefault("types", null)); - fetcherExternalReference.setFirstName(data.getOrDefault("firstName", null)); - fetcherExternalReference.setLastName(data.getOrDefault("lastName", null)); - fetcherExternalReference.setTag(data.getOrDefault("tag", null)); - return fetcherExternalReference; + fetcherReference.setId(data.getOrDefault("id", null)); + fetcherReference.setName(data.getOrDefault("name", null)); + fetcherReference.setPid(data.getOrDefault("pid", null)); + fetcherReference.setPidTypeField(data.getOrDefault("pidTypeField", null)); + fetcherReference.setUri(data.getOrDefault("uri", null)); + fetcherReference.setDescription(data.getOrDefault("description", null)); + fetcherReference.setSource(data.getOrDefault("source", null)); + fetcherReference.setCount(data.getOrDefault("count", null)); + fetcherReference.setPath(data.getOrDefault("path", null)); + fetcherReference.setHost(data.getOrDefault("host", null)); + fetcherReference.setTypes(data.getOrDefault("types", null)); + fetcherReference.setFirstName(data.getOrDefault("firstName", null)); + fetcherReference.setLastName(data.getOrDefault("lastName", null)); + fetcherReference.setTag(data.getOrDefault("tag", null)); + return fetcherReference; } - public FetcherExternalReference fromDataRepository(DataRepository entity) { + public FetcherReference fromDataRepository(DataRepository entity) { // this.setAbbreviation(entity.getAbbreviation()); this.setName(entity.getLabel()); this.setUri(entity.getUri()); @@ -169,7 +169,7 @@ public class FetcherExternalReference { return this; } - public FetcherExternalReference fromRegistry(Registry entity){ + public FetcherReference fromRegistry(Registry entity){ this.id = entity.getId().toString(); // this.abbreviation = entity.getAbbreviation(); // this.created = entity.getCreated(); @@ -186,7 +186,7 @@ public class FetcherExternalReference { // this.reference = entity.getReference(); return this; } - public FetcherExternalReference fromService(Service entity) { + public FetcherReference fromService(Service entity) { // this.abbreviation = entity.getAbbreviation(); // this.created = entity.getCreated(); this.id = entity.getId().toString(); @@ -203,7 +203,7 @@ public class FetcherExternalReference { return this; } - public FetcherExternalReference fromResearcher(Researcher entity){ + public FetcherReference fromResearcher(Researcher entity){ this.id = entity.getId().toString(); this.name = entity.getLabel(); String refParts[] = entity.getReference().split(":"); @@ -216,7 +216,7 @@ public class FetcherExternalReference { return this; } - public FetcherExternalReference fromOrganisation(Organisation entity){ + public FetcherReference fromOrganisation(Organisation entity){ this.id = entity.getId().toString(); this.name = entity.getLabel(); String refParts[] = entity.getReference().split(":"); @@ -229,7 +229,7 @@ public class FetcherExternalReference { return this; } - public FetcherExternalReference fromDataset(ExternalDataset entity){ + public FetcherReference fromDataset(ExternalDataset entity){ this.id = entity.getId().toString(); this.name = entity.getLabel(); String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); diff --git a/dmp-backend/web/src/main/resources/config/cache.yml b/dmp-backend/web/src/main/resources/config/cache.yml index d5b1ed0aa..637bb3033 100644 --- a/dmp-backend/web/src/main/resources/config/cache.yml +++ b/dmp-backend/web/src/main/resources/config/cache.yml @@ -26,7 +26,7 @@ cache: expireAfterWriteMinutes: 10 expireAfterAccessMinutes: 10 refreshAfterWriteMinutes: 10 - - names: [ "externalReference" ] + - names: [ "Reference" ] allowNullValues: true initialCapacity: 100 maximumSize: 500 @@ -44,6 +44,6 @@ cache: supportiveMaterial: name: supportiveMaterial keyPattern: supportive_material_$material$:v0 - externalReference: - name: externalReference - keyPattern: external_reference_$type$_$criteria$:v0 \ No newline at end of file + Reference: + name: Reference + keyPattern: reference_$type$_$criteria$:v0 \ No newline at end of file diff --git a/dmp-backend/web/src/main/resources/config/permissions.yml b/dmp-backend/web/src/main/resources/config/permissions.yml index de2ec5149..52fa74adc 100644 --- a/dmp-backend/web/src/main/resources/config/permissions.yml +++ b/dmp-backend/web/src/main/resources/config/permissions.yml @@ -196,20 +196,20 @@ permissions: allowAnonymous: false allowAuthenticated: false - # ExternalReference Permissions - BrowseExternalReference: + # Reference Permissions + BrowseReference: roles: - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false - EditExternalReference: + EditReference: roles: - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false - DeleteExternalReference: + DeleteReference: roles: - Admin claims: [ ] @@ -217,20 +217,20 @@ permissions: allowAnonymous: false allowAuthenticated: false - # DmpExternalReference Permissions - BrowseDmpExternalReference: + # DmpReference Permissions + BrowseDmpReference: roles: - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false - EditDmpExternalReference: + EditDmpReference: roles: - Admin clients: [ ] allowAnonymous: false allowAuthenticated: false - DeleteDmpExternalReference: + DeleteDmpReference: roles: - Admin claims: [ ] diff --git a/dmp-frontend/src/app/core/common/enum/external-references-type.ts b/dmp-frontend/src/app/core/common/enum/reference-type.ts similarity index 86% rename from dmp-frontend/src/app/core/common/enum/external-references-type.ts rename to dmp-frontend/src/app/core/common/enum/reference-type.ts index 2fb2dae89..0c5c48d9b 100644 --- a/dmp-frontend/src/app/core/common/enum/external-references-type.ts +++ b/dmp-frontend/src/app/core/common/enum/reference-type.ts @@ -1,4 +1,4 @@ -export enum ExternalReferencesType { +export enum ReferenceType { Taxonomies = 0, Licenses = 1, Publications = 2, diff --git a/dmp-frontend/src/app/core/model/external-reference/external-reference.ts b/dmp-frontend/src/app/core/model/reference/reference.ts similarity index 69% rename from dmp-frontend/src/app/core/model/external-reference/external-reference.ts rename to dmp-frontend/src/app/core/model/reference/reference.ts index 83007906e..a03191bea 100644 --- a/dmp-frontend/src/app/core/model/external-reference/external-reference.ts +++ b/dmp-frontend/src/app/core/model/reference/reference.ts @@ -1,13 +1,13 @@ -import { ExternalReferencesType } from "@app/core/common/enum/external-references-type"; +import { ReferenceType } from "@app/core/common/enum/reference-type"; import { IsActive } from "@app/core/common/enum/is-active.enum"; import { SourceType } from "@app/core/common/enum/source-type"; import { UUID } from "crypto"; -import { DmpBlueprint } from "../dmp-blueprint/dmp-blueprint"; +import { DmpModel } from "../dmp/dmp"; export interface Reference { id: UUID; label: string; - type: ExternalReferencesType; + type: ReferenceType; description: string; definition: string; reference: string; @@ -17,17 +17,17 @@ export interface Reference { isActive: IsActive; createdAt: Date; updatedAt: Date; - dmpExternalReferences: DmpReference[]; + dmpReferences: DmpReference[]; } export interface DmpReference { id: UUID; - dmpBlueprint: DmpBlueprint; - externalReference: Reference; + dmp: DmpModel; + reference: Reference; data: string; } -export interface FetcherExternalReference { +export interface FetcherReference { id: string; name: string; pid: string; diff --git a/dmp-frontend/src/app/core/services/external-sources/external-sources.service.ts b/dmp-frontend/src/app/core/services/external-sources/external-sources.service.ts index e3b42585b..937aa57fa 100644 --- a/dmp-frontend/src/app/core/services/external-sources/external-sources.service.ts +++ b/dmp-frontend/src/app/core/services/external-sources/external-sources.service.ts @@ -14,8 +14,8 @@ import { BaseHttpService } from '../http/base-http.service'; import { ConfigurationService } from '../configuration/configuration.service'; import { LicenseCriteria } from '@app/core/query/license/license-criteria'; import {PublicationCriteria} from "@app/core/query/publication/publication-criteria"; -import { FetcherExternalReference } from '@app/core/model/external-reference/external-reference'; -import { ExternalReferencesType } from '@app/core/common/enum/external-references-type'; +import { FetcherReference } from '@app/core/model/reference/reference'; +import { ReferenceType } from '@app/core/common/enum/reference-type'; @Injectable() export class ExternalSourcesService { @@ -59,11 +59,11 @@ export class ExternalSourcesService { return this.http.get(this.actionUrl + 'licenses' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers }); } - public listExternal(externalType: ExternalReferencesType, query: string, type: string): Observable { - const url = this.configurationService.server + `external-references/search/${externalType}`; + public listExternal(externalType: ReferenceType, query: string, type: string): Observable { + const url = this.configurationService.server + `reference/search/${externalType}`; const options = { params: { query: query, type: type } }; - return this.http.get(url, options); + return this.http.get(url, options); } public searchDatasetTags(requestItem: RequestItem): Observable { diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts index c11d835c6..3b4c22ab1 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts @@ -48,8 +48,8 @@ import {MatDialog} from "@angular/material/dialog"; import {HttpError} from "@common/modules/errors/error-handling/http-error-handling.service"; import {HttpErrorResponse} from "@angular/common/http"; import * as FileSaver from "file-saver"; -import { FetcherExternalReference } from '@app/core/model/external-reference/external-reference'; -import { ExternalReferencesType } from '@app/core/common/enum/external-references-type'; +import { FetcherReference } from '@app/core/model/reference/reference'; +import { ReferenceType } from '@app/core/common/enum/reference-type'; import { FileUtils } from '@app/core/services/utilities/file-utils.service'; @Component({ @@ -466,72 +466,72 @@ export class FormFieldComponent extends BaseComponent implements OnInit { } } - searchDatasetExternalDatasets(query: string): Observable { + searchDatasetExternalDatasets(query: string): Observable { const requestItem: RequestItem = new RequestItem(); requestItem.criteria = new ExternalDatasetCriteria(); requestItem.criteria.like = query; requestItem.criteria.type = ''; //return this.externalSourcesService.searchDatasetSExternalDatasetservice(requestItem); - return this.externalSourcesService.listExternal(ExternalReferencesType.Datasets, requestItem.criteria.like, requestItem.criteria.type); + return this.externalSourcesService.listExternal(ReferenceType.Datasets, requestItem.criteria.like, requestItem.criteria.type); } - searchDatasetExternalDataRepositories(query: string): Observable { + searchDatasetExternalDataRepositories(query: string): Observable { const requestItem: RequestItem = new RequestItem(); requestItem.criteria = new DataRepositoryCriteria(); requestItem.criteria.like = query; requestItem.criteria.type = ''; - return this.externalSourcesService.listExternal(ExternalReferencesType.DataRepositories, requestItem.criteria.like, requestItem.criteria.type); + return this.externalSourcesService.listExternal(ReferenceType.DataRepositories, requestItem.criteria.like, requestItem.criteria.type); } - searchDatasetExternalPubRepositories(query: string): Observable { + searchDatasetExternalPubRepositories(query: string): Observable { const requestItem: RequestItem = new RequestItem(); requestItem.criteria = new DataRepositoryCriteria(); requestItem.criteria.like = query; requestItem.criteria.type = ''; - return this.externalSourcesService.listExternal(ExternalReferencesType.PubRepositories, requestItem.criteria.like, requestItem.criteria.type); + return this.externalSourcesService.listExternal(ReferenceType.PubRepositories, requestItem.criteria.like, requestItem.criteria.type); } - searchDatasetExternalJournalRepositories(query: string): Observable { + searchDatasetExternalJournalRepositories(query: string): Observable { const requestItem: RequestItem = new RequestItem(); requestItem.criteria = new DataRepositoryCriteria(); requestItem.criteria.like = query; requestItem.criteria.type = ''; - return this.externalSourcesService.listExternal(ExternalReferencesType.Journals, requestItem.criteria.like, requestItem.criteria.type); + return this.externalSourcesService.listExternal(ReferenceType.Journals, requestItem.criteria.like, requestItem.criteria.type); } - searchDatasetExternalTaxonomies(query: string): Observable { + searchDatasetExternalTaxonomies(query: string): Observable { const requestItem: RequestItem = new RequestItem(); requestItem.criteria = new TaxonomyCriteria(); requestItem.criteria.like = query; requestItem.criteria.type = ''; - return this.externalSourcesService.listExternal(ExternalReferencesType.Taxonomies, requestItem.criteria.like, requestItem.criteria.type); + return this.externalSourcesService.listExternal(ReferenceType.Taxonomies, requestItem.criteria.like, requestItem.criteria.type); } - searchDatasetExternalLicences(query: string): Observable { + searchDatasetExternalLicences(query: string): Observable { const requestItem: RequestItem = new RequestItem(); requestItem.criteria = new LicenseCriteria(); requestItem.criteria.like = query; requestItem.criteria.type = ''; - return this.externalSourcesService.listExternal(ExternalReferencesType.Licenses, requestItem.criteria.like, requestItem.criteria.type); + return this.externalSourcesService.listExternal(ReferenceType.Licenses, requestItem.criteria.like, requestItem.criteria.type); } - searchDatasetExternalPublications(query: string): Observable { + searchDatasetExternalPublications(query: string): Observable { const requestItem: RequestItem = new RequestItem(); requestItem.criteria = new PublicationCriteria(); requestItem.criteria.like = query; requestItem.criteria.type = ''; - return this.externalSourcesService.listExternal(ExternalReferencesType.Publications, requestItem.criteria.like, requestItem.criteria.type); + return this.externalSourcesService.listExternal(ReferenceType.Publications, requestItem.criteria.like, requestItem.criteria.type); } - searchDatasetExternalRegistries(query: string): Observable { + searchDatasetExternalRegistries(query: string): Observable { const requestItem: RequestItem = new RequestItem(); requestItem.criteria = new RegistryCriteria(); requestItem.criteria.like = query; requestItem.criteria.type = ''; - return this.externalSourcesService.listExternal(ExternalReferencesType.Registries, requestItem.criteria.like, requestItem.criteria.type); + return this.externalSourcesService.listExternal(ReferenceType.Registries, requestItem.criteria.like, requestItem.criteria.type); } - searchDatasetExternalServices(query: string): Observable { + searchDatasetExternalServices(query: string): Observable { const requestItem: RequestItem = new RequestItem(); requestItem.criteria = new ServiceCriteria(); requestItem.criteria.like = query; requestItem.criteria.type = ''; - return this.externalSourcesService.listExternal(ExternalReferencesType.Services, requestItem.criteria.like, requestItem.criteria.type); + return this.externalSourcesService.listExternal(ReferenceType.Services, requestItem.criteria.like, requestItem.criteria.type); } searchDatasetTags(query: string): Observable { @@ -593,14 +593,14 @@ export class FormFieldComponent extends BaseComponent implements OnInit { } } - filterOrganisations(value: string): Observable { + filterOrganisations(value: string): Observable { //return this.externalSourcesService.searchDMPOrganizations(value); - return this.externalSourcesService.listExternal(ExternalReferencesType.Organizations, value, ''); + return this.externalSourcesService.listExternal(ReferenceType.Organizations, value, ''); } - filterResearchers(value: string): Observable { + filterResearchers(value: string): Observable { //return this.externalSourcesService.searchDMPResearchers({ criteria: { name: value, like: null } }); - return this.externalSourcesService.listExternal(ExternalReferencesType.Researcher, value, ''); + return this.externalSourcesService.listExternal(ReferenceType.Researcher, value, ''); } getDatasetIdControl(name: string): UntypedFormControl {