Skip to content

Commit

Permalink
feat(edc-client): refactoring after review
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-jhartmann committed May 6, 2024
1 parent a98cbe1 commit 787324e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class EndpointDataReferenceCallback {
private String callbackId;
@JsonProperty("at")
private long createdAt;
private Payload payload;
private TransferProcessCallbackPayload payload;
private String type;
}

Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
*/
@Builder
@Jacksonized
public record Payload(String transferProcessId,
List<CallbackAddress> callbackAddresses,
String assetId,
String type,
String contractId,
DataAddress dataAddress) {
public record TransferProcessCallbackPayload(String transferProcessId,
List<CallbackAddress> callbackAddresses,
String assetId,
String type,
String contractId,
DataAddress dataAddress) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 787324e

Please sign in to comment.