diff --git a/dbrepo-metadata-db/migration/16/update_id.sql b/dbrepo-metadata-db/migration/16/update_id.sql new file mode 100644 index 0000000000000000000000000000000000000000..a3f161cc2a2305cc55042ec1761015e2b09e7034 --- /dev/null +++ b/dbrepo-metadata-db/migration/16/update_id.sql @@ -0,0 +1,11 @@ +SET FOREIGN_KEY_CHECKS = 0; +BEGIN; +UPDATE mdb_users SET id = :old_id WHERE id = :new_id; +UPDATE mdb_have_access SET user_id = :old_id WHERE user_id = :new_id; +UPDATE mdb_databases SET owned_by = :old_id WHERE owned_by = :new_id; +UPDATE mdb_databases SET contact_person = :old_id WHERE contact_person = :new_id; +UPDATE mdb_tables SET owned_by = :old_id WHERE owned_by = :new_id; +UPDATE mdb_view SET owned_by = :old_id WHERE owned_by = :new_id; +UPDATE mdb_identifiers SET owned_by = :old_id WHERE owned_by = :new_id; +COMMIT; +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/AffiliationDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/AffiliationDto.java new file mode 100644 index 0000000000000000000000000000000000000000..807c03f48df24d122757da14161f0b98404ba5c1 --- /dev/null +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/AffiliationDto.java @@ -0,0 +1,20 @@ +package at.tuwien.api.doi; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import lombok.extern.jackson.Jacksonized; + +@Getter +@Setter +@Builder +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Jacksonized +@ToString +public class AffiliationDto { + + @Schema(example = "ISE, TU Wien, Data Science Research Unit, Vienna, Austria") + private String name; + +} diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/AuthorDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/AuthorDto.java new file mode 100644 index 0000000000000000000000000000000000000000..8f8bbb61ffc64341119614f7de3395c40beac92e --- /dev/null +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/AuthorDto.java @@ -0,0 +1,35 @@ +package at.tuwien.api.doi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import lombok.extern.jackson.Jacksonized; + +import java.util.List; + +@Getter +@Setter +@Builder +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Jacksonized +@ToString +public class AuthorDto { + + @Schema(example = "Weise") + private String family; + + @Schema(example = "Martin") + private String given; + + @JsonProperty("ORCID") + @Schema(example = "http://orcid.org/0000-0003-4216-302X") + private String orcid; + + @Schema(example = "first") + private String sequence; + + private List<AffiliationDto> affiliation; + +} diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/DoiDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/DoiDto.java new file mode 100644 index 0000000000000000000000000000000000000000..af0cd5bcc64bf8797c81197fb6e9abc0cede6a7f --- /dev/null +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/DoiDto.java @@ -0,0 +1,82 @@ +package at.tuwien.api.doi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.*; +import lombok.extern.jackson.Jacksonized; + +import java.util.List; + +@Getter +@Setter +@Builder +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Jacksonized +@ToString +public class DoiDto { + + @NotNull + @Schema(example = "https://doi.org/10.5334/dsj-2022-004") + private String id; + + @NotNull + private TimeRepresentationDto indexed; + + private TimeRepresentationDto deposited; + + private TimeRepresentationDto issued; + + private TimeRepresentationDto published; + + @JsonProperty("DOI") + @Schema(example = "10.5334/dsj-2022-004") + private String doi; + + @NotNull + @Schema(example = "dataset") + private String type; + + private List<AuthorDto> author; + + @Schema(example = "Crossref") + private String source; + + @Schema(example = "DBRepo: A Data Repository System for Research Data in Databases") + private String title; + + @Schema(example = "10.1109") + private String prefix; + + @Schema(example = "21") + private String volume; + + @JsonProperty("is-referenced-by-count") + @Schema(example = "0") + private Integer isReferencedByCount; + + @JsonProperty("reference-count") + @Schema(example = "28") + private Integer referenceCount; + + @Schema(example = "IEEE") + private String publisher; + + @Schema(example = "322-331") + private String page; + + private String member; + + @Schema(example = "2024 IEEE International Conference on Big Data (BigData)") + private String event; + + private List<ReferenceDto> reference; + + private Integer score; + + @JsonProperty("URL") + private String url; + +} diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/LicenseDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/LicenseDto.java new file mode 100644 index 0000000000000000000000000000000000000000..32f5ffcd2aced054dfffd72a44a79b9994a6658b --- /dev/null +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/LicenseDto.java @@ -0,0 +1,32 @@ +package at.tuwien.api.doi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import lombok.extern.jackson.Jacksonized; + +@Getter +@Setter +@Builder +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Jacksonized +@ToString +public class LicenseDto { + + private TimeRepresentationDto start; + + @JsonProperty("content-version") + @Schema(example = "stm-asf") + private String contentVersion; + + @JsonProperty("delay-in-days") + @Schema(example = "0") + private Integer delayInDays; + + @JsonProperty("URL") + @Schema(example = "https://doi.org/10.15223/policy-029") + private String url; + +} diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/LinkDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/LinkDto.java new file mode 100644 index 0000000000000000000000000000000000000000..5f70696091c7cf14abb0c717627f18a1e3eff9de --- /dev/null +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/LinkDto.java @@ -0,0 +1,35 @@ +package at.tuwien.api.doi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.*; +import lombok.extern.jackson.Jacksonized; + +@Getter +@Setter +@Builder +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Jacksonized +@ToString +public class LinkDto { + + @JsonProperty("URL") + @Schema(example = "http://xplorestaging.ieee.org/ielx8/10824975/10824942/10825401.pdf?arnumber=10825401") + private String url; + + @JsonProperty("content-type") + @Schema(example = "unspecified") + private String contentType; + + @JsonProperty("content-version") + @Schema(example = "vor") + private String contentVersion; + + @JsonProperty("intended-application") + @Schema(example = "similarity-checking") + private String intendedApplication; + +} diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/ReferenceDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/ReferenceDto.java new file mode 100644 index 0000000000000000000000000000000000000000..9458c0f9192a2f6fa71adad4e910b4e8e7b609ef --- /dev/null +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/ReferenceDto.java @@ -0,0 +1,55 @@ +package at.tuwien.api.doi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.*; +import lombok.extern.jackson.Jacksonized; + +import java.util.List; + +@Getter +@Setter +@Builder +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Jacksonized +@ToString +public class ReferenceDto { + + @NotNull + @Schema(example = "ref1") + private String key; + + @JsonProperty("doi-asserted-by") + @Schema(example = "publisher") + private String doiAssertedBy; + + @JsonProperty("DOI") + @Schema(example = "10.1038/sdata.2016.18") + private String doi; + + @Schema(example = "2024") + private String year; + + @JsonProperty("article-title") + @Schema(example = "The Dryad Data Repository: a Singapore Framework metadata Architecture in a DSpace Environment") + private String articleTitle; + + @JsonProperty("volume-title") + @Schema(example = "Proceedings of the 2008 International Conference on Dublin Core and Metadata Applications") + private String volumeTitle; + + @JsonProperty("journal-title") + @Schema(example = "Libraries Research Publications") + private String journalTitle; + + @Schema(example = "Witt") + private String author; + + @JsonProperty("first-page") + @Schema(example = "157") + private String firstPage; + +} diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/ResourceDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/ResourceDto.java new file mode 100644 index 0000000000000000000000000000000000000000..a2543c2834def88d4ae0421d92dcc1efd34ddaf7 --- /dev/null +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/ResourceDto.java @@ -0,0 +1,20 @@ +package at.tuwien.api.doi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import lombok.extern.jackson.Jacksonized; + +@Getter +@Setter +@Builder +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Jacksonized +@ToString +public class ResourceDto { + + private ResourceRepresentationDto primary; + +} diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/ResourceRepresentationDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/ResourceRepresentationDto.java new file mode 100644 index 0000000000000000000000000000000000000000..bf2312a6488a27498b83bd8039064d4c0badd75b --- /dev/null +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/ResourceRepresentationDto.java @@ -0,0 +1,20 @@ +package at.tuwien.api.doi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import lombok.extern.jackson.Jacksonized; + +@Getter +@Setter +@Builder +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Jacksonized +@ToString +public class ResourceRepresentationDto { + + @JsonProperty("URL") + private String url; + +} diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/TimeRepresentationDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/TimeRepresentationDto.java new file mode 100644 index 0000000000000000000000000000000000000000..fe649217e9b6b963138b38702abf39b539ba8d08 --- /dev/null +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/doi/TimeRepresentationDto.java @@ -0,0 +1,33 @@ +package at.tuwien.api.doi; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import lombok.extern.jackson.Jacksonized; + +import java.time.Instant; +import java.util.List; + +@Getter +@Setter +@Builder +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Jacksonized +@ToString +public class TimeRepresentationDto { + + @JsonProperty("date-parts") + @Schema(example = "[[2025,1,18]]") + private List<List<Integer>> dateParts; + + @JsonProperty("date-time") + @Schema(example = "2021-03-12T15:26:21Z") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ssX", timezone = "UTC") + private Instant dateTime; + + private Long timestamp; + +} diff --git a/dbrepo-metadata-service/rest-service/src/main/resources/application.yml b/dbrepo-metadata-service/rest-service/src/main/resources/application.yml index 134ee204513f0d8c33f9442d38439f1c4a3eb628..681a6db8dde2656bca3378aff80431e39ee4e304 100644 --- a/dbrepo-metadata-service/rest-service/src/main/resources/application.yml +++ b/dbrepo-metadata-service/rest-service/src/main/resources/application.yml @@ -59,6 +59,7 @@ dbrepo: brokerService: "${BROKER_SERVICE_ENDPOINT:http://broker-service:15672}" crossRefService: "${CROSSREF_ENDPOINT:http://data.crossref.org}" dashboardService: "${DASHBOARD_SERVICE_ENDPOINT:http://dashboard-service:8080}" + doiService: "${DOI_ENDPOINT:https://doi.org}" dataService: "${DATA_SERVICE_ENDPOINT:http://data-service:8080}" rorService: "${ROR_ENDPOINT:https://api.ror.org}" searchService: "${SEARCH_SERVICE_ENDPOINT:http://search-service:8080}" diff --git a/dbrepo-metadata-service/rest-service/src/test/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossrefGatewayUnitTest.java b/dbrepo-metadata-service/rest-service/src/test/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossRefGatewayUnitTest.java similarity index 75% rename from dbrepo-metadata-service/rest-service/src/test/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossrefGatewayUnitTest.java rename to dbrepo-metadata-service/rest-service/src/test/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossRefGatewayUnitTest.java index bbf0e453071c0db561ff3bcdd14e56bebb02bda9..7513622f37a0dc8f50f13611715097bf0b8c2787 100644 --- a/dbrepo-metadata-service/rest-service/src/test/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossrefGatewayUnitTest.java +++ b/dbrepo-metadata-service/rest-service/src/test/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossRefGatewayUnitTest.java @@ -1,12 +1,13 @@ package at.ac.tuwien.ifs.dbrepo.gateway; -import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossrefDto; +import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossRefDto; import at.ac.tuwien.ifs.dbrepo.core.exception.DoiNotFoundException; import at.ac.tuwien.ifs.dbrepo.core.test.BaseTest; import lombok.extern.log4j.Log4j2; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.HttpEntity; @@ -23,24 +24,25 @@ import static org.mockito.Mockito.*; @Log4j2 @SpringBootTest @ExtendWith(SpringExtension.class) -public class CrossrefGatewayUnitTest extends BaseTest { +public class CrossRefGatewayUnitTest extends BaseTest { @MockBean + @Qualifier("crossRefServiceRestTemplate") private RestTemplate restTemplate; @Autowired - private CrossrefGateway crossrefGateway; + private CrossRefGateway crossRefGateway; @Test public void findById_succeeds() throws DoiNotFoundException { /* mock */ - when(restTemplate.exchange(anyString(), eq(HttpMethod.GET), any(HttpEntity.class), eq(CrossrefDto.class))) + when(restTemplate.exchange(anyString(), eq(HttpMethod.GET), eq(HttpEntity.EMPTY), eq(CrossRefDto.class))) .thenReturn(ResponseEntity.status(HttpStatus.OK) .build()); /* test */ - crossrefGateway.findById("501100004729"); + crossRefGateway.findById("501100004729"); } @Test @@ -49,11 +51,11 @@ public class CrossrefGatewayUnitTest extends BaseTest { /* mock */ doThrow(HttpServerErrorException.class) .when(restTemplate) - .exchange(anyString(), eq(HttpMethod.GET), any(HttpEntity.class), eq(CrossrefDto.class)); + .exchange(anyString(), eq(HttpMethod.GET), eq(HttpEntity.EMPTY), eq(CrossRefDto.class)); /* test */ assertThrows(DoiNotFoundException.class, () -> { - crossrefGateway.findById("501100004729"); + crossRefGateway.findById("501100004729"); }); } diff --git a/dbrepo-metadata-service/rest-service/src/test/java/at/ac/tuwien/ifs/dbrepo/service/MetadataServiceUnitTest.java b/dbrepo-metadata-service/rest-service/src/test/java/at/ac/tuwien/ifs/dbrepo/service/MetadataServiceUnitTest.java index a00b44e392982748b4e07e89d1995d5f1e5147f3..f96d6807f0071d9c3ee7b2a64c6846559022b80e 100644 --- a/dbrepo-metadata-service/rest-service/src/test/java/at/ac/tuwien/ifs/dbrepo/service/MetadataServiceUnitTest.java +++ b/dbrepo-metadata-service/rest-service/src/test/java/at/ac/tuwien/ifs/dbrepo/service/MetadataServiceUnitTest.java @@ -1,18 +1,18 @@ package at.ac.tuwien.ifs.dbrepo.service; -import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossrefDto; +import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossRefDto; import at.ac.tuwien.ifs.dbrepo.core.api.orcid.OrcidDto; import at.ac.tuwien.ifs.dbrepo.core.api.ror.RorDto; import at.ac.tuwien.ifs.dbrepo.core.api.user.external.ExternalMetadataDto; import at.ac.tuwien.ifs.dbrepo.core.api.user.external.affiliation.ExternalAffiliationDto; import at.ac.tuwien.ifs.dbrepo.core.exception.*; -import at.ac.tuwien.ifs.dbrepo.gateway.CrossrefGateway; +import at.ac.tuwien.ifs.dbrepo.core.test.BaseTest; +import at.ac.tuwien.ifs.dbrepo.gateway.CrossRefGateway; import at.ac.tuwien.ifs.dbrepo.gateway.OrcidGateway; import at.ac.tuwien.ifs.dbrepo.gateway.RorGateway; import at.ac.tuwien.ifs.dbrepo.oaipmh.OaiErrorType; import at.ac.tuwien.ifs.dbrepo.oaipmh.OaiListIdentifiersParameters; import at.ac.tuwien.ifs.dbrepo.oaipmh.OaiRecordParameters; -import at.ac.tuwien.ifs.dbrepo.core.test.BaseTest; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.log4j.Log4j2; @@ -48,7 +48,7 @@ public class MetadataServiceUnitTest extends BaseTest { private RorGateway rorGateway; @MockBean - private CrossrefGateway crossrefGateway; + private CrossRefGateway crossRefGateway; @MockBean private IdentifierService identifierService; @@ -203,11 +203,11 @@ public class MetadataServiceUnitTest extends BaseTest { @Test public void findByUrl_doi_succeeds() throws OrcidNotFoundException, RorNotFoundException, IOException, DoiNotFoundException, IdentifierNotSupportedException { - final CrossrefDto doi = objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) - .readValue(new File("src/test/resources/json/doi_ec.json"), CrossrefDto.class); + final CrossRefDto doi = objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + .readValue(new File("src/test/resources/json/doi_ec.json"), CrossRefDto.class); /* mock */ - when(crossrefGateway.findById(FUNDER_1_IDENTIFIER_ID_ONLY)) + when(crossRefGateway.findById(FUNDER_1_IDENTIFIER_ID_ONLY)) .thenReturn(doi); /* test */ @@ -223,7 +223,7 @@ public class MetadataServiceUnitTest extends BaseTest { /* mock */ doThrow(DoiNotFoundException.class) - .when(crossrefGateway) + .when(crossRefGateway) .findById(anyString()); /* test */ diff --git a/dbrepo-metadata-service/rest-service/src/test/resources/doi/database.json b/dbrepo-metadata-service/rest-service/src/test/resources/doi/database.json new file mode 100644 index 0000000000000000000000000000000000000000..94508d61a528e8eb90e4330534160d3f69ff2709 --- /dev/null +++ b/dbrepo-metadata-service/rest-service/src/test/resources/doi/database.json @@ -0,0 +1,70 @@ +{ + "indexed": { + "date-parts": [ + [ + 2024, + 12, + 11 + ] + ], + "date-time": "2024-12-11T00:54:48Z", + "timestamp": 1733878488241, + "version": "3.30.1" + }, + "reference-count": 0, + "publisher": "International STM Association", + "content-domain": { + "domain": [], + "crossmark-restriction": false + }, + "DOI": "10.15223\/policy-037", + "type": "database", + "created": { + "date-parts": [ + [ + 2021, + 5, + 3 + ] + ], + "date-time": "2021-05-03T21:10:23Z", + "timestamp": 1620076223000 + }, + "source": "Crossref", + "is-referenced-by-count": 0, + "title": "Article Sharing Framework Policy #37", + "prefix": "10.15223", + "member": "5868", + "container-title": [], + "original-title": [], + "deposited": { + "date-parts": [ + [ + 2021, + 5, + 3 + ] + ], + "date-time": "2021-05-03T21:10:23Z", + "timestamp": 1620076223000 + }, + "score": 1, + "resource": { + "primary": { + "URL": "https:\/\/www.stm-assoc.org\/asf\/policy-037" + } + }, + "subtitle": [], + "short-title": [], + "issued": { + "date-parts": [ + [ + null + ] + ] + }, + "references-count": 0, + "URL": "http:\/\/dx.doi.org\/10.15223\/policy-037", + "relation": {}, + "subject": [] +} \ No newline at end of file diff --git a/dbrepo-metadata-service/rest-service/src/test/resources/doi/dataset.json b/dbrepo-metadata-service/rest-service/src/test/resources/doi/dataset.json new file mode 100644 index 0000000000000000000000000000000000000000..f23113868971703fcb08523b96e84e6774c5fa04 --- /dev/null +++ b/dbrepo-metadata-service/rest-service/src/test/resources/doi/dataset.json @@ -0,0 +1,25 @@ +{ + "type": "dataset", + "id": "https://doi.org/10.5281/zenodo.1404173", + "author": [ + { + "family": "Marshall", + "given": "Michael" + } + ], + "issued": { + "date-parts": [ + [ + 2018, + 8, + 27 + ] + ] + }, + "abstract": "<strong>Data Set Characteristics:</strong>\n\nNumber of Instances:\n150 (50 in each of three classes)\nNumber of Attributes:\n\n4 numeric, predictive attributes and the class\nAttribute Information:\n\n\n\tsepal length in cm\n\tsepal width in cm\n\tpetal length in cm\n\tpetal width in cm\n\t\n\tclass:\n\n\t\n\t\tIris-Setosa\n\t\tIris-Versicolour\n\t\tIris-Virginica", + "DOI": "10.5281/ZENODO.1404173", + "publisher": "Zenodo", + "title": "Scikit-Learn Iris", + "URL": "https://zenodo.org/record/1404173", + "copyright": "Creative Commons Attribution 4.0" +} \ No newline at end of file diff --git a/dbrepo-metadata-service/rest-service/src/test/resources/doi/journal-article.json b/dbrepo-metadata-service/rest-service/src/test/resources/doi/journal-article.json new file mode 100644 index 0000000000000000000000000000000000000000..627ca16767f318b4ab261299b9f5bc15b3962b7a --- /dev/null +++ b/dbrepo-metadata-service/rest-service/src/test/resources/doi/journal-article.json @@ -0,0 +1,403 @@ +{ + "indexed": { + "date-parts": [ + [ + 2024, + 7, + 1 + ] + ], + "date-time": "2024-07-01T09:15:12Z", + "timestamp": 1719825312147 + }, + "reference-count": 37, + "publisher": "Ubiquity Press, Ltd.", + "content-domain": { + "domain": [], + "crossmark-restriction": false + }, + "published-print": { + "date-parts": [ + [ + 2022, + 2, + 9 + ] + ] + }, + "DOI": "10.5334\/dsj-2022-004", + "type": "journal-article", + "created": { + "date-parts": [ + [ + 2022, + 2, + 9 + ] + ], + "date-time": "2022-02-09T11:11:20Z", + "timestamp": 1644405080000 + }, + "source": "Crossref", + "is-referenced-by-count": 5, + "title": "OSSDIP: Open Source Secure Data Infrastructure and Processes Supporting Data Visiting", + "prefix": "10.5334", + "volume": "21", + "author": [ + { + "ORCID": "http:\/\/orcid.org\/0000-0003-4216-302X", + "authenticated-orcid": false, + "given": "Martin", + "family": "Weise", + "sequence": "first", + "affiliation": [] + }, + { + "ORCID": "http:\/\/orcid.org\/0000-0002-2854-0434", + "authenticated-orcid": false, + "given": "Filip", + "family": "Kovacevic", + "sequence": "additional", + "affiliation": [] + }, + { + "ORCID": "http:\/\/orcid.org\/0000-0003-4615-2774", + "authenticated-orcid": false, + "given": "Nikolas", + "family": "Popper", + "sequence": "additional", + "affiliation": [] + }, + { + "ORCID": "http:\/\/orcid.org\/0000-0002-9272-6225", + "authenticated-orcid": false, + "given": "Andreas", + "family": "Rauber", + "sequence": "additional", + "affiliation": [] + } + ], + "member": "3285", + "reference": [ + { + "key": "key20220209060905_B1", + "volume-title": "Defenders\u2019 Guide to Container Infrastructure Security", + "year": "2019" + }, + { + "issue": "2", + "key": "key20220209060905_B2", + "first-page": "315", + "article-title": "20 remoteneps: Data Dissemination in a Collaborative Workspace", + "volume": "14", + "year": "2011", + "journal-title": "Zeitschrift f\u00fcr Erziehungswissenschaft" + }, + { + "issue": "1", + "key": "key20220209060905_B3", + "article-title": "Kadi4Mat: A Research Data Infrastructure for Materials Science", + "volume": "20", + "year": "2021", + "journal-title": "Data Science Journal" + }, + { + "issue": "1", + "key": "key20220209060905_B4", + "doi-asserted-by": "crossref", + "first-page": "195", + "DOI": "10.1055\/s-0039-1677917", + "article-title": "The French Health Data Hub and the German Medical Informatics Initiatives: Two National Projects to Promote Data Sharing in Healthcare", + "volume": "28", + "year": "2019", + "journal-title": "EN. Yearbook of Medical Informatics" + }, + { + "key": "key20220209060905_B5", + "article-title": "Five Safes: Designing data access for research [Online]", + "year": "2016", + "journal-title": "Economics Working Paper Series 1601" + }, + { + "key": "key20220209060905_B6", + "article-title": "Remote Access to Official Microdata", + "year": "2020" + }, + { + "key": "key20220209060905_B7", + "first-page": "554", + "article-title": "Role-Based Access Controls", + "year": "1992" + }, + { + "key": "key20220209060905_B8", + "article-title": "De-identification of personal information", + "year": "2015", + "journal-title": "National institute of standards and technology" + }, + { + "key": "key20220209060905_B9", + "first-page": "16", + "article-title": "Secure cloud computing with a virtualized network infrastructure", + "year": "2010" + }, + { + "key": "key20220209060905_B10", + "doi-asserted-by": "crossref", + "first-page": "196", + "DOI": "10.1016\/j.jbi.2014.01.003", + "article-title": "A case study of the Secure Anonymous Information Linkage (SAIL) Gateway: A privacy-protecting remote access system for health-related research and evaluation", + "volume": "50", + "year": "2014", + "journal-title": "Journal of Biomedical Informatics" + }, + { + "issue": "4", + "key": "key20220209060905_B11", + "doi-asserted-by": "crossref", + "first-page": "533", + "DOI": "10.1016\/j.giq.2010.10.008", + "article-title": "Key Issues in Data Center Security: An Investigation of Government Audit Reports", + "volume": "28", + "year": "2011", + "journal-title": "Government Information Quarterly" + }, + { + "issue": "5", + "key": "key20220209060905_B12", + "doi-asserted-by": "crossref", + "first-page": "38", + "DOI": "10.1109\/MSEC.2020.2990230", + "article-title": "Dedicated Security Chips in the Age of Secure Enclaves", + "volume": "18", + "year": "2020", + "journal-title": "IEEE Security & Privacy" + }, + { + "issue": "3", + "key": "key20220209060905_B13", + "first-page": "34", + "volume": "41", + "year": "2012", + "journal-title": "Temporal Features in SQL:2011" + }, + { + "issue": "4", + "key": "key20220209060905_B14", + "article-title": "Watermill: An Optimized Fingerprinting System for Databases under Constraints", + "volume": "20", + "year": "2008", + "journal-title": "IEEE Transactions on Knowledge and Data Engineering" + }, + { + "key": "key20220209060905_B15", + "article-title": "Keystone: An Open Framework for Architecting Trusted Execution Environments", + "year": "2020" + }, + { + "key": "key20220209060905_B16", + "first-page": "106", + "article-title": "T-closeness: privacy beyond k-anonymity and l-diversity", + "year": "2007" + }, + { + "issue": "1", + "key": "key20220209060905_B17", + "article-title": "Fingerprinting Relational Databases: Schemes and Specialties", + "volume": "2", + "year": "2005", + "journal-title": "Transactions on Dependable and Secure Computing" + }, + { + "issue": "1", + "key": "key20220209060905_B18", + "doi-asserted-by": "crossref", + "first-page": "3", + "DOI": "10.1145\/1217299.1217302", + "article-title": "L-diversity: privacy beyond k-anonymity", + "volume": "1", + "year": "2007", + "journal-title": "Acm transactions on knowledge discovery from data (tkdd)" + }, + { + "key": "key20220209060905_B19", + "first-page": "1", + "article-title": "Database security threats and challenges", + "year": "2020" + }, + { + "key": "key20220209060905_B20", + "article-title": "Data grid concepts for data security in distributed computing", + "year": "2013", + "journal-title": "Arxiv preprint arxiv:1308.6058" + }, + { + "key": "key20220209060905_B21", + "volume-title": "A vision of a Nordic secure digital infrastructure for health data: The Nordic Commons", + "year": "2019" + }, + { + "key": "key20220209060905_B22", + "unstructured": "Peisert, S. 2021. An Examination and Survey of Data Confidentiality Issues and Solutions in Academic Research Computing. https:\/\/escholarship.org\/uc\/item\/7cz7m1ws. Online; accessed 22 December 2021." + }, + { + "key": "key20220209060905_B23", + "first-page": "561", + "article-title": "Real-Time Screen Watermarking Using Overlaying Layer", + "year": "2014", + "journal-title": "2014 Ninth International Conference on Availability, Reliability and Security" + }, + { + "issue": "4", + "key": "key20220209060905_B24", + "doi-asserted-by": "crossref", + "first-page": "203", + "DOI": "10.11128\/sne.27.tn.10396", + "article-title": "Planning Future Health: Developing Big Data and System Modelling Pipelines for Health System Research", + "volume": "27", + "year": "2017", + "journal-title": "Simulation Notes Europe" + }, + { + "key": "key20220209060905_B25", + "first-page": "231", + "article-title": "Preventing Privilege Escalation", + "year": "2003" + }, + { + "key": "key20220209060905_B26", + "year": "2015", + "journal-title": "Data Citation of Evolving Data: Recommendations of the Working Group on Data Citation (WGDC)" + }, + { + "issue": "1", + "key": "key20220209060905_B27", + "article-title": "Identification of Reproducible Subsets for Data Citation, Sharing and Re-Use", + "volume": "12", + "year": "2016", + "journal-title": "Bulletin of the IEEE Technical Committe on Digital Libraries (TCDL)" + }, + { + "key": "key20220209060905_B28", + "first-page": "199", + "article-title": "Hey, you, get off of my cloud: exploring information leakage in third-party compute clouds", + "year": "2009" + }, + { + "key": "key20220209060905_B29", + "doi-asserted-by": "crossref", + "first-page": "221", + "DOI": "10.1109\/SERVICES.2015.40", + "volume-title": "2015 IEEE world congress on services", + "year": "2015" + }, + { + "key": "key20220209060905_B30", + "doi-asserted-by": "crossref", + "first-page": "611", + "DOI": "10.1007\/978-3-658-11994-2_34", + "volume-title": "Methodological Issues of Longitudinal Surveys: The Example of the National Educational Panel Study", + "year": "2016" + }, + { + "key": "key20220209060905_B31", + "first-page": "1", + "article-title": "A collective attestation scheme towards cloud system", + "year": "2020", + "journal-title": "Cluster computing" + }, + { + "issue": "5", + "key": "key20220209060905_B32", + "doi-asserted-by": "crossref", + "first-page": "557", + "DOI": "10.1142\/S0218488502001648", + "article-title": "K-anonymity: a model for protecting privacy", + "volume": "10", + "year": "2002", + "journal-title": "International journal of uncertainty, fuzziness and knowledge-based systems" + }, + { + "key": "key20220209060905_B33", + "unstructured": "United Kingdom Health Data Research Alliance. 2020. Trusted Research Environments [Online]. URL: https:\/\/ukhealthdata.org\/projects\/aligning-approach-to-trusted-research-environments\/. Accessed September 2020. Version 2.0." + }, + { + "key": "key20220209060905_B34", + "first-page": "34", + "article-title": "FDA-DBRepo: A Data Preservation Repository Supporting FAIR Principles, Data Versioning and Reproducible Queries", + "year": "2021" + }, + { + "key": "key20220209060905_B35", + "first-page": "51", + "article-title": "A Data-Visiting Infrastructure for Providing Access to Preserved Databases that Cannot be Shared or Made Publicly Accessible", + "year": "2021" + }, + { + "key": "key20220209060905_B36", + "article-title": "OpenSAFELY: factors associated with COVID-19-related hospital death in the linked electronic health records of 17 million adult NHS patients", + "year": "2020", + "journal-title": "Medrxiv" + }, + { + "key": "key20220209060905_B37", + "first-page": "305", + "article-title": "Cross-vm side channels and their use to extract private keys", + "year": "2012" + } + ], + "container-title": "Data Science Journal", + "original-title": [], + "language": "en", + "link": [ + { + "URL": "https:\/\/doi.org\/10.5334\/dsj-2022-004", + "content-type": "unspecified", + "content-version": "vor", + "intended-application": "similarity-checking" + } + ], + "deposited": { + "date-parts": [ + [ + 2022, + 7, + 11 + ] + ], + "date-time": "2022-07-11T09:21:08Z", + "timestamp": 1657531268000 + }, + "score": 1, + "resource": { + "primary": { + "URL": "http:\/\/datascience.codata.org\/articles\/10.5334\/dsj-2022-004\/" + } + }, + "subtitle": [], + "short-title": [], + "issued": { + "date-parts": [ + [ + 2022 + ] + ] + }, + "references-count": 37, + "alternative-id": [ + "10.5334\/dsj-2022-004" + ], + "URL": "http:\/\/dx.doi.org\/10.5334\/dsj-2022-004", + "relation": {}, + "ISSN": [ + "1683-1470" + ], + "subject": [], + "published": { + "date-parts": [ + [ + 2022 + ] + ] + } +} \ No newline at end of file diff --git a/dbrepo-metadata-service/rest-service/src/test/resources/doi/proceedings-article.json b/dbrepo-metadata-service/rest-service/src/test/resources/doi/proceedings-article.json new file mode 100644 index 0000000000000000000000000000000000000000..429179549a955721b9a23d98073d41b36ff6a657 --- /dev/null +++ b/dbrepo-metadata-service/rest-service/src/test/resources/doi/proceedings-article.json @@ -0,0 +1,320 @@ +{ + "indexed": { + "date-parts": [ + [ + 2025, + 1, + 18 + ] + ], + "date-time": "2025-01-18T05:07:56Z", + "timestamp": 1737176876420, + "version": "3.33.0" + }, + "reference-count": 28, + "publisher": "IEEE", + "license": [ + { + "start": { + "date-parts": [ + [ + 2024, + 12, + 15 + ] + ], + "date-time": "2024-12-15T00:00:00Z", + "timestamp": 1734220800000 + }, + "content-version": "stm-asf", + "delay-in-days": 0, + "URL": "https:\/\/doi.org\/10.15223\/policy-029" + }, + { + "start": { + "date-parts": [ + [ + 2024, + 12, + 15 + ] + ], + "date-time": "2024-12-15T00:00:00Z", + "timestamp": 1734220800000 + }, + "content-version": "stm-asf", + "delay-in-days": 0, + "URL": "https:\/\/doi.org\/10.15223\/policy-037" + } + ], + "funder": [ + { + "DOI": "10.13039\/100016234", + "name": "ASEAN-European Academic University Network", + "doi-asserted-by": "publisher", + "id": [ + { + "id": "10.13039\/100016234", + "id-type": "DOI", + "asserted-by": "publisher" + } + ] + } + ], + "content-domain": { + "domain": [], + "crossmark-restriction": false + }, + "published-print": { + "date-parts": [ + [ + 2024, + 12, + 15 + ] + ] + }, + "DOI": "10.1109\/bigdata62323.2024.10825401", + "type": "proceedings-article", + "created": { + "date-parts": [ + [ + 2025, + 1, + 16 + ] + ], + "date-time": "2025-01-16T18:31:23Z", + "timestamp": 1737052283000 + }, + "page": "322-331", + "source": "Crossref", + "is-referenced-by-count": 0, + "title": "DBRepo: A Data Repository System for Research Data in Databases", + "prefix": "10.1109", + "author": [ + { + "given": "Martin", + "family": "Weise", + "sequence": "first", + "affiliation": [ + { + "name": "ISE, TU Wien,Data Science Research Unit,Vienna,Austria" + } + ] + }, + { + "given": "Andreas", + "family": "Rauber", + "sequence": "additional", + "affiliation": [ + { + "name": "ISE, TU Wien,Data Science Research Unit,Vienna,Austria" + } + ] + } + ], + "member": "263", + "reference": [ + { + "key": "ref1", + "doi-asserted-by": "publisher", + "DOI": "10.1002\/0470867167.ch36" + }, + { + "key": "ref2", + "doi-asserted-by": "publisher", + "DOI": "10.2218\/ijdc.v17i1.825" + }, + { + "key": "ref3", + "doi-asserted-by": "publisher", + "DOI": "10.1145\/2380776.2380786" + }, + { + "key": "ref4", + "doi-asserted-by": "publisher", + "DOI": "10.1038\/sdata.2016.18" + }, + { + "year": "2024", + "key": "ref5", + "article-title": "DataCite Metadata Schema Documentation for the Publication and Citation of Research Data and Other Research Outputs v4.5" + }, + { + "article-title": "Digital Cartographic Standard for Geologic Map Symbolization", + "volume-title": "Tech. Rep.", + "year": "2006", + "key": "ref6" + }, + { + "article-title": "FAIR Digital Objects and FAIR Signposting", + "year": "2023", + "author": "Van de Sompel", + "key": "ref7" + }, + { + "key": "ref8", + "doi-asserted-by": "publisher", + "DOI": "10.1086\/666656" + }, + { + "key": "ref9", + "doi-asserted-by": "publisher", + "DOI": "10.1162\/99608f92.be565013" + }, + { + "key": "ref10", + "doi-asserted-by": "publisher", + "DOI": "10.1045\/january2003-smith" + }, + { + "key": "ref11", + "doi-asserted-by": "publisher", + "DOI": "10.1177\/0049124107306660" + }, + { + "key": "ref12", + "first-page": "157", + "article-title": "The Dryad Data Repository: a Singapore Framework metadata Architecture in a DSpace Environment", + "volume-title": "Proceedings of the 2008 International Conference on Dublin Core and Metadata Applications", + "author": "White" + }, + { + "key": "ref13", + "doi-asserted-by": "publisher", + "DOI": "10.5670\/oceanog.2014.50" + }, + { + "key": "ref14", + "doi-asserted-by": "publisher", + "DOI": "10.1109\/SOCA.2016.15" + }, + { + "key": "ref15", + "first-page": "83", + "article-title": "Introduction to Institutional Data Repositories Workshop", + "author": "Witt", + "year": "2008", + "journal-title": "Libraries Research Publications" + }, + { + "key": "ref16", + "doi-asserted-by": "publisher", + "DOI": "10.1109\/ICDE.2018.00098" + }, + { + "key": "ref17", + "doi-asserted-by": "publisher", + "DOI": "10.1145\/2737924.2737959" + }, + { + "key": "ref18", + "doi-asserted-by": "publisher", + "DOI": "10.1109\/ICoDSE56892.2022.9971958" + }, + { + "key": "ref19", + "doi-asserted-by": "publisher", + "DOI": "10.1016\/j.promfg.2019.03.032" + }, + { + "key": "ref20", + "doi-asserted-by": "publisher", + "DOI": "10.1016\/j.trpro.2023.11.866" + }, + { + "volume-title": "Emissionstrends 1990-2022", + "year": "2024", + "author": "Anderl", + "key": "ref21" + }, + { + "key": "ref22", + "doi-asserted-by": "publisher", + "DOI": "10.1109\/TVCG.2018.2864903" + }, + { + "key": "ref23", + "doi-asserted-by": "publisher", + "DOI": "10.1016\/j.scitotenv.2016.06.235" + }, + { + "key": "ref24", + "doi-asserted-by": "publisher", + "DOI": "10.1186\/s12302-024-00862-4" + }, + { + "key": "ref25", + "doi-asserted-by": "publisher", + "DOI": "10.1038\/533452a" + }, + { + "key": "ref26", + "doi-asserted-by": "publisher", + "DOI": "10.18653\/v1\/2024.findings-acl.137" + }, + { + "author": "Altug", + "key": "ref27", + "article-title": "Generating Semantic Context for Data Interoperability in Relational Databases using bge M3-Embeddings" + }, + { + "key": "ref28", + "doi-asserted-by": "publisher", + "DOI": "10.1186\/s13643-019-1250-y" + } + ], + "event": "2024 IEEE International Conference on Big Data (BigData)", + "container-title": "2024 IEEE International Conference on Big Data (BigData)", + "original-title": [], + "link": [ + { + "URL": "http:\/\/xplorestaging.ieee.org\/ielx8\/10824975\/10824942\/10825401.pdf?arnumber=10825401", + "content-type": "unspecified", + "content-version": "vor", + "intended-application": "similarity-checking" + } + ], + "deposited": { + "date-parts": [ + [ + 2025, + 1, + 17 + ] + ], + "date-time": "2025-01-17T07:55:27Z", + "timestamp": 1737100527000 + }, + "score": 1, + "resource": { + "primary": { + "URL": "https:\/\/ieeexplore.ieee.org\/document\/10825401\/" + } + }, + "subtitle": [], + "short-title": [], + "issued": { + "date-parts": [ + [ + 2024, + 12, + 15 + ] + ] + }, + "references-count": 28, + "URL": "http:\/\/dx.doi.org\/10.1109\/BigData62323.2024.10825401", + "relation": {}, + "subject": [], + "published": { + "date-parts": [ + [ + 2024, + 12, + 15 + ] + ] + } +} \ No newline at end of file diff --git a/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/config/GatewayConfig.java b/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/config/GatewayConfig.java index 3fe7f59c777db4662df39cb336894718e1e78234..a7f99926509ddad057edabd5671eb4da0adfc0d7 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/config/GatewayConfig.java +++ b/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/config/GatewayConfig.java @@ -36,6 +36,9 @@ public class GatewayConfig { @Value("${dbrepo.endpoints.crossRefService}") private String crossRefEndpoint; + @Value("${dbrepo.endpoints.doiService}") + private String doiEndpoint; + @Value("${spring.rabbitmq.username}") private String brokerUsername; @@ -101,4 +104,18 @@ public class GatewayConfig { return restTemplate; } + @Bean("doiServiceRestTemplate") + public RestTemplate doiServiceRestTemplate() { + final RestTemplate restTemplate = new RestTemplate(); + restTemplate.setUriTemplateHandler(new DefaultUriBuilderFactory(doiEndpoint)); + return restTemplate; + } + + @Bean("crossRefServiceRestTemplate") + public RestTemplate crossRefServiceRestTemplate() { + final RestTemplate restTemplate = new RestTemplate(); + restTemplate.setUriTemplateHandler(new DefaultUriBuilderFactory(crossRefEndpoint)); + return restTemplate; + } + } diff --git a/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossrefGateway.java b/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossRefGateway.java similarity index 72% rename from dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossrefGateway.java rename to dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossRefGateway.java index 07e4c5b1e22686a41f218fb70becffc34e55d485..83b04468279715a754f68a2d53a15c37dddd3d46 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossrefGateway.java +++ b/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/CrossRefGateway.java @@ -1,9 +1,9 @@ package at.ac.tuwien.ifs.dbrepo.gateway; -import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossrefDto; +import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossRefDto; import at.ac.tuwien.ifs.dbrepo.core.exception.DoiNotFoundException; -public interface CrossrefGateway { +public interface CrossRefGateway { /** * Retrieves metadata from the CrossRef funder database for a given CrossRef id. @@ -12,5 +12,5 @@ public interface CrossrefGateway { * @return The CrossRef metadata from the CrossRef funder database. * @throws DoiNotFoundException The metadata was not found in the CrossRef funder database. */ - CrossrefDto findById(String id) throws DoiNotFoundException; + CrossRefDto findById(String id) throws DoiNotFoundException; } diff --git a/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/impl/CrossrefGatewayImpl.java b/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/impl/CrossRefGatewayImpl.java similarity index 72% rename from dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/impl/CrossrefGatewayImpl.java rename to dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/impl/CrossRefGatewayImpl.java index e718c388b49b99b80374afe63f65c6f1fc505ec4..559f3b7657efc8ce1a891d628034914e5dfa2632 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/impl/CrossrefGatewayImpl.java +++ b/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/gateway/impl/CrossRefGatewayImpl.java @@ -1,11 +1,12 @@ package at.ac.tuwien.ifs.dbrepo.gateway.impl; -import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossrefDto; import at.ac.tuwien.ifs.dbrepo.config.GatewayConfig; +import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossRefDto; import at.ac.tuwien.ifs.dbrepo.core.exception.DoiNotFoundException; -import at.ac.tuwien.ifs.dbrepo.gateway.CrossrefGateway; +import at.ac.tuwien.ifs.dbrepo.gateway.CrossRefGateway; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; @@ -15,24 +16,25 @@ import org.springframework.web.client.RestTemplate; @Log4j2 @Service -public class CrossrefGatewayImpl implements CrossrefGateway { +public class CrossRefGatewayImpl implements CrossRefGateway { private final RestTemplate restTemplate; private final GatewayConfig gatewayConfig; @Autowired - public CrossrefGatewayImpl(RestTemplate restTemplate, GatewayConfig gatewayConfig) { + public CrossRefGatewayImpl(@Qualifier("crossRefServiceRestTemplate") RestTemplate restTemplate, + GatewayConfig gatewayConfig) { this.restTemplate = restTemplate; this.gatewayConfig = gatewayConfig; } @Override - public CrossrefDto findById(String id) throws DoiNotFoundException { + public CrossRefDto findById(String id) throws DoiNotFoundException { final String path = "/fundingdata/funder/" + id; log.trace("find crossref metadata by id from endpoint {} with path {}", gatewayConfig.getCrossRefEndpoint(), path); - final ResponseEntity<CrossrefDto> response; + final ResponseEntity<CrossRefDto> response; try { - response = restTemplate.exchange(gatewayConfig.getCrossRefEndpoint() + path, HttpMethod.GET, HttpEntity.EMPTY, CrossrefDto.class); + response = restTemplate.exchange(gatewayConfig.getCrossRefEndpoint() + path, HttpMethod.GET, HttpEntity.EMPTY, CrossRefDto.class); } catch (HttpServerErrorException e) { log.error("Failed to retrieve crossref metadata: {}", e.getMessage()); throw new DoiNotFoundException("Failed to retrieve crossref metadata: " + e.getMessage(), e); diff --git a/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/service/impl/MetadataServiceImpl.java b/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/service/impl/MetadataServiceImpl.java index b4aa80fca3480276a35b37a3ee9a2e173c671a36..1c4376184a2a12f034440d5de46030c5abd4dd14 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/service/impl/MetadataServiceImpl.java +++ b/dbrepo-metadata-service/services/src/main/java/at/ac/tuwien/ifs/dbrepo/service/impl/MetadataServiceImpl.java @@ -1,14 +1,14 @@ package at.ac.tuwien.ifs.dbrepo.service.impl; -import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossrefDto; +import at.ac.tuwien.ifs.dbrepo.config.MetadataConfig; +import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossRefDto; import at.ac.tuwien.ifs.dbrepo.core.api.orcid.OrcidDto; import at.ac.tuwien.ifs.dbrepo.core.api.ror.RorDto; import at.ac.tuwien.ifs.dbrepo.core.api.user.external.ExternalMetadataDto; -import at.ac.tuwien.ifs.dbrepo.config.MetadataConfig; import at.ac.tuwien.ifs.dbrepo.core.entity.identifier.Identifier; import at.ac.tuwien.ifs.dbrepo.core.exception.*; import at.ac.tuwien.ifs.dbrepo.core.mapper.MetadataMapper; -import at.ac.tuwien.ifs.dbrepo.gateway.CrossrefGateway; +import at.ac.tuwien.ifs.dbrepo.gateway.CrossRefGateway; import at.ac.tuwien.ifs.dbrepo.gateway.OrcidGateway; import at.ac.tuwien.ifs.dbrepo.gateway.RorGateway; import at.ac.tuwien.ifs.dbrepo.oaipmh.OaiErrorType; @@ -39,21 +39,21 @@ public class MetadataServiceImpl implements MetadataService { private final MetadataConfig metadataConfig; private final MetadataMapper metadataMapper; private final TemplateEngine templateEngine; - private final CrossrefGateway crossrefGateway; + private final CrossRefGateway crossRefGateway; private final IdentifierService identifierService; private final IdentifierRepository identifierRepository; @Autowired public MetadataServiceImpl(RorGateway rorGateway, OrcidGateway orcidGateway, MetadataConfig metadataConfig, MetadataMapper metadataMapper, TemplateEngine templateEngine, - CrossrefGateway crossrefGateway, IdentifierService identifierService, + CrossRefGateway crossRefGateway, IdentifierService identifierService, IdentifierRepository identifierRepository) { this.rorGateway = rorGateway; this.orcidGateway = orcidGateway; this.metadataConfig = metadataConfig; this.metadataMapper = metadataMapper; this.templateEngine = templateEngine; - this.crossrefGateway = crossrefGateway; + this.crossRefGateway = crossRefGateway; this.identifierService = identifierService; this.identifierRepository = identifierRepository; } @@ -177,7 +177,7 @@ public class MetadataServiceImpl implements MetadataService { throw new RorNotFoundException("Failed to find metadata from CrossRef URL: too short"); } final String id = url.substring(idx + 8); - final CrossrefDto crossrefDto = crossrefGateway.findById(id); + final CrossRefDto crossrefDto = crossRefGateway.findById(id); return metadataMapper.crossrefDtoToExternalMetadataDto(crossrefDto); } log.error("Failed to find metadata: unsupported identifier {}", url); diff --git a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/CrossrefDto.java b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/CrossRefDto.java similarity index 73% rename from lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/CrossrefDto.java rename to lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/CrossRefDto.java index cd4afbb46359b32356c2ca434843dc5ca1934e94..f32d2d412508df48a7b1677ee6f562020e43f4bc 100644 --- a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/CrossrefDto.java +++ b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/CrossRefDto.java @@ -1,6 +1,6 @@ package at.ac.tuwien.ifs.dbrepo.core.api.crossref; -import at.ac.tuwien.ifs.dbrepo.core.api.crossref.label.CrossrefPrefLabelDto; +import at.ac.tuwien.ifs.dbrepo.core.api.crossref.label.CrossRefPrefLabelDto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -13,11 +13,11 @@ import lombok.extern.jackson.Jacksonized; @AllArgsConstructor @Jacksonized @ToString -public class CrossrefDto { +public class CrossRefDto { @Schema(example = "https://doi.org/10.13039/100000001") private String id; - private CrossrefPrefLabelDto prefLabel; + private CrossRefPrefLabelDto prefLabel; } diff --git a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/form/CrossrefLiteralFormDto.java b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/form/CrossRefLiteralFormDto.java similarity index 91% rename from lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/form/CrossrefLiteralFormDto.java rename to lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/form/CrossRefLiteralFormDto.java index 060cb73885ec54bc91bb741940dea66a36a7c28f..473937a111be4a7611780cb5a2ea45315ccac588 100644 --- a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/form/CrossrefLiteralFormDto.java +++ b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/form/CrossRefLiteralFormDto.java @@ -12,7 +12,7 @@ import lombok.extern.jackson.Jacksonized; @AllArgsConstructor @Jacksonized @ToString -public class CrossrefLiteralFormDto { +public class CrossRefLiteralFormDto { @Schema(example = "en") private String lang; diff --git a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossrefLabelDto.java b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossRefLabelDto.java similarity index 73% rename from lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossrefLabelDto.java rename to lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossRefLabelDto.java index 5ee179f3282f2e0790c9d6aa19ec4af28e7bdd2b..684557115fa65da4104ba5cd9b703a1bfbeae211 100644 --- a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossrefLabelDto.java +++ b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossRefLabelDto.java @@ -1,6 +1,6 @@ package at.ac.tuwien.ifs.dbrepo.core.api.crossref.label; -import at.ac.tuwien.ifs.dbrepo.core.api.crossref.form.CrossrefLiteralFormDto; +import at.ac.tuwien.ifs.dbrepo.core.api.crossref.form.CrossRefLiteralFormDto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -13,9 +13,9 @@ import lombok.extern.jackson.Jacksonized; @AllArgsConstructor @Jacksonized @ToString -public class CrossrefLabelDto { +public class CrossRefLabelDto { - private CrossrefLiteralFormDto literalForm; + private CrossRefLiteralFormDto literalForm; @Schema(example = "http://data.crossref.org/fundingdata/vocabulary/Label-36515") private String about; diff --git a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossrefPrefLabelDto.java b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossRefPrefLabelDto.java similarity index 81% rename from lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossrefPrefLabelDto.java rename to lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossRefPrefLabelDto.java index b64b9785f393de857605e803c12af9b7abc3f731..0ec889622bc2cc99bf78807745bde0e767d74ed2 100644 --- a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossrefPrefLabelDto.java +++ b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/crossref/label/CrossRefPrefLabelDto.java @@ -12,9 +12,9 @@ import lombok.extern.jackson.Jacksonized; @AllArgsConstructor @Jacksonized @ToString -public class CrossrefPrefLabelDto { +public class CrossRefPrefLabelDto { @JsonProperty("Label") - private CrossrefLabelDto label; + private CrossRefLabelDto label; } diff --git a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/mapper/MetadataMapper.java b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/mapper/MetadataMapper.java index 3db28cc7d6eded32ee0f95c3637fe0fe4a93d2e0..e6c354e35ed31de22300fecb2a6b8abcefdd8101 100644 --- a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/mapper/MetadataMapper.java +++ b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/mapper/MetadataMapper.java @@ -7,7 +7,7 @@ import at.ac.tuwien.ifs.dbrepo.core.api.container.image.DataTypeDto; import at.ac.tuwien.ifs.dbrepo.core.api.container.image.ImageBriefDto; import at.ac.tuwien.ifs.dbrepo.core.api.container.image.ImageCreateDto; import at.ac.tuwien.ifs.dbrepo.core.api.container.image.ImageDto; -import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossrefDto; +import at.ac.tuwien.ifs.dbrepo.core.api.crossref.CrossRefDto; import at.ac.tuwien.ifs.dbrepo.core.api.database.*; import at.ac.tuwien.ifs.dbrepo.core.api.database.table.TableBriefDto; import at.ac.tuwien.ifs.dbrepo.core.api.database.table.TableDto; @@ -355,7 +355,7 @@ public interface MetadataMapper { .build(); } - default ExternalMetadataDto crossrefDtoToExternalMetadataDto(CrossrefDto data) { + default ExternalMetadataDto crossrefDtoToExternalMetadataDto(CrossRefDto data) { return ExternalMetadataDto.builder() .affiliations(new ExternalAffiliationDto[]{ ExternalAffiliationDto.builder()