Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: TRACEFOSS-2391 Adding delegation of getCatalog to EDCCatalog… #489

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Added fetchCatalog to EDCCatalogFacade

## [3.3.3] - 2023-08-11
### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.edc.catalog.spi.Catalog;
import org.eclipse.edc.catalog.spi.CatalogRequest;
import org.eclipse.edc.catalog.spi.Dataset;
import org.eclipse.edc.policy.model.Policy;
import org.eclipse.tractusx.irs.edc.client.configuration.JsonLdConfiguration;
import org.eclipse.tractusx.irs.edc.client.model.CatalogItem;

import org.springframework.stereotype.Component;

/**
Expand Down Expand Up @@ -74,6 +76,19 @@ private static CatalogItem createCatalogItem(final Catalog pageableCatalog, fina
return builder.build();
}

/**
* Fetches a list of {@link CatalogItem} objects based on the given {@link CatalogRequest}.
* This method communicates with the control plane client to retrieve the catalog
* and maps it to a list of catalog items.
*
* @param catalogRequest The request containing the parameters needed to fetch the catalog.
* @return A list of {@link CatalogItem} objects representing the items in the catalog.
*/
public List<CatalogItem> fetchCatalogItems(final CatalogRequest catalogRequest) {
final Catalog catalog = controlPlaneClient.getCatalog(catalogRequest);
return mapToCatalogItems(catalog);
}

private static List<CatalogItem> mapToCatalogItems(final Catalog catalog) {
if (catalog.getDatasets() == null) {
return List.of();
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<jar-plugin.version>3.3.0</jar-plugin.version>
<compiler-plugin.version>3.11.0</compiler-plugin.version>
<install-plugin.version>3.1.1</install-plugin.version>
<irs-registry-client.version>1.1.0-SNAPSHOT</irs-registry-client.version>
<irs-registry-client.version>1.1.1-SNAPSHOT</irs-registry-client.version>
</properties>

<dependencyManagement>
Expand Down