Skip to content

Commit

Permalink
fix: comments and comma
Browse files Browse the repository at this point in the history
  • Loading branch information
admy7 committed Aug 21, 2024
1 parent 5b23f51 commit 148b9bc
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0

package io.github.genomicdatainfrastructure.discovery.datasets.applications.ports;

import io.github.genomicdatainfrastructure.discovery.model.DatasetSearchQuery;

import java.util.List;

public interface DatasetIdsCollector {

List<String> collect(DatasetSearchQuery query, String accessToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
import java.util.List;

public interface DatasetsRepository {

List<SearchedDataset> search(List<String> datasetIds,
String sort,
Integer rows,
Integer start,
String accessToken);
String sort,
Integer rows,
Integer start,
String accessToken);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0

package io.github.genomicdatainfrastructure.discovery.datasets.applications.ports;

import io.github.genomicdatainfrastructure.discovery.model.DatasetSearchQuery;
import io.github.genomicdatainfrastructure.discovery.model.FacetGroup;

public interface FacetsBuilder {

FacetGroup buildFacets(DatasetSearchQuery query, String accessToken);
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0

package io.github.genomicdatainfrastructure.discovery.datasets.applications.usecases;

import io.github.genomicdatainfrastructure.discovery.datasets.applications.ports.DatasetIdsCollector;
import io.github.genomicdatainfrastructure.discovery.datasets.applications.ports.FacetsBuilder;
import io.github.genomicdatainfrastructure.discovery.model.DatasetSearchQuery;
import io.github.genomicdatainfrastructure.discovery.model.DatasetsSearchResponse;
import io.github.genomicdatainfrastructure.discovery.datasets.applications.ports.DatasetsRepository;
import lombok.RequiredArgsConstructor;

import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

@RequiredArgsConstructor
public class SearchDatasetsQuery {

private final DatasetsRepository repository;
private final Set<DatasetIdsCollector> collectors;
private final Set<FacetsBuilder> facetsBuilders;
Expand All @@ -26,10 +31,10 @@ public DatasetsSearchResponse execute(DatasetSearchQuery query, String accessTok
.orElse(List.of());

var datasets = repository.search(datasetIds,
query.getSort(),
query.getRows(),
query.getStart(),
accessToken);
query.getSort(),
query.getRows(),
query.getStart(),
accessToken);

var facetGroups = facetsBuilders
.stream()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0

package io.github.genomicdatainfrastructure.discovery.datasets.infra.beacon.auth;

import io.github.genomicdatainfrastructure.discovery.remote.keycloak.api.KeycloakQueryApi;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0

package io.github.genomicdatainfrastructure.discovery.datasets.infra.beacon.persistence;

import io.github.genomicdatainfrastructure.discovery.datasets.applications.ports.DatasetIdsCollector;
Expand Down Expand Up @@ -30,7 +34,8 @@ public class BeaconDatasetIdsCollector implements DatasetIdsCollector {
private final BeaconAuth beaconAuth;

@Inject
public BeaconDatasetIdsCollector(@RestClient BeaconQueryApi beaconQueryApi, BeaconAuth beaconAuth) {
public BeaconDatasetIdsCollector(@RestClient BeaconQueryApi beaconQueryApi,
BeaconAuth beaconAuth) {
this.beaconQueryApi = beaconQueryApi;
this.beaconAuth = beaconAuth;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0

package io.github.genomicdatainfrastructure.discovery.datasets.infra.beacon.persistence;

import io.github.genomicdatainfrastructure.discovery.datasets.applications.ports.FacetsBuilder;
Expand All @@ -8,6 +12,7 @@
import jakarta.inject.Inject;

public class BeaconFacetsBuilder implements FacetsBuilder {

private final BeaconFilteringTermsService service;
private final BeaconAuth beaconAuth;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0

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

import io.github.genomicdatainfrastructure.discovery.datasets.applications.ports.DatasetIdsCollector;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0

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

import io.github.genomicdatainfrastructure.discovery.model.*;
Expand Down Expand Up @@ -33,17 +37,17 @@ public class CkanDatasetsRepository implements DatasetsRepository {

@Inject
public CkanDatasetsRepository(
@RestClient CkanQueryApi ckanQueryApi,
@RestClient CkanQueryApi ckanQueryApi
) {
this.ckanQueryApi = ckanQueryApi;
}

@Override
public List<SearchedDataset> search(List<String> datasetIds,
String sort,
Integer rows,
Integer start,
String accessToken) {
String sort,
Integer rows,
Integer start,
String accessToken) {

var facets = datasetIds
.stream()
Expand All @@ -70,7 +74,6 @@ public List<SearchedDataset> search(List<String> datasetIds,
accessToken
);


return results(response.getResult());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0

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

import io.github.genomicdatainfrastructure.discovery.datasets.applications.ports.FacetsBuilder;
Expand All @@ -15,6 +19,7 @@

@ApplicationScoped
public class CkanFacetsBuilder implements FacetsBuilder {

private final static String CKAN_FACET_GROUP = "ckan";
private final static String SELECTED_FACETS = "[\"access_rights\",\"theme\",\"tags\",\"spatial_uri\",\"organization\",\"publisher_name\",\"res_format\"]";

Expand Down

0 comments on commit 148b9bc

Please sign in to comment.