Skip to content

Commit

Permalink
fix(TransferProcessApi): fix transfomer for TransferProcessDto (#3122)
Browse files Browse the repository at this point in the history
* fix(TransferProcessApi): fix transfomer for TransferProcessDto

* fix(TransferProcessApi): fix test

* fix(TransferProcessApi): consistent replace CallbackAddressDto with CallbackAddress
  • Loading branch information
wolf4ood authored May 30, 2023
1 parent 62d2ae9 commit e2e84ce
Show file tree
Hide file tree
Showing 26 changed files with 78 additions and 425 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package org.eclipse.edc.api;

import jakarta.json.Json;
import org.eclipse.edc.api.transformer.CallbackAddressDtoToCallbackAddressTransformer;
import org.eclipse.edc.api.transformer.CriterionDtoToCriterionTransformer;
import org.eclipse.edc.api.transformer.CriterionToCriterionDtoTransformer;
import org.eclipse.edc.api.transformer.DataAddressDtoToDataAddressTransformer;
Expand All @@ -24,7 +23,7 @@
import org.eclipse.edc.api.transformer.JsonObjectFromCriterionDtoTransformer;
import org.eclipse.edc.api.transformer.JsonObjectFromDataAddressDtoTransformer;
import org.eclipse.edc.api.transformer.JsonObjectFromIdResponseDtoTransformer;
import org.eclipse.edc.api.transformer.JsonObjectToCallbackAddressDtoTransformer;
import org.eclipse.edc.api.transformer.JsonObjectToCallbackAddressTransformer;
import org.eclipse.edc.api.transformer.JsonObjectToCriterionDtoTransformer;
import org.eclipse.edc.api.transformer.QuerySpecDtoToQuerySpecTransformer;
import org.eclipse.edc.runtime.metamodel.annotation.Extension;
Expand Down Expand Up @@ -59,7 +58,6 @@ public void initialize(ServiceExtensionContext context) {
transformerRegistry.register(new QuerySpecDtoToQuerySpecTransformer());
transformerRegistry.register(new CriterionToCriterionDtoTransformer());
transformerRegistry.register(new CriterionDtoToCriterionTransformer());
transformerRegistry.register(new CallbackAddressDtoToCallbackAddressTransformer());
transformerRegistry.register(new DataAddressDtoToDataAddressTransformer());
transformerRegistry.register(new DataAddressToDataAddressDtoTransformer());

Expand All @@ -71,7 +69,7 @@ public void initialize(ServiceExtensionContext context) {
transformerRegistry.register(new JsonObjectFromDataAddressDtoTransformer(jsonFactory));
transformerRegistry.register(new JsonObjectFromIdResponseDtoTransformer(jsonFactory));

transformerRegistry.register(new JsonObjectToCallbackAddressDtoTransformer());
transformerRegistry.register(new JsonObjectToCallbackAddressTransformer());
transformerRegistry.register(new JsonObjectToCriterionDtoTransformer());
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import jakarta.json.JsonObject;
import jakarta.json.JsonValue;
import org.eclipse.edc.api.model.CallbackAddressDto;
import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer;
import org.eclipse.edc.spi.types.domain.callback.CallbackAddress;
import org.eclipse.edc.transform.spi.TransformerContext;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -30,22 +30,22 @@
import static org.eclipse.edc.spi.types.domain.callback.CallbackAddress.IS_TRANSACTIONAL;
import static org.eclipse.edc.spi.types.domain.callback.CallbackAddress.URI;

public class JsonObjectToCallbackAddressDtoTransformer extends AbstractJsonLdTransformer<JsonObject, CallbackAddressDto> {
public class JsonObjectToCallbackAddressTransformer extends AbstractJsonLdTransformer<JsonObject, CallbackAddress> {

public JsonObjectToCallbackAddressDtoTransformer() {
super(JsonObject.class, CallbackAddressDto.class);
public JsonObjectToCallbackAddressTransformer() {
super(JsonObject.class, CallbackAddress.class);
}

@Override
public @Nullable CallbackAddressDto transform(@NotNull JsonObject jsonObject, @NotNull TransformerContext context) {
var builder = CallbackAddressDto.Builder.newInstance();
public @Nullable CallbackAddress transform(@NotNull JsonObject jsonObject, @NotNull TransformerContext context) {
var builder = CallbackAddress.Builder.newInstance();

visitProperties(jsonObject, (key, value) -> setProperties(key, value, builder, context));

return builder.build();
}

private void setProperties(String key, JsonValue value, CallbackAddressDto.Builder builder, TransformerContext context) {
private void setProperties(String key, JsonValue value, CallbackAddress.Builder builder, TransformerContext context) {
switch (key) {
case IS_TRANSACTIONAL:
builder.transactional(transformBoolean(value, context));
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit e2e84ce

Please sign in to comment.