From 787324e3416d0f2cac4c3a70901ded90cce27770 Mon Sep 17 00:00:00 2001 From: jhartmann Date: Mon, 6 May 2024 10:50:11 +0200 Subject: [PATCH] feat(edc-client): refactoring after review --- .../irs/edc/client/EdcCallbackController.java | 5 +++-- .../model/edr/EndpointDataReferenceCallback.java | 2 +- ...load.java => TransferProcessCallbackPayload.java} | 12 ++++++------ .../irs/edc/client/transformer/EdcTransformer.java | 3 ++- 4 files changed, 12 insertions(+), 10 deletions(-) rename irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/model/edr/{Payload.java => TransferProcessCallbackPayload.java} (79%) diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcCallbackController.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcCallbackController.java index 9d5c4f640a..a7571b7ef9 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcCallbackController.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/EdcCallbackController.java @@ -35,8 +35,8 @@ import org.eclipse.tractusx.irs.edc.client.exceptions.EdcClientException; import org.eclipse.tractusx.irs.edc.client.model.edr.DataAddress; import org.eclipse.tractusx.irs.edc.client.model.edr.EndpointDataReferenceCallback; -import org.eclipse.tractusx.irs.edc.client.model.edr.Payload; import org.eclipse.tractusx.irs.edc.client.model.edr.Properties; +import org.eclipse.tractusx.irs.edc.client.model.edr.TransferProcessCallbackPayload; import org.eclipse.tractusx.irs.edc.client.util.Masker; import org.springframework.http.HttpHeaders; import org.springframework.web.bind.annotation.PostMapping; @@ -81,7 +81,8 @@ private static EndpointDataReference mapToEndpointDataReference(final String end try { final EndpointDataReferenceCallback endpointDataReferenceCallback = StringMapper.mapFromString( endpointDataReference, EndpointDataReferenceCallback.class); - final Payload payload = Optional.ofNullable(endpointDataReferenceCallback.getPayload()).orElseThrow(); + final TransferProcessCallbackPayload payload = Optional.ofNullable( + endpointDataReferenceCallback.getPayload()).orElseThrow(); final DataAddress dataAddress = Optional.ofNullable(payload.dataAddress()).orElseThrow(); final Properties properties = Optional.ofNullable(dataAddress.properties()).orElseThrow(); diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/model/edr/EndpointDataReferenceCallback.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/model/edr/EndpointDataReferenceCallback.java index 5750b88bac..b3987fb288 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/model/edr/EndpointDataReferenceCallback.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/model/edr/EndpointDataReferenceCallback.java @@ -35,7 +35,7 @@ public class EndpointDataReferenceCallback { private String callbackId; @JsonProperty("at") private long createdAt; - private Payload payload; + private TransferProcessCallbackPayload payload; private String type; } diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/model/edr/Payload.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/model/edr/TransferProcessCallbackPayload.java similarity index 79% rename from irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/model/edr/Payload.java rename to irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/model/edr/TransferProcessCallbackPayload.java index bf2931b7ca..fdf14fc953 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/model/edr/Payload.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/model/edr/TransferProcessCallbackPayload.java @@ -36,10 +36,10 @@ */ @Builder @Jacksonized -public record Payload(String transferProcessId, - List callbackAddresses, - String assetId, - String type, - String contractId, - DataAddress dataAddress) { +public record TransferProcessCallbackPayload(String transferProcessId, + List callbackAddresses, + String assetId, + String type, + String contractId, + DataAddress dataAddress) { } diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/transformer/EdcTransformer.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/transformer/EdcTransformer.java index e958f57008..504f851619 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/transformer/EdcTransformer.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/transformer/EdcTransformer.java @@ -65,6 +65,7 @@ import org.eclipse.edc.protocol.dsp.negotiation.transform.from.JsonObjectFromContractNegotiationTransformer; import org.eclipse.edc.spi.result.Result; import org.eclipse.edc.spi.types.domain.asset.Asset; +import org.eclipse.edc.transform.spi.TransformerContext; import org.eclipse.edc.transform.spi.TypeTransformerRegistry; import org.eclipse.tractusx.irs.edc.client.model.ContractOfferDescription; import org.eclipse.tractusx.irs.edc.client.model.NegotiationRequest; @@ -85,7 +86,7 @@ public class EdcTransformer { private final JsonObjectFromContractOfferDescriptionTransformer jsonObjectFromContractOfferDescriptionTransformer; private final JsonObjectFromCatalogRequestTransformer jsonObjectFromCatalogRequestTransformer; private final TitaniumJsonLd titaniumJsonLd; - private final TransformerContextImpl transformerContext; + private final TransformerContext transformerContext; private final JsonObjectFromAssetTransformer jsonObjectFromAssetTransformer; private final JsonObjectToIrsPolicyTransformer jsonObjectToIrsPolicyTransformer;