Skip to content

Commit

Permalink
refactor: cleanup deprecated stuff (#4451)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt authored Sep 4, 2024
1 parent bcb2e42 commit 04899e9
Show file tree
Hide file tree
Showing 107 changed files with 160 additions and 4,528 deletions.
10 changes: 5 additions & 5 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ maven/mavencentral/com.github.stephenc.jcip/jcip-annotations/1.0-1, Apache-2.0,
maven/mavencentral/com.google.code.findbugs/jsr305/2.0.1, BSD-3-Clause AND CC-BY-2.5 AND LGPL-2.1+, approved, CQ13390
maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, CC-BY-2.5, approved, #15220
maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159
maven/mavencentral/com.google.crypto.tink/tink/1.15.0, , restricted, clearlydefined
maven/mavencentral/com.google.crypto.tink/tink/1.15.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.google.errorprone/error_prone_annotations/2.11.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.google.errorprone/error_prone_annotations/2.22.0, Apache-2.0, approved, #10661
maven/mavencentral/com.google.errorprone/error_prone_annotations/2.28.0, Apache-2.0, approved, #15107
Expand All @@ -82,7 +82,7 @@ maven/mavencentral/com.lmax/disruptor/3.4.4, Apache-2.0, approved, clearlydefine
maven/mavencentral/com.networknt/json-schema-validator/1.0.76, Apache-2.0, approved, CQ22638
maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.28, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.40, Apache-2.0, approved, #15156
maven/mavencentral/com.puppycrawl.tools/checkstyle/10.18.1, LGPL-2.1-or-later, restricted, clearlydefined
maven/mavencentral/com.puppycrawl.tools/checkstyle/10.18.1, LGPL-2.1-or-later AND (Apache-2.0 AND LGPL-2.1-or-later) AND Apache-2.0, approved, #16060
maven/mavencentral/com.samskivert/jmustache/1.15, BSD-2-Clause AND BSD-3-Clause, approved, clearlydefined
maven/mavencentral/com.squareup.okhttp3/okhttp-dnsoverhttps/4.12.0, Apache-2.0, approved, #11159
maven/mavencentral/com.squareup.okhttp3/okhttp/4.12.0, Apache-2.0, approved, #15227
Expand Down Expand Up @@ -195,7 +195,7 @@ maven/mavencentral/net.javacrumbs.json-unit/json-unit-core/2.36.0, Apache-2.0, a
maven/mavencentral/net.minidev/accessors-smart/2.4.7, Apache-2.0, approved, #7515
maven/mavencentral/net.minidev/json-smart/2.4.7, Apache-2.0, approved, #3288
maven/mavencentral/net.sf.jopt-simple/jopt-simple/5.0.4, MIT, approved, CQ13174
maven/mavencentral/net.sf.saxon/Saxon-HE/12.5, NOASSERTION, restricted, clearlydefined
maven/mavencentral/net.sf.saxon/Saxon-HE/12.5, MPL-2.0-no-copyleft-exception AND (LicenseRef-scancode-proprietary-license AND MPL-2.0-no-copyleft-exception) AND (MPL-2.0-no-copyleft-exception AND X11) AND (MIT AND MPL-2.0-no-copyleft-exception) AND (MPL-1.0 AND MPL-2.0-no-copyleft-exception) AND (Apache-2.0 AND MPL-2.0-no-copyleft-exception) AND MPL-1.0, restricted, #16061
maven/mavencentral/org.antlr/antlr4-runtime/4.13.2, BSD-3-Clause, approved, #10767
maven/mavencentral/org.apache.commons/commons-compress/1.24.0, Apache-2.0 AND BSD-3-Clause AND bzip2-1.0.6 AND LicenseRef-Public-Domain, approved, #10368
maven/mavencentral/org.apache.commons/commons-digester3/3.2, Apache-2.0, approved, clearlydefined
Expand All @@ -219,7 +219,7 @@ maven/mavencentral/org.apache.httpcomponents/httpclient/4.5.13, Apache-2.0, appr
maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.13, Apache-2.0, approved, CQ23528
maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.14, Apache-2.0, approved, CQ23528
maven/mavencentral/org.apache.httpcomponents/httpmime/4.5.13, Apache-2.0, approved, CQ11718
maven/mavencentral/org.apache.kafka/kafka-clients/3.8.0, Apache-2.0, restricted, clearlydefined
maven/mavencentral/org.apache.kafka/kafka-clients/3.8.0, Apache-2.0 AND (Apache-2.0 AND MIT) AND (Apache-2.0 AND BSD-3-Clause), approved, #16063
maven/mavencentral/org.apache.maven.doxia/doxia-core/1.12.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.apache.maven.doxia/doxia-logging-api/1.12.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.apache.maven.doxia/doxia-module-xdoc/1.12.0, Apache-2.0, approved, clearlydefined
Expand Down Expand Up @@ -309,7 +309,7 @@ maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.11.0, EPL-2.0, appro
maven/mavencentral/org.junit.platform/junit-platform-commons/1.11.0, EPL-2.0, approved, #15936
maven/mavencentral/org.junit.platform/junit-platform-engine/1.11.0, EPL-2.0, approved, #15932
maven/mavencentral/org.junit.platform/junit-platform-launcher/1.11.0, EPL-2.0, approved, #15934
maven/mavencentral/org.junit/junit-bom/5.11.0, , restricted, clearlydefined
maven/mavencentral/org.junit/junit-bom/5.11.0, EPL-2.0, approved, #16062
maven/mavencentral/org.junit/junit-bom/5.9.2, EPL-2.0, approved, #4711
maven/mavencentral/org.jvnet.mimepull/mimepull/1.9.15, CDDL-1.1 OR GPL-2.0-only WITH Classpath-exception-2.0, approved, CQ21484
maven/mavencentral/org.latencyutils/LatencyUtils/2.0.3, CC0-1.0, approved, #15280
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,12 @@
import org.jetbrains.annotations.NotNull;

import static java.lang.String.format;
import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE;

public class CatalogProtocolServiceImpl implements CatalogProtocolService {

@PolicyScope
public static final String CATALOGING_REQUEST_SCOPE = "request.catalog";

@Deprecated(since = "0.5.1")
private static final String EDC_PROPERTY_PARTICIPANT_ID = EDC_NAMESPACE + "participantId";

private final DatasetResolver datasetResolver;
private final DataServiceRegistry dataServiceRegistry;
private final String participantId;
Expand Down Expand Up @@ -69,7 +65,6 @@ public ServiceResult<Catalog> getCatalog(CatalogRequestMessage message, TokenRep
.dataServices(dataServices)
.datasets(datasets.toList())
.participantId(participantId)
.property(EDC_PROPERTY_PARTICIPANT_ID, participantId)
.build();
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_DATA_SERVICE_TYPE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_DESCRIPTION_ATTRIBUTE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_URL_ATTRIBUTE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_ENDPOINT_URL_ATTRIBUTE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_TERMS_ATTRIBUTE;

/**
* Converts from a {@link DataService} to a DCAT data service as a {@link JsonObject} in JSON-LD expanded form.
Expand All @@ -51,10 +49,6 @@ public JsonObjectFromDataServiceTransformer(JsonBuilderFactory jsonFactory) {
addIfNotNull(dataService.getEndpointDescription(), DCAT_ENDPOINT_DESCRIPTION_ATTRIBUTE, objectBuilder);
addIfNotNull(dataService.getEndpointUrl(), DCAT_ENDPOINT_URL_ATTRIBUTE, objectBuilder);

// deprecated attributes, to be removed
addIfNotNull(dataService.getEndpointDescription(), DCT_TERMS_ATTRIBUTE, objectBuilder);
addIfNotNull(dataService.getEndpointUrl(), DCT_ENDPOINT_URL_ATTRIBUTE, objectBuilder);

return objectBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_DATA_SERVICE_TYPE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_DESCRIPTION_ATTRIBUTE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_URL_ATTRIBUTE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_ENDPOINT_URL_ATTRIBUTE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_TERMS_ATTRIBUTE;
import static org.mockito.Mockito.mock;

class JsonObjectFromDataServiceTransformerTest {
Expand Down Expand Up @@ -62,21 +60,4 @@ void transform_returnJsonObject() {
assertThat(result.getJsonString(DCAT_ENDPOINT_URL_ATTRIBUTE).getString()).isEqualTo("url");
}

@Deprecated
@Test
void deprecated_attributes() {
var dataService = DataService.Builder.newInstance()
.id("dataServiceId")
.endpointDescription("description")
.endpointUrl("url")
.build();

var result = transformer.transform(dataService, context);

assertThat(result).isNotNull();
assertThat(result.getJsonString(ID).getString()).isEqualTo(dataService.getId());
assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DCAT_DATA_SERVICE_TYPE);
assertThat(result.getJsonString(DCT_TERMS_ATTRIBUTE).getString()).isEqualTo("description");
assertThat(result.getJsonString(DCT_ENDPOINT_URL_ATTRIBUTE).getString()).isEqualTo("url");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNEE_ATTRIBUTE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_ASSIGNER_ATTRIBUTE;
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_AGREEMENT;
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_ID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_ID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_PROPERTY_TIMESTAMP;
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;


Expand Down Expand Up @@ -70,8 +67,6 @@ public JsonObjectFromContractAgreementMessageTransformer(JsonBuilderFactory json
.add(ID, agreement.getId())
.add(ODRL_ASSIGNEE_ATTRIBUTE, agreement.getConsumerId())
.add(ODRL_ASSIGNER_ATTRIBUTE, agreement.getProviderId())
.add(DSPACE_PROPERTY_CONSUMER_ID, agreement.getConsumerId())
.add(DSPACE_PROPERTY_PROVIDER_ID, agreement.getProviderId())
.add(DSPACE_PROPERTY_TIMESTAMP, signing)
.build();

Expand All @@ -80,7 +75,6 @@ public JsonObjectFromContractAgreementMessageTransformer(JsonBuilderFactory json
.add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE)
.add(DSPACE_PROPERTY_PROVIDER_PID, agreementMessage.getProviderPid())
.add(DSPACE_PROPERTY_CONSUMER_PID, agreementMessage.getConsumerPid())
.add(DSPACE_PROPERTY_PROCESS_ID, agreementMessage.getProcessId())
.add(DSPACE_PROPERTY_AGREEMENT, copiedPolicy)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE;
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;

/**
Expand All @@ -48,7 +47,6 @@ public JsonObjectFromContractAgreementVerificationMessageTransformer(JsonBuilder
.add(TYPE, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE)
.add(DSPACE_PROPERTY_CONSUMER_PID, verificationMessage.getConsumerPid())
.add(DSPACE_PROPERTY_PROVIDER_PID, verificationMessage.getProviderPid())
.add(DSPACE_PROPERTY_PROCESS_ID, verificationMessage.getProcessId())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED;
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;


Expand All @@ -52,7 +51,6 @@ public JsonObjectFromContractNegotiationEventMessageTransformer(JsonBuilderFacto
.add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE)
.add(DSPACE_PROPERTY_CONSUMER_PID, eventMessage.getConsumerPid())
.add(DSPACE_PROPERTY_PROVIDER_PID, eventMessage.getProviderPid())
.add(DSPACE_PROPERTY_PROCESS_ID, eventMessage.getProcessId())
.add(DSPACE_PROPERTY_EVENT_TYPE, switch (eventMessage.getType()) {
case ACCEPTED -> DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_ACCEPTED;
case FINALIZED -> DSPACE_VALUE_NEGOTIATION_EVENT_TYPE_FINALIZED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON;

Expand All @@ -49,8 +48,7 @@ public JsonObjectFromContractNegotiationTerminationMessageTransformer(JsonBuilde
.add(ID, terminationMessage.getId())
.add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE)
.add(DSPACE_PROPERTY_CONSUMER_PID, terminationMessage.getConsumerPid())
.add(DSPACE_PROPERTY_PROVIDER_PID, terminationMessage.getProviderPid())
.add(DSPACE_PROPERTY_PROCESS_ID, terminationMessage.getProcessId());
.add(DSPACE_PROPERTY_PROVIDER_PID, terminationMessage.getProviderPid());

addIfNotNull(terminationMessage.getRejectionReason(), DSPACE_PROPERTY_REASON, builder);
addIfNotNull(terminationMessage.getCode(), DSPACE_PROPERTY_CODE, builder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_TERMINATED;
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_VALUE_NEGOTIATION_STATE_VERIFIED;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE;

Expand All @@ -58,7 +57,6 @@ public JsonObjectFromContractNegotiationTransformer(JsonBuilderFactory jsonFacto
.add(TYPE, DSPACE_TYPE_CONTRACT_NEGOTIATION)
.add(DSPACE_PROPERTY_CONSUMER_PID, pidFor(contractNegotiation, ContractNegotiation.Type.CONSUMER))
.add(DSPACE_PROPERTY_PROVIDER_PID, pidFor(contractNegotiation, ContractNegotiation.Type.PROVIDER))
.add(DSPACE_PROPERTY_PROCESS_ID, pidFor(contractNegotiation, ContractNegotiation.Type.CONSUMER))
.add(DSPACE_PROPERTY_STATE, state(contractNegotiation.getState(), context))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;

/**
Expand All @@ -49,8 +48,7 @@ public JsonObjectFromContractOfferMessageTransformer(JsonBuilderFactory jsonFact
var builder = jsonFactory.createObjectBuilder()
.add(ID, message.getId())
.add(TYPE, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE)
.add(DSPACE_PROPERTY_PROVIDER_PID, message.getProviderPid())
.add(DSPACE_PROPERTY_PROCESS_ID, message.getProcessId());
.add(DSPACE_PROPERTY_PROVIDER_PID, message.getProviderPid());

addIfNotNull(message.getConsumerPid(), DSPACE_PROPERTY_CONSUMER_PID, builder);
addIfNotNull(message.getCallbackAddress(), DSPACE_PROPERTY_CALLBACK_ADDRESS, builder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import static org.eclipse.edc.protocol.dsp.spi.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROCESS_ID;
import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID;


Expand All @@ -50,8 +49,7 @@ public JsonObjectFromContractRequestMessageTransformer(JsonBuilderFactory jsonFa
var builder = jsonFactory.createObjectBuilder()
.add(ID, requestMessage.getId())
.add(TYPE, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE)
.add(DSPACE_PROPERTY_CONSUMER_PID, requestMessage.getConsumerPid())
.add(DSPACE_PROPERTY_PROCESS_ID, requestMessage.getProcessId());
.add(DSPACE_PROPERTY_CONSUMER_PID, requestMessage.getConsumerPid());

addIfNotNull(requestMessage.getProviderPid(), DSPACE_PROPERTY_PROVIDER_PID, builder);
addIfNotNull(requestMessage.getCallbackAddress(), DSPACE_PROPERTY_CALLBACK_ADDRESS, builder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
* Creates a {@link ContractAgreementMessage} from a {@link JsonObject}.
*/
public class JsonObjectToContractAgreementMessageTransformer extends AbstractJsonLdTransformer<JsonObject, ContractAgreementMessage> {
private static final Set<String> EXCLUDED_POLICY_KEYWORDS =
Set.of(DSPACE_PROPERTY_CONSUMER_ID, DSPACE_PROPERTY_PROVIDER_ID, DSPACE_PROPERTY_TIMESTAMP);
private static final Set<String> EXCLUDED_POLICY_KEYWORDS = Set.of(DSPACE_PROPERTY_TIMESTAMP, DSPACE_PROPERTY_CONSUMER_ID, DSPACE_PROPERTY_PROVIDER_ID);

public JsonObjectToContractAgreementMessageTransformer() {
super(JsonObject.class, ContractAgreementMessage.class);
Expand Down Expand Up @@ -126,24 +125,6 @@ private ContractAgreement contractAgreement(JsonObject jsonAgreement, Policy pol
.policy(policy)
.assetId(policy.getTarget());

if (assignee == null && !transformMandatoryString(jsonAgreement.get(DSPACE_PROPERTY_CONSUMER_ID), builder::consumerId, context)) {
context.problem()
.missingProperty()
.type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE)
.property(DSPACE_PROPERTY_CONSUMER_ID)
.report();
return null;
}

if (assigner == null && !transformMandatoryString(jsonAgreement.get(DSPACE_PROPERTY_PROVIDER_ID), builder::providerId, context)) {
context.problem()
.missingProperty()
.type(DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE)
.property(DSPACE_PROPERTY_PROVIDER_ID)
.report();
return null;
}

var timestamp = transformString(jsonAgreement.get(DSPACE_PROPERTY_TIMESTAMP), context);
if (timestamp == null) {
context.problem()
Expand Down
Loading

0 comments on commit 04899e9

Please sign in to comment.