From 431443f4aba2bf8d2bfc5164be5f83e23ea56765 Mon Sep 17 00:00:00 2001 From: Mark Janse Date: Tue, 13 Aug 2024 15:39:25 +0200 Subject: [PATCH 1/7] fix: compatibility of CKAN creator field with new scheming --- .../discovery/utils/PackageShowMapper.java | 2 +- src/main/openapi/ckan.yaml | 2 +- .../discovery/services/PackageShowMapperTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java b/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java index 5e5fbd8..6bd75a4 100644 --- a/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java +++ b/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java @@ -93,7 +93,7 @@ private ContactPoint contactPointEntry(CkanContactPoint value) { } private List creator(CkanPackage ckanPackage) { - return ofNullable(ckanPackage.getCreators()) + return ofNullable(ckanPackage.getCreator()) .orElseGet(List::of) .stream() .map(PackageShowMapper::creator) diff --git a/src/main/openapi/ckan.yaml b/src/main/openapi/ckan.yaml index ac47439..a87f02a 100644 --- a/src/main/openapi/ckan.yaml +++ b/src/main/openapi/ckan.yaml @@ -239,7 +239,7 @@ components: type: array items: $ref: "#/components/schemas/CkanContactPoint" - creators: + creator: type: array items: $ref: "#/components/schemas/CkanCreator" diff --git a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java index 713617c..fa36a3d 100644 --- a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java +++ b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java @@ -127,7 +127,7 @@ void can_parse() { .contactUri("http://example.com") .build() )) - .creators(List.of( + .creator(List.of( CkanCreator.builder() .creatorName("creatorName") .creatorIdentifier("creatorIdentifier") From 27925672fea99b103b57e511fdf59bd0693c57c4 Mon Sep 17 00:00:00 2001 From: Mark Janse Date: Tue, 13 Aug 2024 17:06:13 +0200 Subject: [PATCH 2/7] fix: contact point is now single valued again on CKAN side But we keep API compatible :) Note: tests still fail for the null case: ``` field/property 'contacts' differ: - actual value : [class ContactPoint { name: null email: null uri: null }] - expected value: [] ``` --- .../discovery/utils/PackageShowMapper.java | 24 ++--- src/main/openapi/ckan.yaml | 25 ++---- .../services/PackageShowMapperTest.java | 89 +++++++------------ 3 files changed, 47 insertions(+), 91 deletions(-) diff --git a/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java b/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java index 6bd75a4..5647005 100644 --- a/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java +++ b/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java @@ -42,7 +42,6 @@ public RetrievedDataset from(CkanPackage ckanPackage) { .modifiedAt(parse(ckanPackage.getMetadataModified())) .url(ckanPackage.getUrl()) .languages(values(ckanPackage.getLanguage())) - .contact(value(ckanPackage.getContactUri())) .creators(creator(ckanPackage)) .hasVersions(values(ckanPackage.getHasVersion())) .accessRights(value(ckanPackage.getAccessRights())) @@ -51,21 +50,12 @@ public RetrievedDataset from(CkanPackage ckanPackage) { .spatial(value(ckanPackage.getSpatialUri())) .distributions(distributions(ckanPackage)) .keywords(keywords(ckanPackage)) - .contacts(contactPoint(ckanPackage.getContactPoint())) + .contacts(contactPointEntry(ckanPackage)) .datasetRelationships(relations(ckanPackage.getDatasetRelationships())) .dataDictionary(dictionary(ckanPackage.getDataDictionary())) .build(); } - private List contactPoint(List values) { - return ofNullable(values) - .orElseGet(List::of) - .stream() - .filter(Objects::nonNull) - .map(PackageShowMapper::contactPointEntry) - .toList(); - } - private List relations(List values) { return ofNullable(values) .orElseGet(List::of) @@ -84,12 +74,12 @@ private List dictionary(List .toList(); } - private ContactPoint contactPointEntry(CkanContactPoint value) { - return ContactPoint.builder() - .name(value.getContactName()) - .email(value.getContactEmail()) - .uri(value.getContactUri()) - .build(); + private List contactPointEntry(CkanPackage ckanPackage) { + return List.of(ContactPoint.builder() + .name(ckanPackage.getContactName()) + .email(ckanPackage.getContactEmail()) + .uri(ckanPackage.getContactUri()) + .build()); } private List creator(CkanPackage ckanPackage) { diff --git a/src/main/openapi/ckan.yaml b/src/main/openapi/ckan.yaml index a87f02a..e910dd1 100644 --- a/src/main/openapi/ckan.yaml +++ b/src/main/openapi/ckan.yaml @@ -235,10 +235,6 @@ components: type: array items: $ref: "#/components/schemas/CkanTag" - contact_point: - type: array - items: - $ref: "#/components/schemas/CkanContactPoint" creator: type: array items: @@ -267,8 +263,15 @@ components: type: array items: $ref: "#/components/schemas/CkanValueLabel" + contact_name: + type: string + title: name + contact_email: + type: string + title: email contact_uri: type: string + title: uri has_version: type: array items: @@ -292,20 +295,6 @@ components: required: - id - title - CkanContactPoint: - properties: - contact_name: - type: string - title: name - contact_email: - type: string - title: email - contact_uri: - type: string - title: uri - required: - - name - - email CkanCreator: type: object properties: diff --git a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java index fa36a3d..a2723c9 100644 --- a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java +++ b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java @@ -5,7 +5,6 @@ package io.github.genomicdatainfrastructure.discovery.services; import io.github.genomicdatainfrastructure.discovery.model.*; -import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanContactPoint; import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanCreator; import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanDatasetDictionaryEntry; import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanDatasetRelationEntry; @@ -83,6 +82,8 @@ void can_parse() { .name("en") .build())) .contactUri("contactUri") + .contactEmail("contactEmail") + .contactName("contactName") .hasVersion(List.of( CkanValueLabel.builder() .displayName("version") @@ -114,37 +115,22 @@ void can_parse() { .uri("uri") .created("2024-03-19T13:37:05.472970") .lastModified("2024-03-19T13:37:05.472970") - .build() - )) - .contactPoint(List.of( - CkanContactPoint.builder() - .contactName("Contact 1") - .contactEmail("contact1@example.com") - .build(), - CkanContactPoint.builder() - .contactName("Contact 2") - .contactEmail("contact2@example.com") - .contactUri("http://example.com") - .build() - )) + .build())) .creator(List.of( CkanCreator.builder() .creatorName("creatorName") .creatorIdentifier("creatorIdentifier") - .build() - )) + .build())) .datasetRelationships(List.of( CkanDatasetRelationEntry.builder().target("Dataset 1").relation( "Relation 1").build(), CkanDatasetRelationEntry.builder().target("Dataset 2").relation( - "Relation 2").build() - )) + "Relation 2").build())) .dataDictionary(List.of( CkanDatasetDictionaryEntry.builder().name("Entry 1").type("Type 1") .description("Description 1").build(), CkanDatasetDictionaryEntry.builder().name("Entry 2").type("Type 2") - .description("Description 2").build() - )) + .description("Description 2").build())) .build(); var actual = PackageShowMapper.from(ckanPackage); @@ -157,8 +143,7 @@ void can_parse() { ValueLabel.builder() .value("theme-name") .label("theme") - .build() - )) + .build())) .publisherName("publisherName") .catalogue("organization") .createdAt(parse("2024-03-19T13:37:05.472970", DATE_FORMATTER)) @@ -168,24 +153,17 @@ void can_parse() { ValueLabel.builder() .value("en") .label("language") - .build() - )) - .contact(ValueLabel.builder() - .value("contactUri") - .label("contactUri") - .build()) + .build())) .hasVersions(List.of( ValueLabel.builder() .value("1") .label("version") - .build() - )) + .build())) .creators(List.of( ValueLabel.builder() .label("creatorName") .value("creatorIdentifier") - .build() - )) + .build())) .accessRights(ValueLabel.builder() .value("public") .label("accessRights") @@ -194,8 +172,7 @@ void can_parse() { ValueLabel.builder() .value("conforms") .label("conformsTo") - .build() - )) + .build())) .organization(DatasetOrganization .builder() .title("organization") @@ -221,33 +198,33 @@ void can_parse() { .label("format") .build()) .uri("uri") - .createdAt(parse("2024-03-19T13:37:05.472970", DATE_FORMATTER)) - .modifiedAt(parse("2024-03-19T13:37:05.472970", DATE_FORMATTER)) - .build() - )) + .createdAt(parse("2024-03-19T13:37:05.472970", + DATE_FORMATTER)) + .modifiedAt(parse("2024-03-19T13:37:05.472970", + DATE_FORMATTER)) + .build())) .contacts(List.of( ContactPoint.builder() - .name("Contact 1") - .email("contact1@example.com") - .build(), - ContactPoint.builder() - .name("Contact 2") - .email("contact2@example.com") - .uri("http://example.com") - .build() - )) + .name("contactName") + .email("contactEmail") + .uri("contactUri") + .build())) .datasetRelationships(List.of( - DatasetRelationEntry.builder().relation("Relation 1").target("Dataset 1") + DatasetRelationEntry.builder().relation("Relation 1") + .target("Dataset 1") .build(), - DatasetRelationEntry.builder().relation("Relation 2").target("Dataset 2") - .build() - )) + DatasetRelationEntry.builder().relation("Relation 2") + .target("Dataset 2") + .build())) .dataDictionary(List.of( - DatasetDictionaryEntry.builder().name("Entry 1").type("Type 1").description( - "Description 1").build(), - DatasetDictionaryEntry.builder().name("Entry 2").type("Type 2").description( - "Description 2").build() - )) + DatasetDictionaryEntry.builder().name("Entry 1").type("Type 1") + .description( + "Description 1") + .build(), + DatasetDictionaryEntry.builder().name("Entry 2").type("Type 2") + .description( + "Description 2") + .build())) .build(); assertThat(actual) From d492d167fd605ca20f1b8cbd04fae4a608658dac Mon Sep 17 00:00:00 2001 From: Mark Janse Date: Thu, 15 Aug 2024 08:54:46 +0200 Subject: [PATCH 3/7] Revert "fix: contact point is now single valued again on CKAN side" This reverts commit 27925672fea99b103b57e511fdf59bd0693c57c4. --- .../discovery/utils/PackageShowMapper.java | 24 +++-- src/main/openapi/ckan.yaml | 25 ++++-- .../services/PackageShowMapperTest.java | 89 ++++++++++++------- 3 files changed, 91 insertions(+), 47 deletions(-) diff --git a/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java b/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java index 5647005..6bd75a4 100644 --- a/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java +++ b/src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java @@ -42,6 +42,7 @@ public RetrievedDataset from(CkanPackage ckanPackage) { .modifiedAt(parse(ckanPackage.getMetadataModified())) .url(ckanPackage.getUrl()) .languages(values(ckanPackage.getLanguage())) + .contact(value(ckanPackage.getContactUri())) .creators(creator(ckanPackage)) .hasVersions(values(ckanPackage.getHasVersion())) .accessRights(value(ckanPackage.getAccessRights())) @@ -50,12 +51,21 @@ public RetrievedDataset from(CkanPackage ckanPackage) { .spatial(value(ckanPackage.getSpatialUri())) .distributions(distributions(ckanPackage)) .keywords(keywords(ckanPackage)) - .contacts(contactPointEntry(ckanPackage)) + .contacts(contactPoint(ckanPackage.getContactPoint())) .datasetRelationships(relations(ckanPackage.getDatasetRelationships())) .dataDictionary(dictionary(ckanPackage.getDataDictionary())) .build(); } + private List contactPoint(List values) { + return ofNullable(values) + .orElseGet(List::of) + .stream() + .filter(Objects::nonNull) + .map(PackageShowMapper::contactPointEntry) + .toList(); + } + private List relations(List values) { return ofNullable(values) .orElseGet(List::of) @@ -74,12 +84,12 @@ private List dictionary(List .toList(); } - private List contactPointEntry(CkanPackage ckanPackage) { - return List.of(ContactPoint.builder() - .name(ckanPackage.getContactName()) - .email(ckanPackage.getContactEmail()) - .uri(ckanPackage.getContactUri()) - .build()); + private ContactPoint contactPointEntry(CkanContactPoint value) { + return ContactPoint.builder() + .name(value.getContactName()) + .email(value.getContactEmail()) + .uri(value.getContactUri()) + .build(); } private List creator(CkanPackage ckanPackage) { diff --git a/src/main/openapi/ckan.yaml b/src/main/openapi/ckan.yaml index e910dd1..a87f02a 100644 --- a/src/main/openapi/ckan.yaml +++ b/src/main/openapi/ckan.yaml @@ -235,6 +235,10 @@ components: type: array items: $ref: "#/components/schemas/CkanTag" + contact_point: + type: array + items: + $ref: "#/components/schemas/CkanContactPoint" creator: type: array items: @@ -263,15 +267,8 @@ components: type: array items: $ref: "#/components/schemas/CkanValueLabel" - contact_name: - type: string - title: name - contact_email: - type: string - title: email contact_uri: type: string - title: uri has_version: type: array items: @@ -295,6 +292,20 @@ components: required: - id - title + CkanContactPoint: + properties: + contact_name: + type: string + title: name + contact_email: + type: string + title: email + contact_uri: + type: string + title: uri + required: + - name + - email CkanCreator: type: object properties: diff --git a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java index a2723c9..fa36a3d 100644 --- a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java +++ b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java @@ -5,6 +5,7 @@ package io.github.genomicdatainfrastructure.discovery.services; import io.github.genomicdatainfrastructure.discovery.model.*; +import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanContactPoint; import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanCreator; import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanDatasetDictionaryEntry; import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanDatasetRelationEntry; @@ -82,8 +83,6 @@ void can_parse() { .name("en") .build())) .contactUri("contactUri") - .contactEmail("contactEmail") - .contactName("contactName") .hasVersion(List.of( CkanValueLabel.builder() .displayName("version") @@ -115,22 +114,37 @@ void can_parse() { .uri("uri") .created("2024-03-19T13:37:05.472970") .lastModified("2024-03-19T13:37:05.472970") - .build())) + .build() + )) + .contactPoint(List.of( + CkanContactPoint.builder() + .contactName("Contact 1") + .contactEmail("contact1@example.com") + .build(), + CkanContactPoint.builder() + .contactName("Contact 2") + .contactEmail("contact2@example.com") + .contactUri("http://example.com") + .build() + )) .creator(List.of( CkanCreator.builder() .creatorName("creatorName") .creatorIdentifier("creatorIdentifier") - .build())) + .build() + )) .datasetRelationships(List.of( CkanDatasetRelationEntry.builder().target("Dataset 1").relation( "Relation 1").build(), CkanDatasetRelationEntry.builder().target("Dataset 2").relation( - "Relation 2").build())) + "Relation 2").build() + )) .dataDictionary(List.of( CkanDatasetDictionaryEntry.builder().name("Entry 1").type("Type 1") .description("Description 1").build(), CkanDatasetDictionaryEntry.builder().name("Entry 2").type("Type 2") - .description("Description 2").build())) + .description("Description 2").build() + )) .build(); var actual = PackageShowMapper.from(ckanPackage); @@ -143,7 +157,8 @@ void can_parse() { ValueLabel.builder() .value("theme-name") .label("theme") - .build())) + .build() + )) .publisherName("publisherName") .catalogue("organization") .createdAt(parse("2024-03-19T13:37:05.472970", DATE_FORMATTER)) @@ -153,17 +168,24 @@ void can_parse() { ValueLabel.builder() .value("en") .label("language") - .build())) + .build() + )) + .contact(ValueLabel.builder() + .value("contactUri") + .label("contactUri") + .build()) .hasVersions(List.of( ValueLabel.builder() .value("1") .label("version") - .build())) + .build() + )) .creators(List.of( ValueLabel.builder() .label("creatorName") .value("creatorIdentifier") - .build())) + .build() + )) .accessRights(ValueLabel.builder() .value("public") .label("accessRights") @@ -172,7 +194,8 @@ void can_parse() { ValueLabel.builder() .value("conforms") .label("conformsTo") - .build())) + .build() + )) .organization(DatasetOrganization .builder() .title("organization") @@ -198,33 +221,33 @@ void can_parse() { .label("format") .build()) .uri("uri") - .createdAt(parse("2024-03-19T13:37:05.472970", - DATE_FORMATTER)) - .modifiedAt(parse("2024-03-19T13:37:05.472970", - DATE_FORMATTER)) - .build())) + .createdAt(parse("2024-03-19T13:37:05.472970", DATE_FORMATTER)) + .modifiedAt(parse("2024-03-19T13:37:05.472970", DATE_FORMATTER)) + .build() + )) .contacts(List.of( ContactPoint.builder() - .name("contactName") - .email("contactEmail") - .uri("contactUri") - .build())) + .name("Contact 1") + .email("contact1@example.com") + .build(), + ContactPoint.builder() + .name("Contact 2") + .email("contact2@example.com") + .uri("http://example.com") + .build() + )) .datasetRelationships(List.of( - DatasetRelationEntry.builder().relation("Relation 1") - .target("Dataset 1") + DatasetRelationEntry.builder().relation("Relation 1").target("Dataset 1") .build(), - DatasetRelationEntry.builder().relation("Relation 2") - .target("Dataset 2") - .build())) + DatasetRelationEntry.builder().relation("Relation 2").target("Dataset 2") + .build() + )) .dataDictionary(List.of( - DatasetDictionaryEntry.builder().name("Entry 1").type("Type 1") - .description( - "Description 1") - .build(), - DatasetDictionaryEntry.builder().name("Entry 2").type("Type 2") - .description( - "Description 2") - .build())) + DatasetDictionaryEntry.builder().name("Entry 1").type("Type 1").description( + "Description 1").build(), + DatasetDictionaryEntry.builder().name("Entry 2").type("Type 2").description( + "Description 2").build() + )) .build(); assertThat(actual) From 1c5d93d29bb2615044d33eb0e024de0eabd79225 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 19 Aug 2024 07:03:26 +0000 Subject: [PATCH 4/7] chore(deps): update dependency org.apache.maven.plugins:maven-failsafe-plugin to v3.4.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fcda2d7..1434f9d 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ io.quarkus.platform 3.13.2 true - 3.3.1 + 3.4.0 3.3.1 1.3.3 0.8.12 From 47c4e30b1e665f6565652cc2cb50804813733745 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 20 Aug 2024 15:03:16 +0000 Subject: [PATCH 5/7] chore(deps): update quarkus.platform.version to v3.13.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fcda2d7..5e9cdb2 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 2.4.7 quarkus-bom io.quarkus.platform - 3.13.2 + 3.13.3 true 3.3.1 3.3.1 From 648370e7e7f2d3e27bc379810cb264911c9cc937 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 20 Aug 2024 19:03:02 +0000 Subject: [PATCH 6/7] chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.4.0 --- pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index c4050cd..a616e0e 100644 --- a/pom.xml +++ b/pom.xml @@ -20,8 +20,7 @@ io.quarkus.platform 3.13.3 true - 3.4.0 - 3.3.1 + 3.4.0 1.3.3 0.8.12 @@ -170,7 +169,7 @@ maven-failsafe-plugin - ${surefire-plugin.version} + ${surefire.version} From d72098be0a231111a10b469475e21eb669786dec Mon Sep 17 00:00:00 2001 From: Bruno Pacheco Date: Wed, 21 Aug 2024 21:29:18 +0200 Subject: [PATCH 7/7] chore: make ckan filters configurable --- .../BeaconDatasetsRepository.java | 21 ++++++++++++------- src/main/resources/application.properties | 2 ++ .../services/BeaconDatasetRepositoryTest.java | 5 +++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/main/java/io/github/genomicdatainfrastructure/discovery/repositories/BeaconDatasetsRepository.java b/src/main/java/io/github/genomicdatainfrastructure/discovery/repositories/BeaconDatasetsRepository.java index 90f37c4..d17164f 100644 --- a/src/main/java/io/github/genomicdatainfrastructure/discovery/repositories/BeaconDatasetsRepository.java +++ b/src/main/java/io/github/genomicdatainfrastructure/discovery/repositories/BeaconDatasetsRepository.java @@ -44,31 +44,38 @@ @ApplicationScoped public class BeaconDatasetsRepository implements DatasetsRepository { - private static final String SELECTED_FACETS = "[\"access_rights\",\"theme\",\"tags\",\"spatial_uri\",\"organization\",\"publisher_name\",\"res_format\"]"; - private final CkanQueryApi ckanQueryApi; + private static final String SELECTED_FACETS_PATTERN = "[\"%s\"]"; private static final Set SKIP_BEACON_QUERY_STATUS = Set.of(400, 401, 403); private static final String BEACON_ACCESS_TOKEN_INFO = "Skipping beacon search, user is not authorized or the token is invalid."; private static final String BEARER_PATTERN = "Bearer %s"; private static final String BEACON_DATASET_TYPE = "dataset"; private static final String CKAN_IDENTIFIER_FIELD = "identifier"; + + private final CkanQueryApi ckanQueryApi; private final BeaconQueryApi beaconQueryApi; - private final String beaconIdpAlias; private final KeycloakQueryApi keycloakQueryApi; private final BeaconFilteringTermsService beaconFilteringTermsService; + private final String beaconIdpAlias; + private final String selectedFacets; + @Inject public BeaconDatasetsRepository( @RestClient CkanQueryApi ckanQueryApi, @RestClient BeaconQueryApi beaconQueryApi, - @ConfigProperty(name = "quarkus.rest-client.keycloak_yaml.beacon_idp_alias") String beaconIdpAlias, @RestClient KeycloakQueryApi keycloakQueryApi, - BeaconFilteringTermsService beaconFilteringTermsService + BeaconFilteringTermsService beaconFilteringTermsService, + @ConfigProperty(name = "quarkus.rest-client.keycloak_yaml.beacon_idp_alias") String beaconIdpAlias, + @ConfigProperty(name = "datasets.filters") String datasetFiltersAsString ) { this.ckanQueryApi = ckanQueryApi; this.beaconQueryApi = beaconQueryApi; - this.beaconIdpAlias = beaconIdpAlias; this.keycloakQueryApi = keycloakQueryApi; this.beaconFilteringTermsService = beaconFilteringTermsService; + this.beaconIdpAlias = beaconIdpAlias; + this.selectedFacets = SELECTED_FACETS_PATTERN.formatted( + String.join("\",\"", datasetFiltersAsString.split(",")) + ); } @Override @@ -224,7 +231,7 @@ private DatasetsSearchResponse searchCkan(DatasetSearchQuery query, String ckanA query.getSort(), query.getRows(), query.getStart(), - SELECTED_FACETS, + selectedFacets, ckanAuthorization ); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 465f7c3..56225ec 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -43,6 +43,8 @@ quarkus.http.cors.methods=POST, OPTIONS, GET sources.beacon=true sources.ckan=false +datasets.filters=access_rights,theme,tags,organization,res_format + %dev.quarkus.oidc.auth-server-url=https://id.portal.dev.gdi.lu/realms/gdi %dev.quarkus.oidc.client-id=gdi %dev.quarkus.oidc.credentials.secret=dummy-secret diff --git a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetRepositoryTest.java b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetRepositoryTest.java index 8ce0d82..9f28073 100644 --- a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetRepositoryTest.java +++ b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetRepositoryTest.java @@ -54,9 +54,10 @@ void setUp() { underTest = new BeaconDatasetsRepository( ckanQueryApi, beaconQueryApi, - "beaconIdpAlias", keycloakQueryApi, - beaconFilteringTermsService + beaconFilteringTermsService, + "beaconIdpAlias", + "access_rights,theme,tags,organization,res_format" ); }