From e2e41d6eb32bc4fcb76ec7454f7200f5d2d9af44 Mon Sep 17 00:00:00 2001 From: Christophe Loiseau Date: Tue, 9 Jul 2024 14:15:13 +0200 Subject: [PATCH] feat: terminatedBy for contract termination API (#992) --- docs/api/sovity-edc-api-wrapper.yaml | 29 ++++++++++++------- .../ContractAgreementTerminationInfo.java | 6 ++++ .../api/ui/model/ContractTerminatedBy.java | 22 ++++++++++++++ .../ui/model/ContractTerminationStatus.java | 3 ++ 4 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractTerminatedBy.java diff --git a/docs/api/sovity-edc-api-wrapper.yaml b/docs/api/sovity-edc-api-wrapper.yaml index c5531ca25..13d5135d1 100644 --- a/docs/api/sovity-edc-api-wrapper.yaml +++ b/docs/api/sovity-edc-api-wrapper.yaml @@ -1323,11 +1323,7 @@ components: items: $ref: '#/components/schemas/ContractAgreementTransferProcess' terminationStatus: - type: string - description: Contract Agreement's Termination Status - enum: - - ONGOING - - TERMINATED + $ref: '#/components/schemas/ContractTerminationStatus' terminationInformation: $ref: '#/components/schemas/ContractAgreementTerminationInfo' description: Contract Agreement for Contract Agreement Page @@ -1353,6 +1349,7 @@ components: - detail - reason - terminatedAt + - terminatedBy type: object properties: terminatedAt: @@ -1367,6 +1364,8 @@ components: type: string description: Detailed message from the terminating party about why the contract was terminated. + terminatedBy: + $ref: '#/components/schemas/ContractTerminatedBy' description: Contract's agreement metadata ContractAgreementTransferProcess: required: @@ -1388,6 +1387,19 @@ components: type: string description: Error Message description: A Contract Agreement's Transfer Process + ContractTerminatedBy: + type: string + description: Whether the contract termination was initiated by this EDC or a + counterparty EDC. + enum: + - SELF + - COUNTERPARTY + ContractTerminationStatus: + type: string + description: The contract termination status + enum: + - ONGOING + - TERMINATED TransferProcessSimplifiedState: type: string description: Simplified Transfer Process State to be used in UI @@ -1417,12 +1429,7 @@ components: type: object properties: terminationStatus: - type: string - description: Optionally filter the resulting contract agreements by their - termination status. - enum: - - ONGOING - - TERMINATED + $ref: '#/components/schemas/ContractTerminationStatus' description: Filters for querying a Contract Contract Agreement Page ContractDefinitionEntry: required: diff --git a/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractAgreementTerminationInfo.java b/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractAgreementTerminationInfo.java index d96223ef7..0f7cf243e 100644 --- a/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractAgreementTerminationInfo.java +++ b/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractAgreementTerminationInfo.java @@ -40,4 +40,10 @@ public class ContractAgreementTerminationInfo { requiredMode = Schema.RequiredMode.REQUIRED ) private String detail; + + @Schema( + description = "Indicates whether the termination comes from this EDC or the counterparty EDC.", + requiredMode = Schema.RequiredMode.REQUIRED + ) + private ContractTerminatedBy terminatedBy; } diff --git a/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractTerminatedBy.java b/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractTerminatedBy.java new file mode 100644 index 000000000..f249a3869 --- /dev/null +++ b/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractTerminatedBy.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2024 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.wrapper.api.ui.model; + +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "Whether the contract termination was initiated by this EDC or a counterparty EDC.", enumAsRef = true) +public enum ContractTerminatedBy { + SELF, + COUNTERPARTY +} diff --git a/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractTerminationStatus.java b/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractTerminationStatus.java index b802b60ba..652c18364 100644 --- a/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractTerminationStatus.java +++ b/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/ContractTerminationStatus.java @@ -13,6 +13,9 @@ package de.sovity.edc.ext.wrapper.api.ui.model; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "The contract termination status", enumAsRef = true) public enum ContractTerminationStatus { ONGOING, TERMINATED