-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Data Offer & Connector Detail Page (#157)
* feat: dataOfferDetailPage * feat: connectorDetailPage * feat: detail pages * feat: detail pages * feat: detail pages * test: detail pages * refactor: minor refactorings * refactor: minor refactorings * refactor: minor test refactorings * refactor: minor test refactorings * refactor: minor test refactorings * refactor: minor test refactorings * refactor: DataOfferDetailPageQueryService * refactor: DataOfferDetailPageQueryService * refactor: DataOfferDetailPageQueryService * refactor: changed models slightly, improved tests --------- Co-authored-by: Tim Berthold <[email protected]> Co-authored-by: Tim Berthold <[email protected]>
- Loading branch information
1 parent
b4b394e
commit d8a3d91
Showing
18 changed files
with
539 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...in/java/de/sovity/edc/ext/brokerserver/dao/pages/catalog/models/DataOfferListEntryRs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2023 sovity GmbH | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* sovity GmbH - initial API and implementation | ||
* | ||
*/ | ||
|
||
package de.sovity.edc.ext.brokerserver.dao.pages.catalog.models; | ||
|
||
import de.sovity.edc.ext.brokerserver.dao.pages.dataoffer.model.ContractOfferRs; | ||
import de.sovity.edc.ext.brokerserver.db.jooq.enums.ConnectorOnlineStatus; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.experimental.FieldDefaults; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.util.List; | ||
|
||
@Getter | ||
@Setter | ||
@FieldDefaults(level = AccessLevel.PRIVATE) | ||
public class DataOfferListEntryRs { | ||
String assetId; | ||
String assetPropertiesJson; | ||
OffsetDateTime createdAt; | ||
OffsetDateTime updatedAt; | ||
List<ContractOfferRs> contractOffers; | ||
String connectorEndpoint; | ||
ConnectorOnlineStatus connectorOnlineStatus; | ||
OffsetDateTime connectorOfflineSinceOrLastUpdatedAt; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...a/de/sovity/edc/ext/brokerserver/dao/pages/dataoffer/DataOfferDetailPageQueryService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2023 sovity GmbH | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* sovity GmbH - initial API and implementation | ||
* | ||
*/ | ||
|
||
package de.sovity.edc.ext.brokerserver.dao.pages.dataoffer; | ||
|
||
import de.sovity.edc.ext.brokerserver.dao.pages.catalog.CatalogQueryContractOfferFetcher; | ||
import de.sovity.edc.ext.brokerserver.dao.pages.catalog.CatalogQueryFields; | ||
import de.sovity.edc.ext.brokerserver.dao.pages.dataoffer.model.DataOfferDetailRs; | ||
import de.sovity.edc.ext.brokerserver.db.jooq.Tables; | ||
import de.sovity.edc.ext.brokerserver.services.config.BrokerServerSettings; | ||
import lombok.RequiredArgsConstructor; | ||
import org.jooq.DSLContext; | ||
|
||
@RequiredArgsConstructor | ||
public class DataOfferDetailPageQueryService { | ||
private final CatalogQueryContractOfferFetcher catalogQueryContractOfferFetcher; | ||
private final BrokerServerSettings brokerServerSettings; | ||
|
||
public DataOfferDetailRs queryDataOfferDetailsPage(DSLContext dsl, String assetId, String endpoint) { | ||
// We are re-using the catalog page query stuff as long as we can get away with it | ||
var fields = new CatalogQueryFields( | ||
Tables.CONNECTOR, | ||
Tables.DATA_OFFER, | ||
brokerServerSettings.getDataSpaceConfig() | ||
); | ||
|
||
var d = fields.getDataOfferTable(); | ||
var c = fields.getConnectorTable(); | ||
|
||
return dsl.select( | ||
d.ASSET_ID, | ||
d.ASSET_PROPERTIES.cast(String.class).as("assetPropertiesJson"), | ||
d.CREATED_AT, | ||
d.UPDATED_AT, | ||
catalogQueryContractOfferFetcher.getContractOffers(fields).as("contractOffers"), | ||
fields.getOfflineSinceOrLastUpdatedAt().as("connectorOfflineSinceOrLastUpdatedAt"), | ||
c.ENDPOINT.as("connectorEndpoint"), | ||
c.ONLINE_STATUS.as("connectorOnlineStatus")) | ||
.from(d).leftJoin(c).on(c.ENDPOINT.eq(d.CONNECTOR_ENDPOINT)) | ||
.where(d.ASSET_ID.eq(assetId).or(d.CONNECTOR_ENDPOINT.eq(endpoint))) | ||
.fetchOneInto(DataOfferDetailRs.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.