Skip to content

Commit

Permalink
fix(merge): fixed unupdated functionalities
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Brunkow Moser committed May 6, 2024
1 parent ccbc8a2 commit 56ef97a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ public PassportConfig(String searchIdSchema, List<String> aspects, PolicyCheckCo
this.aspects = aspects;
this.policyCheck = policyCheck;
}
public PassportConfig(String searchIdSchema, List<String> aspects, String defaultIdType, PolicyCheckConfig policyCheck) {
this.searchIdSchema = searchIdSchema;
this.aspects = aspects;
this.policyCheck = policyCheck;
this.defaultIdType = defaultIdType;
}

public List<String> getAspects() {
return aspects;
Expand All @@ -79,20 +85,17 @@ public void setSearchIdSchema(String searchIdSchema) {
this.searchIdSchema = searchIdSchema;
}

<<<<<<< HEAD
public String getDefaultIdType() {
return defaultIdType;
}

public void setDefaultIdType(String defaultIdType) {
this.defaultIdType = defaultIdType;
=======
public PolicyCheckConfig getPolicyCheck() {
return policyCheck;
}

public void setPolicyCheck(PolicyCheckConfig policyCheck) {
this.policyCheck = policyCheck;
>>>>>>> 7481bbb80080db7831112bbee2b80b995d3ba0da
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
*
* Tractus-X - Digital Product Passport Application
*
* Copyright (c) 2022, 2024 BASF SE, BMW AG, Henkel AG & Co. KGaA
* Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
* Copyright (c) 2023, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
*
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
*
* Tractus-X - Digital Product Passport Application
*
* Copyright (c) 2022, 2024 BASF SE, BMW AG, Henkel AG & Co. KGaA
* Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
* Copyright (c) 2023, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
*
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
*
* Tractus-X - Digital Product Passport Application
*
* Copyright (c) 2022, 2024 BASF SE, BMW AG, Henkel AG & Co. KGaA
* Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
* Copyright (c) 2023, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
*
*
Expand Down Expand Up @@ -301,7 +302,7 @@ public Response searchCall(HttpServletRequest httpRequest, HttpServletResponse h
response = httpUtil.getBadRequest("The status is not available!");
return httpUtil.buildResponse(response, httpResponse);
}
assetSearch = aasService.decentralDtrSearch(process.id, searchBody);
assetSearch = aasService.decentralDtrSearch(process.id, searchBody);


if(assetSearch == null){
Expand Down Expand Up @@ -362,13 +363,16 @@ public Response searchCall(HttpServletRequest httpRequest, HttpServletResponse h
if(assetId == null){
LogUtil.printError("The assetId is empty!");
}
Catalog catalog = null;
Map<String, Dataset> datasets = null;
Long startedTime = DateTimeUtil.getTimestamp();
try {
datasets = dataService.getContractOffersByAssetId(assetId, connectorAddress);
catalog = dataService.getContractOfferCatalog(connectorAddress, assetId);
datasets = edcUtil.filterValidContracts(dataService.getContractOffers(catalog), this.passportConfig.getPolicyCheck());
} catch (ServiceException e) {
LogUtil.printError("The EDC is not reachable, it was not possible to retrieve catalog! Trying again...");
datasets = dataService.getContractOffersByAssetId(assetId, connectorAddress);
catalog = dataService.getContractOfferCatalog(connectorAddress, assetId);
datasets = edcUtil.filterValidContracts(dataService.getContractOffers(catalog), this.passportConfig.getPolicyCheck());
if (datasets == null) { // If the contract catalog is not reachable retry...
response.message = "The EDC is not reachable, it was not possible to retrieve catalog! Please try again!";
response.status = 502;
Expand All @@ -380,14 +384,16 @@ public Response searchCall(HttpServletRequest httpRequest, HttpServletResponse h
if (datasets == null) {
// Retry again...
LogUtil.printWarning("[PROCESS " + process.id + "] No asset id found for the dataset contract offers in the catalog! Requesting catalog again...");
datasets = dataService.getContractOffersByAssetId(assetId, connectorAddress);
catalog = dataService.getContractOfferCatalog(connectorAddress, assetId);
datasets = edcUtil.filterValidContracts(dataService.getContractOffers(catalog), this.passportConfig.getPolicyCheck());
if (datasets == null) { // If the contract catalog is not reachable retry...
response.message = "Asset Id not found in any contract!";
response.status = 404;
response.statusText = "Not Found";
return httpUtil.buildResponse(response, httpResponse);
}
}
processManager.setProviderBpn(processId, catalog.getParticipantId());
String seedId = String.join("|", datasets.keySet());
LogUtil.printDebug("[PROCESS " + process.id + "] ["+datasets.size()+"] Contracts found for asset [" + assetId + "] in EDC Endpoint [" + connectorAddress + "]");

Expand Down

0 comments on commit 56ef97a

Please sign in to comment.