Skip to content

Commit

Permalink
merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
admy7 committed Aug 22, 2024
2 parents cfa843f + 1cda83a commit 37a6ea0
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 14 deletions.
7 changes: 3 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
<quarkus-openapi-generator.version>2.4.7</quarkus-openapi-generator.version>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.13.2</quarkus.platform.version>
<quarkus.platform.version>3.13.3</quarkus.platform.version>
<skipITs>true</skipITs>
<surefire-plugin.version>3.3.1</surefire-plugin.version>
<surefire.version>3.3.1</surefire.version>
<surefire.version>3.4.0</surefire.version>
<quarkus-wiremock.version>1.3.3</quarkus-wiremock.version>
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
</properties>
Expand Down Expand Up @@ -170,7 +169,7 @@
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<version>${surefire.version}</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public DatasetsSearchResponse execute(DatasetSearchQuery query, String accessTok
.orElse(List.of());

var datasets = repository.search(datasetIds,
query.getReturnFields(),
query.getSort(),
query.getRows(),
query.getStart(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0

package io.github.genomicdatainfrastructure.discovery.datasets.infra.ckan.config;

public class CkanConfiguration {
public static final String CKAN_IDENTIFIER_FIELD = "identifier";
public static final String CKAN_FACET_GROUP = "ckan";
public static final String CKAN_FACET_LABEL = "DCAT-AP";
public static final String SELECTED_FACETS = "[\"access_rights\",\"theme\",\"tags\",\"spatial_uri\",\"organization\",\"publisher_name\",\"res_format\"]";

public static final String CKAN_IDENTIFIER_FIELD = "identifier";
public static final String CKAN_FACET_GROUP = "ckan";
public static final String CKAN_FACET_LABEL = "DCAT-AP";
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.*;
import io.github.genomicdatainfrastructure.discovery.utils.CkanFacetsQueryBuilder;
import jakarta.enterprise.context.ApplicationScoped;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.eclipse.microprofile.rest.client.inject.RestClient;

import java.util.List;
Expand All @@ -21,11 +22,16 @@
@ApplicationScoped
public class CkanFacetsBuilder implements FacetsBuilder {

private static final String SELECTED_FACETS_PATTERN = "[\"%s\"]";

private final CkanQueryApi ckanQueryApi;
private final String selectedFacets;

public CkanFacetsBuilder(@RestClient CkanQueryApi ckanQueryApi) {
public CkanFacetsBuilder(@RestClient CkanQueryApi ckanQueryApi,
@ConfigProperty(name = "dataset.filters") String datasetFiltersAsString) {
this.ckanQueryApi = ckanQueryApi;
this.selectedFacets = SELECTED_FACETS_PATTERN.formatted(String.join("\",\"",
datasetFiltersAsString.split(",")));
}

@Override
Expand All @@ -35,11 +41,11 @@ public FacetGroup build(DatasetSearchQuery query, String accessToken) {
var response = ckanQueryApi.packageSearch(
query.getQuery(),
facetsQuery,
query.getFl(),
query.getReturnFields(),
query.getSort(),
0,
query.getStart(),
SELECTED_FACETS,
selectedFacets,
accessToken
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private ContactPoint contactPointEntry(CkanContactPoint value) {
}

private List<ValueLabel> creator(CkanPackage ckanPackage) {
return ofNullable(ckanPackage.getCreators())
return ofNullable(ckanPackage.getCreator())
.orElseGet(List::of)
.stream()
.map(PackageShowMapper::creator)
Expand Down
2 changes: 1 addition & 1 deletion src/main/openapi/ckan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ components:
type: array
items:
$ref: "#/components/schemas/CkanContactPoint"
creators:
creator:
type: array
items:
$ref: "#/components/schemas/CkanCreator"
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ quarkus.http.cors.methods=POST, OPTIONS, GET

sources.beacon=true

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void can_parse() {
.contactUri("http://example.com")
.build()
))
.creators(List.of(
.creator(List.of(
CkanCreator.builder()
.creatorName("creatorName")
.creatorIdentifier("creatorIdentifier")
Expand Down

0 comments on commit 37a6ea0

Please sign in to comment.