From 703247fd0e398daaaec3d41a02fee68028f0198b Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Fri, 25 Aug 2023 08:44:03 +0200 Subject: [PATCH 01/11] chore: added javadocs --- .../edc/logic/service/EdcAdapterService.java | 15 ++----- .../masterdata/domain/model/Material.java | 42 +++++++++++++++++++ .../masterdata/domain/model/Partner.java | 10 +++++ .../stock/domain/model/MaterialStock.java | 7 +++- .../domain/model/PartnerProductStock.java | 6 +++ .../stock/domain/model/ProductStock.java | 5 +++ .../domain/model/ProductStockResponse.java | 15 ------- .../backend/stock/domain/model/Stock.java | 5 +++ 8 files changed, 77 insertions(+), 28 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java index 5267cd00..4a20b07e 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java @@ -74,18 +74,9 @@ public class EdcAdapterService { @Value("${server.port}") private String serverPort; - @Value("${edc.dataplane.public.port}") - private String dataplanePort; - @Value("${minikube.ip}") private String minikubeIp; - @Value("${request.serverendpoint}") - private String requestServerEndpointURL; - - @Value("${response.serverendpoint}") - private String responseServerEndpointURL; - private ObjectMapper objectMapper; @Autowired @@ -255,7 +246,7 @@ public JsonNode getCatalogFilteredByAssetPropertyObjectFilter(String idsUrl, Map /** * Orders your own EDC Connector Controlplane to negotiate a contract with * the owner of the given connector address for an asset (specified by the - * assetId) under conditions as stated in the contract defintion with the + * assetId) under conditions as stated in the contract definition with the * given contractDefinitionId * @param connectorAddress * @param contractDefinitionId @@ -315,8 +306,8 @@ public String startTransfer(String transferId, * Sends a request to the own EDC Connector Controlplane in order to receive * the current status of the previously initiated transfer as specified by * the parameter. - * @param transferId - * @return + * @param transferId the id of the transfer in question + * @return the response from your Controlplane * @throws IOException */ public String getTransferState(String transferId) throws IOException { diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Material.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Material.java index c3a0462a..341a1334 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Material.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Material.java @@ -33,6 +33,37 @@ import java.util.Objects; import java.util.Set; +/** + *

This class represents materials and products that are to be traded between + * partners that collaborate via the PURIS application.

+ *

Whether a material is a product or a "material", is determined by the point of + * view. If the owner of the current instance of a PURIS application is selling a + * certain product to customers, the product flag must be set to "true" and the business + * logic will treat this material as a product if the circumstances require a differentiation + * between products and materials.

+ *

If, on the other hand, the owner of the current instance of a PURIS application is buying + * a material from external partners, then the material-flag must be set to "true", in order to + * allow the business logic to handle this correctly.

+ *

This approach allows for flexibility, especially in cases when the the owner of the current + * instance of a PURIS application is a trader who is buying a certain good from one partner just + * to sell it immediately to another partner.

+ *

Each entity of this class is uniquely identified by the material number defined + * by the partner that runs an instance of the PURIS app.

+ *

A certain type of semiconductors is produced by partner A. He has labeled his + * product with the material number "SC-456.001". Partner B is buying this type of + * semiconductors from A. In his own ERP-System, he is referring to this semiconductor + * as "A-CHIP-0815".

+ *

In partner A's PURIS app this material will be registered under the ownMaterialNumber + * "SC-456.001", while partner B will registered as "A-CHIP-0815". Let's further assume + * that Partner C now wants to buy this material from A as well. In his own domain, C names + * this material "XYZ-123". Therefore C will register the material under this ownMaterialNumber + * in his own PURIS app.

+ *

When two partner are preparing to establish a business relationship in regard to a specific + * material, then each partner will create a {@link MaterialPartnerRelation}, where he + * designates the other partner as supplier or customer of this entity. He also must define, + * under which material number his partner refers to this material.

+ * + */ @Entity @Table(name = "material") @Getter @@ -55,11 +86,22 @@ public class Material { */ private boolean productFlag; + /** + * The unique material number defined by the owner of this + * PURIS instance for this material. + */ @Id private String ownMaterialNumber; + /** + * If there is a Catena-X material number defined + * for this material, this is stored here. + */ private String materialNumberCx; + /** + * Informal name or description of the material. + */ private String name; @OneToMany(mappedBy = "material") diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Partner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Partner.java index 6110f858..f56b35f0 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Partner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Partner.java @@ -28,6 +28,13 @@ import java.util.*; +/** + *

This class represents an external business partner. Each partner + * is uniquely defined by his BPNL.

+ * + *

Furthermore, each business partner must have at least one + * site-BPNS, and exactly one EDC-URL.

+ */ @Entity @Table(name = "partner") @Getter @@ -39,6 +46,9 @@ public class Partner { @Id @GeneratedValue private UUID uuid; + /** + * The full name of the partner. + */ private String name; private String edcUrl; private String bpnl; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialStock.java index 267e0d31..a9eaf3aa 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialStock.java @@ -32,6 +32,11 @@ import java.util.Date; +/** + *

This class represents a distinct stock of a certain material, that the owner of + * the current instance of the PURIS application has in his own warehouse.

+ * + */ @Entity @DiscriminatorValue("MaterialStock") @Getter @@ -46,4 +51,4 @@ public MaterialStock(Material material, double quantity, String atSiteBpnl, super.setType(DT_StockTypeEnum.MATERIAL); } -} \ No newline at end of file +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/PartnerProductStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/PartnerProductStock.java index 29acdc7f..12dc2ea4 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/PartnerProductStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/PartnerProductStock.java @@ -33,6 +33,12 @@ import java.util.Date; +/** + *

This class represents a distinct stock of products that a supplier partner of + * the owner of the current instance of the PURIS application has in his warehouse and + * that is dedicated to be sent to the owner of the current instance of the PURIS + * application later in time

+ */ @Entity @DiscriminatorValue("PartnerProductStock") @Getter diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductStock.java index b7209d72..2d05c6ba 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductStock.java @@ -32,6 +32,11 @@ import java.util.Date; +/** + *

This class represents a distinct stock of products that the owner of + * the current instance of the PURIS application has in his warehouse and + * that is dedicated to be sent to a certain customer partner later in time

+ */ @Entity @Getter @Setter diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductStockResponse.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductStockResponse.java index 07962625..b9e75722 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductStockResponse.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductStockResponse.java @@ -47,27 +47,12 @@ @NoArgsConstructor public class ProductStockResponse { -// @Id -// @GeneratedValue -// @JsonIgnore -// /** -// * Technical identifier for a Message. -// */ -// private UUID uuid; - /** * Steering information {@link ProductStockResponse} api message. */ @Embedded private MessageHeader header; -// /** -// * List of actual content of the payload. -// *

-// * May contain also errors. -// */ -// @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) -// private List payload = new ArrayList<>(); private ContentWrapper content = new ContentWrapper(); diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/Stock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/Stock.java index 2e9bd297..31e4d9cb 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/Stock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/Stock.java @@ -33,6 +33,11 @@ import java.util.Date; import java.util.UUID; +/** + * This class is the common superclass of MaterialStock, ProductStock + * and PartnerProductStock. + * + */ @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "stock_type") From 402e0684d52a7756e488fb3b60fcf827829b30d4 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Mon, 28 Aug 2023 13:32:10 +0200 Subject: [PATCH 02/11] fix: added swagger documentation and some minor fixes --- .../EndpointDataReferenceReceiver.java | 35 ++++++++++-- .../ProductStockRequestApiController.java | 56 ++++++++++++++++++- .../ProductStockResponseApiController.java | 33 ++++++++++- .../stock/controller/StockController.java | 4 ++ 4 files changed, 119 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EndpointDataReferenceReceiver.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EndpointDataReferenceReceiver.java index 3aa3fa0d..82c0ed40 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EndpointDataReferenceReceiver.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EndpointDataReferenceReceiver.java @@ -20,6 +20,14 @@ */ package org.eclipse.tractusx.puris.backend.common.edc.controller; +import com.fasterxml.jackson.databind.JsonNode; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.puris.backend.common.edc.logic.dto.EDR_Dto; import org.eclipse.tractusx.puris.backend.common.edc.logic.service.EndpointDataReferenceService; import org.springframework.beans.factory.annotation.Autowired; @@ -27,8 +35,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.extern.slf4j.Slf4j; + +import java.util.UUID; /** * This class contains the endpoint for receiving the authCodes from @@ -48,8 +56,27 @@ public class EndpointDataReferenceReceiver { * @return */ @PostMapping("/edrendpoint") + @Operation(summary = "Endpoint for receiving the authCodes from the counterparty's dataplane", + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + content = @Content(examples = { + @ExampleObject(name = "EDR Token", + value = "{\n" + + " \"id\" : \"6c2e5600-294a-488e-8ce1-2073806c1927\",\n" + + " \"endpoint\" : \"http://sokrates-dataplane:8181/api/public\",\n" + + " \"authKey\" : \"Authorization\",\n" + + " \"authCode\" : \"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2OTMyMTgzNzIsImRhZCI6Ik5YY2J1VktDOVFCTWY5eG9BQUFBQWN3RmE2blhIS1JEcllHTnZCeUNlbTdCNTBOVkVWd05vczdsNU1YM0lKL1pVK0NUU3NvcE02ZUVFbzloYmx5ak1aTlJYYnRnOUZpZ04vampRVmVlaDFWQk01RHA1RXUyN2VIbk5TNCt0VE9uMEZFZTVGVGNITjh6dWwwZG5VbW1nbCtsVERxODZhdHUwbjYxZVV5dXNzQ25pbTZDaWhOai9lRXZ0cUZydVhCbXNIWVQvSTNYN3JrYk1FeFZWRFhBOHNPVGFGeFVpTnl3YTI0cURpWkFnc0Nka1FDenBaSFVIWk16ZDQrNURKTTVkVkNDWnEyUHBnRDhuR09wVzVVTTJUYUlmNHdMOTFQbnhEdEQ2a1dWTCtNQUNGSE41S2RyVUt2a3pOeXAyRzVYcWJ2V29waEhhY0VLTTR4UTZDc2dkUHFoMGN6elNnbFZGdy9IWVl3ZDBXQVpCcnVSSTlUekY4WTJkMXBscW5zRFFwcWh1bUUzUUtGTW5UbzUxWVFuVmdzcUZ5ZEpObkpMZjQzWnBwOXNPZ3U0V1Yxd3lxN096QzFXeFZjRk9xNVZQMkJRYk5pS29YeEZINXd3WmZJMzR6dFNCTFE0akUvY3BJTlk0Rks0Tk95YjNicENOYlpDamplbXRYaE1jTXlUQ0tyMU8zS2RvdkhEMnEzMjhVdDk0U3hzZW9jK0FCUXZaTk5EK1hGbm9Bcm01K01jbkVXdkdPVHJPT0NIaG83bWhnTGUxRzVEaHBqRjFaclBVTHFNNitzTmZzU0l4REhSOEtzMW1OMGhwajVwMUJ4Tm9rMDE2bGNJSURTbnVpclhyZWlzVzhEK0NHRDlEREdlUlVNQkk3cVBCSVc4eXY5RmU1eldrNHU0cERzbFAwR0dPYjBpMHVBMnFyS0dFS2JQUmd6ODRPeWZTNW84KzdiQ1dkMElKdmZERlRGK3UwVVgzVWordmFtYlZPREpQK1FmbXpOM0U2NFdaY1ozVDRMQURKZWhGcEZ5WGh6bUM5SnAyK2RYZ2syWE4rUnVzbGZFeGNMbXA0U05DenRxZDVQTXZqVjdOMXFYZnQ5a0hLLytwYWhoVUUxLzBENTEvS04razN4cmxoTDFPVnF3QzYvUjlScDA5WUk4dno3enNXS0V3aEpNOGk2OCtRdHlDMldNay9ucVpjTmtieVQ3T21WZ1R2bFhxYmV5WlpVOTlSdGxVNExJemZjM3hKRlIvUGpDa2xUK2dkZXpsaXFnbGFWMlFLL2EwVHpXbFlncXVDQ21kQzhieGJaR1JFWFdrbVFlNUwwZC9UWWZZYVRCNWdURkRDL1ZDRnYrRUFzNFhXQ2pBQ2NraW5rTDJDYWlZYm5WV0I5Zi9nRkJaWkY1cDhBNHFrMkIvdkNBS3ByckpQZkMwZTZIQXFxUlZxRFZ1VktZRHl1U3V5Umx6Q2hPbXZvNHRoRUhDcmtwVFlCNzZIVlNPeld2ZFJubmJRQmNyOW5YQkVCd2xvbGZkV3F4TGZUY3dmRnFJV2tla0YrT3NzTDE1TVV5Ym1vZXlxVnUxSkdpVGN1Sy90NGhINkxEQXNWeVhOT294NVF4eDE1b0dIN1hoWXVrWEpBb2J6SXduVWtrM2cxOE1GMko1LzNIbVpHVDM3bHU0SUNmR3g3d3JxY0xHSEJnb3l5MndsZDl3WVdGMHB4RXlwbmltZWZHZTQ4di9TbEIwYldRekY5S0UrVGwrcTA3d1c2aHVNbU51VDhUNWJLeXBIUVYzMnlpSkozbGx3WnpTVmc5NWtsWXo3VThxZ3FhNlJCa1plbXovNFhISG4vVXRGTUl5K1VnZkNEbVJ5L2dORmZOQkdmQ2RQSGNidTh3RXRvd2QrOTJ5R0JPLzZIbFgwdysxYlNzVGZYRDI1U21ZdWtRcDhTUlgyTEtTaUtzc3VKQ0QwOTdCbTAvRkorUkxJOVZHd2FJRXBLMTIzOEVyUTFublVIbGNnblByY2xKVE5jdWtXNFp5YkhESUYrT3YwNHFMNnpYa292NXBoYXB0b1dBaHNCaE4vbW5sUWlHYnpSOGN4WWJ1SEpRRDRxd3VuZzloYVR3b2RyeGhxTXh4RVM5SHhVN3UrQ3U2SkhaRkVoL0pEeWpzVnc5ZXg5Uy94aUxFNjNZR21iWnNBK3Q5QXRzdjJPVC9TbS9ZMkk9IiwiY2lkIjoicHJvZHVjdC1zdG9jay1yZXF1ZXN0LWFwaTphMDUwYmY1MS0xYWIxLTRkZTQtODM0Yy1mNWNlMGEzMDMwZWEifQ.oxERHPWzhunY18bJjgTGjlvZhHUGtDm2V_svDVkYz3VulluMjoFV5jm1EDuy46Z3vEgLQmKsFsG-VTsVwHaJKh5pnlx1QEj8SUFYu5JZraIL6vghI1X3cPb0qNfCBX191ztJCRgszyNMsxXGd4GQjkUdnP8J58UtBwaoNTQNWxMOIYgpBaNUuyPr6wSz1ek05B-TahoVjfjFmgAlDoKLjLQ-Ec-ejfM6FaITvifrVJyGUyHGiqzU7v4_Dd29rVHVHSE_F3rr6sLV56PeU30coBAn_q7hnTN6GWdulxg3vjc5uDcqSntxmxGE_STI-paBDHG5aToQzNNgARpv3SJDjg\",\n" + + " \"properties\" : {\n" + + " \"cid\" : \"product-stock-request-api:a050bf51-1ab1-4de4-834c-f5ce0a3030ea\"\n" + + " }\n" + + "}\n") + }) + )) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Ok"), + @ApiResponse(responseCode = "400", description = "Received invalid message") + }) private ResponseEntity authCodeReceivingEndpoint(@RequestBody JsonNode body) { - log.debug("Received edr data:\n" + body.toPrettyString()); + log.info("Received edr data:\n" + body.toPrettyString()); String transferId = body.get("id").asText(); String authKey = body.get("authKey").asText(); String authCode = body.get("authCode").asText(); @@ -63,4 +90,4 @@ private ResponseEntity authCodeReceivingEndpoint(@RequestBody JsonNode b return ResponseEntity.status(200).build(); } -} \ No newline at end of file +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockRequestApiController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockRequestApiController.java index f38aab02..db53d710 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockRequestApiController.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockRequestApiController.java @@ -24,6 +24,12 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.puris.backend.stock.domain.model.ProductStockRequest; import org.eclipse.tractusx.puris.backend.common.api.domain.model.datatype.DT_RequestStateEnum; @@ -40,6 +46,9 @@ import java.util.UUID; +/** + * This class contains the REST controller of the product-stock-response api. + */ @Slf4j @RestController @RequestMapping("product-stock") @@ -61,6 +70,15 @@ public class ProductStockRequestApiController { EdcAdapterService edcAdapterService; @PostMapping("request") + @Operation(summary = "This endpoint receives the product stock requests from a consumer.", + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + content = @Content(schema = @Schema(implementation = ProductStockRequest.class))) + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "202", description = "Product Stock request was accepted"), + @ApiResponse(responseCode = "400", description = "Request body malformed"), + @ApiResponse(responseCode = "422", description = "A request with the same ID already exists") + }) public ResponseEntity postRequest(@RequestBody String requestBody) { log.info("product-stock/request called: \n" + requestBody); @@ -85,8 +103,8 @@ public ResponseEntity postRequest(@RequestBody String requestBody) { UUID requestId = productStockRequest.getHeader().getRequestId(); ProductStockRequest productStockRequestFound = - productStockRequestService.findRequestByHeaderUuid(requestId); - + productStockRequestService.findRequestByHeaderUuid(requestId); + if (productStockRequestFound != null) { log.error("RequestId already in use"); @@ -104,14 +122,38 @@ public ResponseEntity postRequest(@RequestBody String requestBody) { // if the request has been correctly taken over, return 202 return ResponseEntity.status(HttpStatusCode.valueOf(202)).body(new SuccessfulRequestDto(requestId)); - + } @GetMapping("request") + @Operation(summary = "This endpoint allows the consumer to OPTIONALLY check the current status of a request it already made.", + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(content = @Content( + schema = @Schema(implementation = StatusRequestSchema.class) + )) + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Status request was successful", + content = @Content( + examples = {@ExampleObject + (name = "Status response sample", + value = "{\"requestId\": \"48878d48-6f1d-47f5-8ded-a441d0d879df\",\n" + + " \"requestState\": \"Working\"}")} + )), + @ApiResponse(responseCode = "400", description = "Request body malformed"), + @ApiResponse(responseCode = "401", description = "Not authorized"), + @ApiResponse(responseCode = "422", description = "The request ID is not known") + }) public ResponseEntity getRequest(@RequestBody JsonNode body) { try { MessageHeaderDto header = objectMapper.convertValue(body.get("header"), MessageHeaderDto.class); var request = productStockRequestService.findRequestByHeaderUuid(header.getRequestId()); + if (request == null) { + return ResponseEntity.status(422).build(); + } + String senderBpnl = request.getHeader().getSender(); + if (!senderBpnl.equals(header.getSender())) { + return ResponseEntity.status(401).build(); + } var requestStatus = request.getState(); var jsonResponseBody = objectMapper.createObjectNode(); jsonResponseBody.put("requestId", header.getRequestId().toString()); @@ -122,5 +164,13 @@ public ResponseEntity getRequest(@RequestBody JsonNode body) { } } + /** + * This class serves only as a template for the schema in the Swagger-UI + */ + private static class StatusRequestSchema { + public MessageHeaderDto header; + public JsonNode content; + } + } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockResponseApiController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockResponseApiController.java index 6248abed..7cfe6d08 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockResponseApiController.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockResponseApiController.java @@ -23,6 +23,12 @@ import java.util.UUID; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.eclipse.tractusx.puris.backend.stock.domain.model.ProductStockRequest; import org.eclipse.tractusx.puris.backend.common.api.domain.model.datatype.DT_RequestStateEnum; import org.eclipse.tractusx.puris.backend.common.api.logic.dto.SuccessfulRequestDto; @@ -42,6 +48,9 @@ import lombok.extern.slf4j.Slf4j; +/** + * This class contains the REST controller of the product-stock-response api. + */ @RestController @RequestMapping("product-stock") @Slf4j @@ -61,6 +70,20 @@ public class ProductStockResponseApiController { @PostMapping("response") + @Operation(summary = "This endpoint receives the responses to the consumer's requests.", + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + content = @Content(schema = @Schema(implementation = ProductStockResponse.class)) + ) + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "202", description = "Product Stock Response was accepted", + content = @Content(examples = @ExampleObject(value = "{\n" + + " \"requestId\": \"48878d48-6f1d-47f5-8ded-a441d0d879df\"\n" + + "}"))), + @ApiResponse(responseCode = "400", description = "Response body malformed"), + @ApiResponse(responseCode = "401", description = "Not authorized"), + @ApiResponse(responseCode = "422", description = "The request ID does not match any open request") + }) public ResponseEntity postResponse(@RequestBody String body) { ProductStockResponse productStockResponse = null; try { @@ -68,12 +91,12 @@ public ResponseEntity postResponse(@RequestBody String body) { log.info(objectMapper.readTree(objectMapper.writeValueAsString(productStockResponse)).toPrettyString()); } catch (Exception e) { log.error("Failed to deserialize body of incoming message", e); - return ResponseEntity.status(HttpStatusCode.valueOf(422)).build(); + return ResponseEntity.status(HttpStatusCode.valueOf(400)).build(); } if (productStockResponse.getHeader() == null || productStockResponse.getHeader().getRequestId() == null) { log.error("No RequestId provided!"); - return ResponseEntity.status(422).build(); + return ResponseEntity.status(400).build(); } UUID requestId = productStockResponse.getHeader().getRequestId(); @@ -86,6 +109,12 @@ public ResponseEntity postResponse(@RequestBody String body) { log.info("Got response for request Id " + requestId); } + if(!productStockRequestFound.getHeader().getReceiver().equals(productStockResponse.getHeader().getSender())) { + log.error("Request receiver " + productStockRequestFound.getHeader().getReceiver() + " does not match " + + " response sender " + productStockResponse.getHeader().getSender()); + return ResponseEntity.status(401).build(); + } + productStockRequestService.updateState(productStockRequestFound, DT_RequestStateEnum.COMPLETED); productStockResponseApiService.consumeResponse(productStockResponse); diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java index 35a99b4a..b14744bf 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java @@ -56,6 +56,10 @@ import java.util.UUID; import java.util.stream.Collectors; +/** + * This class contains a range of REST endpoints to provide the frontend + * the necessary data concerning stocks. + */ @RestController @RequestMapping("stockView") @Slf4j From 2c73cca7e3d348c8c423bc948c0bfb46e8e41e4a Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Mon, 28 Aug 2023 14:55:58 +0200 Subject: [PATCH 03/11] fix: adjusted dt_requeststateenum objects to better match puris api conventions --- .../DataInjectionCommandLineRunner.java | 3 +-- .../model/datatype/DT_RequestStateEnum.java | 21 ++++++++----------- .../edc/logic/util/EDCRequestBodyBuilder.java | 2 +- .../ProductStockRequestApiController.java | 4 ++-- .../ProductStockResponseApiController.java | 2 +- .../stock/controller/StockController.java | 12 +++++------ .../ProductStockRequestApiServiceImpl.java | 11 +++++----- .../ProductStockResponseApiServiceImpl.java | 2 +- 8 files changed, 26 insertions(+), 31 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java index 66ec01e7..cc2a0de1 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java @@ -40,7 +40,6 @@ import org.eclipse.tractusx.puris.backend.stock.logic.service.PartnerProductStockService; import org.eclipse.tractusx.puris.backend.stock.logic.service.ProductStockRequestService; import org.eclipse.tractusx.puris.backend.stock.logic.service.ProductStockService; -import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.CommandLineRunner; @@ -329,7 +328,7 @@ private void createRequest() throws JsonProcessingException { rfm = new ProductStockRequestForMaterial("OtherCU-MNR", null, "OtherSU-MNR"); productStock.add(rfm); - request.setState(DT_RequestStateEnum.WORKING); + request.setState(DT_RequestStateEnum.Working); request = productStockRequestService.createRequest(request); diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/domain/model/datatype/DT_RequestStateEnum.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/domain/model/datatype/DT_RequestStateEnum.java index a92ea1c1..46714c4f 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/domain/model/datatype/DT_RequestStateEnum.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/domain/model/datatype/DT_RequestStateEnum.java @@ -32,31 +32,28 @@ public enum DT_RequestStateEnum { /** * The consumer requested something. */ - REQUESTED("Requested"), + Requested, /** - * The provider receipt the request of the consumer. + * The supplier received the request of the consumer. */ - RECEIPT("Received"), + Received, /** - * The provider works on fulfilling the requested service or data. + * The supplier works on fulfilling the requested service or data. */ - WORKING("Working"), + Working, /** - * The provider fulfilled the service and sent the data to the consumer. + * The supplier fulfilled the service and sent the data to the consumer. */ - COMPLETED("Completed"), + Completed, /** * An error occured between the start and completion of a request. */ - ERROR("Error"); + Error; + - final public String STATUSTEXT; - private DT_RequestStateEnum(String statustext) { - this.STATUSTEXT = statustext; - } } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EDCRequestBodyBuilder.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EDCRequestBodyBuilder.java index dec44768..cb76cb49 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EDCRequestBodyBuilder.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EDCRequestBodyBuilder.java @@ -117,7 +117,7 @@ public JsonNode buildNegotiationRequestBody(String connectorAddress, offerNode.put("assetId", assetId); var policyNode = MAPPER.createObjectNode(); policyNode.put("uid", assetId); - policyNode.set("prohibiitons", MAPPER.createArrayNode()); + policyNode.set("prohibitions", MAPPER.createArrayNode()); policyNode.set("obligations", MAPPER.createArrayNode()); var permissionArray = MAPPER.createArrayNode(); var permissionNode = MAPPER.createObjectNode(); diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockRequestApiController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockRequestApiController.java index db53d710..65d03c4c 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockRequestApiController.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockRequestApiController.java @@ -111,7 +111,7 @@ public ResponseEntity postRequest(@RequestBody String requestBody) { return ResponseEntity.status(422).build(); } - productStockRequest.setState(DT_RequestStateEnum.RECEIPT); + productStockRequest.setState(DT_RequestStateEnum.Received); productStockRequestService.createRequest(productStockRequest); final ProductStockRequest requestForAsyncThread = productStockRequest; @@ -157,7 +157,7 @@ public ResponseEntity getRequest(@RequestBody JsonNode body) { var requestStatus = request.getState(); var jsonResponseBody = objectMapper.createObjectNode(); jsonResponseBody.put("requestId", header.getRequestId().toString()); - jsonResponseBody.put("requestState", requestStatus.STATUSTEXT); + jsonResponseBody.put("requestState", requestStatus.name()); return ResponseEntity.status(200).body(jsonResponseBody); } catch (Exception e) { return ResponseEntity.status(400).build(); diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockResponseApiController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockResponseApiController.java index 7cfe6d08..f9b24f21 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockResponseApiController.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/ProductStockResponseApiController.java @@ -115,7 +115,7 @@ public ResponseEntity postResponse(@RequestBody String body) { return ResponseEntity.status(401).build(); } - productStockRequestService.updateState(productStockRequestFound, DT_RequestStateEnum.COMPLETED); + productStockRequestService.updateState(productStockRequestFound, DT_RequestStateEnum.Completed); productStockResponseApiService.consumeResponse(productStockResponse); // if the request has been correctly taken over, return 202 diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java index b14744bf..92eb8110 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java @@ -356,7 +356,7 @@ public List triggerPartnerProductStockUpdateForMaterial(@RequestPara productStockRequest.setHeader(messageHeader); - productStockRequest.setState(DT_RequestStateEnum.WORKING); + productStockRequest.setState(DT_RequestStateEnum.Working); productStockRequest = productStockRequestService.createRequest(productStockRequest); var test = productStockRequestService.findRequestByHeaderUuid(productStockRequest.getHeader().getRequestId()); log.debug("Stored in Database " + (test != null) + " " + productStockRequest.getHeader().getRequestId()); @@ -366,19 +366,19 @@ public List triggerPartnerProductStockUpdateForMaterial(@RequestPara response = edcAdapterService.sendDataPullRequest(endpoint, authKey, authCode, requestBody); log.debug(response.body().string()); if(response.code() < 400) { - productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.REQUESTED); + productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.Requested); log.debug("Sent request and received HTTP Status code " + response.code()); - log.debug("Setting request state to " + DT_RequestStateEnum.REQUESTED); - productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.REQUESTED); + log.debug("Setting request state to " + DT_RequestStateEnum.Requested); + productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.Requested); } else { log.warn("Received HTTP Status Code " + response.code() + " for request " + productStockRequest.getHeader().getRequestId() + " from " + productStockRequest.getHeader().getReceiver()); - productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.ERROR); + productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.Error); } } catch (Exception e) { log.error("Failed to send data pull request to " + supplierPartner.getEdcUrl(), e); - productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.ERROR); + productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.Error); } finally { try { if(response != null) { diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java index aa500712..9272e8b5 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java @@ -27,7 +27,6 @@ import org.eclipse.tractusx.puris.backend.stock.domain.model.ProductStockRequest; import org.eclipse.tractusx.puris.backend.common.api.domain.model.datatype.DT_RequestStateEnum; import org.eclipse.tractusx.puris.backend.common.api.domain.model.datatype.DT_UseCaseEnum; -import org.eclipse.tractusx.puris.backend.common.api.logic.dto.*; import org.eclipse.tractusx.puris.backend.common.edc.logic.service.EdcAdapterService; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; @@ -115,7 +114,7 @@ public static Predicate distinctByKey( public void handleRequest(ProductStockRequest productStockRequest) { - productStockRequest = productStockRequestService.updateState(productStockRequest,DT_RequestStateEnum.WORKING); + productStockRequest = productStockRequestService.updateState(productStockRequest,DT_RequestStateEnum.Working); String requestingPartnerBpnl = productStockRequest.getHeader().getSender(); Partner requestingPartner = partnerService.findByBpnl(requestingPartnerBpnl); @@ -124,7 +123,7 @@ public void handleRequest(ProductStockRequest productStockRequest) { if (productStockRequest.getHeader().getSenderEdc() != null && !partnerIdsUrl.equals(productStockRequest.getHeader().getSenderEdc())) { log.warn("Partner " + requestingPartner.getName() + " is using unknown idsUrl: " + productStockRequest.getHeader().getSenderEdc()); log.warn("Request will not be processed"); - productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.ERROR); + productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.Error); return; } @@ -228,7 +227,7 @@ public void handleRequest(ProductStockRequest productStockRequest) { var data = edcAdapterService.getContractForResponseApi(partnerIdsUrl); if(data == null) { log.error("Failed to contract response api from " + partnerIdsUrl); - productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.ERROR); + productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.Error); log.info("Request status: \n" + productStockRequest.toString()); return; } @@ -261,10 +260,10 @@ public void handleRequest(ProductStockRequest productStockRequest) { endpoint, authKey, authCode, requestBody); log.info(httpResponse.body().string()); httpResponse.body().close(); - productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.COMPLETED); + productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.Completed); } catch (Exception e) { log.error("Failed to send response to " + response.getHeader().getReceiver(), e); - productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.ERROR); + productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.Error); } finally { log.info("Request status: \n" + productStockRequest.toString()); } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockResponseApiServiceImpl.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockResponseApiServiceImpl.java index 01485f0c..3afb8c83 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockResponseApiServiceImpl.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockResponseApiServiceImpl.java @@ -115,7 +115,7 @@ public void consumeResponse(ProductStockResponse response) { } // Update status - also only MessageContentErrorDtos would be completed - productStockRequestService.updateState(correspondingProductStockRequest, DT_RequestStateEnum.COMPLETED); + productStockRequestService.updateState(correspondingProductStockRequest, DT_RequestStateEnum.Completed); } } From 3fcd83b0d65372638ffa368de9ea490b0d90d71b Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Mon, 28 Aug 2023 15:47:10 +0200 Subject: [PATCH 04/11] refactor: removed unused exception classes --- .../RequestIdAlreadyUsedException.java | 44 ------------------ .../exception/RequestIdNotFoundException.java | 45 ------------------- .../backend/common/edc/logic/dto/EDR_Dto.java | 4 ++ .../service/EndpointDataReferenceService.java | 2 +- .../edc/logic/util/EDCRequestBodyBuilder.java | 2 +- 5 files changed, 6 insertions(+), 91 deletions(-) delete mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/controller/exception/RequestIdAlreadyUsedException.java delete mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/controller/exception/RequestIdNotFoundException.java diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/controller/exception/RequestIdAlreadyUsedException.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/controller/exception/RequestIdAlreadyUsedException.java deleted file mode 100644 index 0cf0daed..00000000 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/controller/exception/RequestIdAlreadyUsedException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. (represented by Fraunhofer ISST) - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.tractusx.puris.backend.common.api.controller.exception; - -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.ResponseStatus; - -import java.util.UUID; - -/** - * Exception for - * {@link org.eclipse.tractusx.puris.backend.common.api.controller.RequestApiController}, if - * there is already a request with given id set in header. - */ -@ResponseStatus(value = HttpStatus.UNPROCESSABLE_ENTITY, reason = "Request ID has already been used.") -public class RequestIdAlreadyUsedException extends RuntimeException { - - /** - * Create AlreadyInUse exception with exception message for specific request - * - * @param requestUuid requestUuid to set in message - */ - public RequestIdAlreadyUsedException(UUID requestUuid) { - super(String.format("Request ID %s has already been used.", requestUuid)); - } -} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/controller/exception/RequestIdNotFoundException.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/controller/exception/RequestIdNotFoundException.java deleted file mode 100644 index a950e474..00000000 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/api/controller/exception/RequestIdNotFoundException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. (represented by Fraunhofer ISST) - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.tractusx.puris.backend.common.api.controller.exception; - -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.ResponseStatus; - -import java.util.UUID; - -/** - * Exception for - * {@link org.eclipse.tractusx.puris.backend.common.api.controller.ResponseApiController}, if no - * request exists for requestId set in header. - */ -@ResponseStatus(value = HttpStatus.UNPROCESSABLE_ENTITY, reason = "No Request for Request ID has" + - " been found.") -public class RequestIdNotFoundException extends RuntimeException { - - /** - * Create NotFound exception with exception message for specific request - * - * @param requestUuid requestUuid to set in message - */ - public RequestIdNotFoundException(UUID requestUuid) { - super(String.format("Request with ID %s not found.", requestUuid)); - } -} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/dto/EDR_Dto.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/dto/EDR_Dto.java index d2f57c4c..9eb672a9 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/dto/EDR_Dto.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/dto/EDR_Dto.java @@ -2,7 +2,11 @@ import lombok.AllArgsConstructor; import lombok.Getter; +import org.eclipse.tractusx.puris.backend.common.edc.logic.service.EndpointDataReferenceService; +/** + * An internal Dto class used by the {@link EndpointDataReferenceService} + */ @AllArgsConstructor @Getter public class EDR_Dto { diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EndpointDataReferenceService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EndpointDataReferenceService.java index 0d4b9cd6..4bfbd3f9 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EndpointDataReferenceService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EndpointDataReferenceService.java @@ -51,7 +51,7 @@ public class EndpointDataReferenceService { * Please note that any data will only be stored for a period of 5 * minutes. * @param transferId - * @param authCode + * @param edr_Dto */ public void save(String transferId, EDR_Dto edr_Dto) { nonpersistantRepository.put(transferId, edr_Dto); diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EDCRequestBodyBuilder.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EDCRequestBodyBuilder.java index cb76cb49..f0244b92 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EDCRequestBodyBuilder.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EDCRequestBodyBuilder.java @@ -185,7 +185,7 @@ public CreateAssetDto buildCreateAssetDtoForApi(DT_ApiMethodEnum method, AssetPropertiesDto apiAssetPropertiesDto = new AssetPropertiesDto(); apiAssetPropertiesDto.setApiBusinessObject(DT_ApiBusinessObjectEnum.PRODUCT_STOCK.PROPERTIES_DESCRIPTION); apiAssetPropertiesDto.setApiPurpose(method.PURPOSE); - apiAssetPropertiesDto.setContentType("appplication/json"); + apiAssetPropertiesDto.setContentType("application/json"); apiAssetPropertiesDto.setId(variablesService.getApiAssetId(method)); apiAssetPropertiesDto.setName(method.NAME); apiAssetPropertiesDto.setType(DT_AssetTypeEnum.api); From a78d7cd94f23575b60f0b1a29990f19428085066 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Mon, 28 Aug 2023 15:53:39 +0200 Subject: [PATCH 05/11] fix: some attributes missed declaration as private --- .../masterdata/domain/model/MaterialPartnerRelation.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/MaterialPartnerRelation.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/MaterialPartnerRelation.java index 1736ff17..f269abb2 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/MaterialPartnerRelation.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/MaterialPartnerRelation.java @@ -35,7 +35,7 @@ public class MaterialPartnerRelation { @EmbeddedId - Key key; + private Key key; private String partnerMaterialNumber; private boolean partnerSuppliesMaterial; @@ -44,12 +44,12 @@ public class MaterialPartnerRelation { @ManyToOne @MapsId("ownMaterialNumber") @JoinColumn(name = "material_ownMaterialNumber") - Material material; + private Material material; @ManyToOne @MapsId("uuid") @JoinColumn(name = "partner_uuid") - Partner partner; + private Partner partner; public MaterialPartnerRelation() { this.key = new Key(); From 5b096980288b5021d049a42c6d71d7ce62561b61 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Mon, 28 Aug 2023 16:17:02 +0200 Subject: [PATCH 06/11] chore: added javadoc to materialpartnerrelation --- .../masterdata/domain/model/MaterialPartnerRelation.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/MaterialPartnerRelation.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/MaterialPartnerRelation.java index f269abb2..978eaf1b 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/MaterialPartnerRelation.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/MaterialPartnerRelation.java @@ -28,6 +28,14 @@ import java.util.Objects; import java.util.UUID; +/** + *

This class represents a relation between an instance of the {@link Material} Entity + * and one instance of the {@link Partner} Entity. For each pair of Material and Partner + * Entities there exists at most one MaterialPartnerRelation.

+ *

This class stores, under which identifier (material number) the Partner knows + * this Material, and whether this Partner is a supplier or a customer of the Material.

+ * + */ @Entity @Getter @Setter From 6f954e63fadf640ed4bbfdcdb3267d399dadeab0 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Tue, 29 Aug 2023 10:50:23 +0200 Subject: [PATCH 07/11] chore: added swagger docs to stockcontroller endpoints, set edr log level to debug --- DEPENDENCIES_BACKEND | 38 ------------------- .../EndpointDataReferenceReceiver.java | 2 +- .../stock/controller/StockController.java | 27 +++++++++++++ 3 files changed, 28 insertions(+), 39 deletions(-) diff --git a/DEPENDENCIES_BACKEND b/DEPENDENCIES_BACKEND index d7ee2ac8..d41e2849 100644 --- a/DEPENDENCIES_BACKEND +++ b/DEPENDENCIES_BACKEND @@ -8,11 +8,8 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.14.1, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.14.1, Apache-2.0, approved, #4699 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.14.1, Apache-2.0, approved, #5938 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.jayway.jsonpath/json-path/2.7.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 -maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.1, BSD-3-Clause, approved, #2590 -maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined maven/mavencentral/io.micrometer/micrometer-commons/1.10.3, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #7333 maven/mavencentral/io.micrometer/micrometer-observation/1.10.3, Apache-2.0, approved, #7331 @@ -21,50 +18,22 @@ maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.9, Apache-2.0, ap maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.9, Apache-2.0, approved, #5919 maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.1, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca -maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.0, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.persistence/jakarta.persistence-api/3.1.0, EPL-2.0 OR BSD-3-Clause AND (EPL-2.0 OR BSD-3-Clause AND BSD-3-Clause), approved, #7696 maven/mavencentral/jakarta.transaction/jakarta.transaction-api/2.0.1, EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0, approved, #7697 maven/mavencentral/jakarta.validation/jakarta.validation-api/3.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/4.0.0, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.12.22, Apache-2.0, approved, #1810 -maven/mavencentral/net.bytebuddy/byte-buddy/1.12.22, Apache-2.0 AND BSD-3-Clause, approved, #1811 -maven/mavencentral/net.minidev/accessors-smart/2.4.8, Apache-2.0, approved, #7515 -maven/mavencentral/net.minidev/json-smart/2.4.8, Apache-2.0, approved, #3288 -maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.19.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.19.0, Apache-2.0, approved, #5941 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.5, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.5, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.5, Apache-2.0, approved, #7920 -maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.19, EPL-1.0, approved, tools.aspectj -maven/mavencentral/org.assertj/assertj-core/3.23.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.eclipse.angus/angus-activation/1.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus -maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.1, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.1, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/org.glassfish.jaxb/txw2/4.0.1, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined -maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.2.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.1.6.Final, LGPL-2.1-or-later AND (Apache-2.0 AND LGPL-2.1-only) AND (CC-PDDC AND LGPL-2.1-only) AND (EPL-2.0 OR BSD-3-Clause), approved, #5939 maven/mavencentral/org.hibernate.validator/hibernate-validator/8.0.0.Final, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.hsqldb/hsqldb/2.7.1, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.jboss.logging/jboss-logging/3.5.0.Final, Apache-2.0, approved, #9471 -maven/mavencentral/org.jboss/jandex/2.4.2.Final, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.9.2, EPL-2.0, approved, #3133 -maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.9.2, EPL-2.0, approved, #3125 -maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.9.2, EPL-2.0, approved, #3134 -maven/mavencentral/org.junit.jupiter/junit-jupiter/5.9.2, EPL-2.0, approved, #6972 -maven/mavencentral/org.junit.platform/junit-platform-commons/1.9.2, EPL-2.0, approved, #3130 -maven/mavencentral/org.junit.platform/junit-platform-engine/1.9.2, EPL-2.0, approved, #3128 -maven/mavencentral/org.mockito/mockito-core/4.8.1, MIT, approved, clearlydefined -maven/mavencentral/org.mockito/mockito-junit-jupiter/4.8.1, MIT, approved, clearlydefined maven/mavencentral/org.modelmapper/modelmapper/3.1.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.objenesis/objenesis/3.2, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.ow2.asm/asm/9.1, BSD-3-Clause, approved, CQ23029 maven/mavencentral/org.projectlombok/lombok/1.18.24, MIT AND LicenseRef-Public-Domain, approved, CQ23907 -maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.6, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.6, MIT, approved, #5915 maven/mavencentral/org.springdoc/springdoc-openapi-starter-common/2.1.0, Apache-2.0, approved, clearlydefined @@ -72,26 +41,21 @@ maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-api/2.1.0, Apa maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-ui/2.1.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.0.2, Apache-2.0, approved, #6981 maven/mavencentral/org.springframework.boot/spring-boot-configuration-processor/3.0.2, Apache-2.0, approved, #6973 -maven/mavencentral/org.springframework.boot/spring-boot-devtools/3.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.0.2, Apache-2.0, approved, #6965 maven/mavencentral/org.springframework.boot/spring-boot-starter-data-jpa/3.0.2, Apache-2.0, approved, #7351 maven/mavencentral/org.springframework.boot/spring-boot-starter-jdbc/3.0.2, Apache-2.0, approved, #6974 maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.0.2, Apache-2.0, approved, #7006 maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.0.2, Apache-2.0, approved, #6982 maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.0.2, Apache-2.0, approved, #7329 -maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.0.2, Apache-2.0, approved, #7001 maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.0.2, Apache-2.0, approved, #6987 maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.0.2, Apache-2.0, approved, #5945 maven/mavencentral/org.springframework.boot/spring-boot-starter/3.0.2, Apache-2.0, approved, #7330 -maven/mavencentral/org.springframework.boot/spring-boot-test-autoconfigure/3.0.2, Apache-2.0, approved, #6966 -maven/mavencentral/org.springframework.boot/spring-boot-test/3.0.2, Apache-2.0, approved, #6976 maven/mavencentral/org.springframework.boot/spring-boot/3.0.2, Apache-2.0, approved, #7327 maven/mavencentral/org.springframework.data/spring-data-commons/3.0.1, Apache-2.0, approved, #5943 maven/mavencentral/org.springframework.data/spring-data-jpa/3.0.1, Apache-2.0, approved, #5935 maven/mavencentral/org.springframework.security/spring-security-config/6.0.1, Apache-2.0, approved, #7338 maven/mavencentral/org.springframework.security/spring-security-core/6.0.1, Apache-2.0, approved, #7325 maven/mavencentral/org.springframework.security/spring-security-crypto/6.0.1, Apache-2.0 AND ISC, approved, #7326 -maven/mavencentral/org.springframework.security/spring-security-test/6.0.1, Apache-2.0, approved, #7402 maven/mavencentral/org.springframework.security/spring-security-web/6.0.1, Apache-2.0, approved, #7328 maven/mavencentral/org.springframework.session/spring-session-core/3.0.0, Apache-2.0, approved, #7858 maven/mavencentral/org.springframework/spring-aop/6.0.4, Apache-2.0, approved, #5940 @@ -103,10 +67,8 @@ maven/mavencentral/org.springframework/spring-expression/6.0.4, Apache-2.0, appr maven/mavencentral/org.springframework/spring-jcl/6.0.4, Apache-2.0, approved, #3283 maven/mavencentral/org.springframework/spring-jdbc/6.0.4, Apache-2.0, approved, #5924 maven/mavencentral/org.springframework/spring-orm/6.0.4, Apache-2.0, approved, #5925 -maven/mavencentral/org.springframework/spring-test/6.0.4, Apache-2.0, approved, #7003 maven/mavencentral/org.springframework/spring-tx/6.0.4, Apache-2.0, approved, #5926 maven/mavencentral/org.springframework/spring-web/6.0.4, Apache-2.0, approved, #5942 maven/mavencentral/org.springframework/spring-webmvc/6.0.4, Apache-2.0, approved, #5944 maven/mavencentral/org.webjars/swagger-ui/4.18.2, Apache-2.0, approved, #7850 -maven/mavencentral/org.xmlunit/xmlunit-core/2.9.1, Apache-2.0, approved, #6272 maven/mavencentral/org.yaml/snakeyaml/1.33, Apache-2.0, approved, clearlydefined diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EndpointDataReferenceReceiver.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EndpointDataReferenceReceiver.java index 82c0ed40..7f928aca 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EndpointDataReferenceReceiver.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EndpointDataReferenceReceiver.java @@ -76,7 +76,7 @@ public class EndpointDataReferenceReceiver { @ApiResponse(responseCode = "400", description = "Received invalid message") }) private ResponseEntity authCodeReceivingEndpoint(@RequestBody JsonNode body) { - log.info("Received edr data:\n" + body.toPrettyString()); + log.debug("Received edr data:\n" + body.toPrettyString()); String transferId = body.get("id").asText(); String authKey = body.get("authKey").asText(); String authCode = body.get("authCode").asText(); diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java index 92eb8110..2e21c175 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/controller/StockController.java @@ -23,6 +23,11 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.squareup.okhttp.Response; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.puris.backend.common.api.domain.model.MessageHeader; import org.eclipse.tractusx.puris.backend.common.api.domain.model.datatype.DT_RequestStateEnum; @@ -112,6 +117,7 @@ public class StockController { @CrossOrigin @GetMapping("materials") @ResponseBody + @Operation(description = "Returns a list of all materials (excluding products)") public List getMaterials() { return materialService.findAllMaterials() .stream() @@ -122,6 +128,13 @@ public List getMaterials() { @CrossOrigin @GetMapping("materialnumbers-mapping") @ResponseBody + @Operation(description = "Returns a mapping of all material numbers, that others partners are using" + + "for the material given in the request parameter.") + @ApiResponses(value = {@ApiResponse(content = @Content(examples = { + @ExampleObject(name = "Basic sample", value = "{" + + " \"BPNL1234567890ZZ\": \"MNR-8101-ID146955.001\"," + + " \"BPNL4444444444XX\": \"MNR-7307-AU340474.002\"}") + }))}) public Map getMaterialNumbers(@RequestParam String ownMaterialNumber) { return mprService.getBPNL_To_MaterialNumberMap(ownMaterialNumber); } @@ -129,6 +142,7 @@ public Map getMaterialNumbers(@RequestParam String ownMaterialNu @CrossOrigin @GetMapping("products") @ResponseBody + @Operation(description = "Returns a list of all products (excluding materials)") public List getProducts() { return materialService.findAllProducts() .stream() @@ -139,6 +153,7 @@ public List getProducts() { @CrossOrigin @GetMapping("product-stocks") @ResponseBody + @Operation(description = "Returns a list of all product-stocks") public List getProductStocks() { List allProductStocks = productStockService.findAll().stream() .map(this::convertToDto) @@ -150,6 +165,7 @@ public List getProductStocks() { @CrossOrigin @PostMapping("product-stocks") @ResponseBody + @Operation(description = "Creates a new product-stock") public ProductStockDto createProductStocks(@RequestBody ProductStockDto productStockDto) { ProductStock productStockToCreate = convertToEntity(productStockDto); @@ -170,6 +186,7 @@ public ProductStockDto createProductStocks(@RequestBody ProductStockDto productS @CrossOrigin @PutMapping("product-stocks") @ResponseBody + @Operation(description = "Updates an existing product-stock") public ProductStockDto updateProductStocks(@RequestBody ProductStockDto productStockDto) { ProductStock existingProductStock = productStockService.findByUuid(productStockDto.getUuid()); if (existingProductStock.getUuid() == null) { @@ -206,6 +223,7 @@ private ProductStock convertToEntity(ProductStockDto dto) { @CrossOrigin @GetMapping("material-stocks") @ResponseBody + @Operation(description = "Returns a list of all material-stocks") public List getMaterialStocks() { List allMaterialStocks = materialStockService.findAll().stream() .map(this::convertToDto) @@ -217,6 +235,7 @@ public List getMaterialStocks() { @CrossOrigin @PostMapping("material-stocks") @ResponseBody + @Operation(description = "Creates a new material-stock") public MaterialStockDto createMaterialStocks(@RequestBody MaterialStockDto materialStockDto) { MaterialStock materialStockToCreate = convertToEntity(materialStockDto); @@ -232,6 +251,7 @@ public MaterialStockDto createMaterialStocks(@RequestBody MaterialStockDto mater @CrossOrigin @PutMapping("material-stocks") @ResponseBody + @Operation(description = "Updates an existing material-stock") public MaterialStockDto updateMaterialStocks(@RequestBody MaterialStockDto materialStockDto) { MaterialStock existingMaterialStock = materialStockService.findByUuid(materialStockDto.getUuid()); if (existingMaterialStock == null || existingMaterialStock.getUuid() == null) { @@ -265,6 +285,7 @@ private MaterialStock convertToEntity(MaterialStockDto dto) { @CrossOrigin @GetMapping("partner-product-stocks") @ResponseBody + @Operation(description = "Returns a list of all partner-product-stocks that refer to the given material number") public List getPartnerProductStocks(@RequestParam String ownMaterialNumber) { return partnerProductStockService. findAllByOwnMaterialNumber(ownMaterialNumber) @@ -287,6 +308,7 @@ private PartnerProductStockDto convertToDto(PartnerProductStock entity) { @CrossOrigin @GetMapping("customer") @ResponseBody + @Operation(description = "Returns a list of all Partners that are ordering the given material") public List getCustomerPartnersOrderingMaterial(@RequestParam String ownMaterialNumber) { List allCustomerPartners = partnerService.findAllCustomerPartnersForMaterialId(ownMaterialNumber).stream() .map(this::convertToDto) @@ -297,6 +319,11 @@ public List getCustomerPartnersOrderingMaterial(@RequestParam String @CrossOrigin @GetMapping("update-partner-product-stock") @ResponseBody + @Operation(description = "For the given material, all known suppliers will be requested to report their" + + "current product-stocks. The response body contains a list of those supplier partners that were sent a request." + + "Please note that these requests are handled asynchronously by the partners, so there are no guarantees, if and " + + "when the corresponding responses will be available. As soon as a response arrives, it will be available via a " + + "call to the GET partner-product-stocks endpoint.") public List triggerPartnerProductStockUpdateForMaterial(@RequestParam String ownMaterialNumber) { Material materialEntity = materialService.findByOwnMaterialNumber(ownMaterialNumber); From 901427e86bbf5e4e5f90d77ca4ab40eb82278430 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 30 Aug 2023 15:08:59 +0200 Subject: [PATCH 08/11] fix: some minor fixes as required by review --- DEPENDENCIES_BACKEND | 38 +++++++++++++++++++ .../backend/common/edc/logic/dto/EDR_Dto.java | 16 +++++++- .../masterdata/domain/model/Material.java | 4 +- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/DEPENDENCIES_BACKEND b/DEPENDENCIES_BACKEND index d41e2849..d7ee2ac8 100644 --- a/DEPENDENCIES_BACKEND +++ b/DEPENDENCIES_BACKEND @@ -8,8 +8,11 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.14.1, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.14.1, Apache-2.0, approved, #4699 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.14.1, Apache-2.0, approved, #5938 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.jayway.jsonpath/json-path/2.7.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 +maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.1, BSD-3-Clause, approved, #2590 +maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined maven/mavencentral/io.micrometer/micrometer-commons/1.10.3, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #7333 maven/mavencentral/io.micrometer/micrometer-observation/1.10.3, Apache-2.0, approved, #7331 @@ -18,22 +21,50 @@ maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.9, Apache-2.0, ap maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.9, Apache-2.0, approved, #5919 maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.1, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca +maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.0, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.persistence/jakarta.persistence-api/3.1.0, EPL-2.0 OR BSD-3-Clause AND (EPL-2.0 OR BSD-3-Clause AND BSD-3-Clause), approved, #7696 maven/mavencentral/jakarta.transaction/jakarta.transaction-api/2.0.1, EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0, approved, #7697 maven/mavencentral/jakarta.validation/jakarta.validation-api/3.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/4.0.0, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.12.22, Apache-2.0, approved, #1810 +maven/mavencentral/net.bytebuddy/byte-buddy/1.12.22, Apache-2.0 AND BSD-3-Clause, approved, #1811 +maven/mavencentral/net.minidev/accessors-smart/2.4.8, Apache-2.0, approved, #7515 +maven/mavencentral/net.minidev/json-smart/2.4.8, Apache-2.0, approved, #3288 +maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.19.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.19.0, Apache-2.0, approved, #5941 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.5, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.5, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.5, Apache-2.0, approved, #7920 +maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.19, EPL-1.0, approved, tools.aspectj +maven/mavencentral/org.assertj/assertj-core/3.23.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.eclipse.angus/angus-activation/1.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus +maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.1, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.1, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/org.glassfish.jaxb/txw2/4.0.1, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined +maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.2.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.1.6.Final, LGPL-2.1-or-later AND (Apache-2.0 AND LGPL-2.1-only) AND (CC-PDDC AND LGPL-2.1-only) AND (EPL-2.0 OR BSD-3-Clause), approved, #5939 maven/mavencentral/org.hibernate.validator/hibernate-validator/8.0.0.Final, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.hsqldb/hsqldb/2.7.1, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.jboss.logging/jboss-logging/3.5.0.Final, Apache-2.0, approved, #9471 +maven/mavencentral/org.jboss/jandex/2.4.2.Final, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.9.2, EPL-2.0, approved, #3133 +maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.9.2, EPL-2.0, approved, #3125 +maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.9.2, EPL-2.0, approved, #3134 +maven/mavencentral/org.junit.jupiter/junit-jupiter/5.9.2, EPL-2.0, approved, #6972 +maven/mavencentral/org.junit.platform/junit-platform-commons/1.9.2, EPL-2.0, approved, #3130 +maven/mavencentral/org.junit.platform/junit-platform-engine/1.9.2, EPL-2.0, approved, #3128 +maven/mavencentral/org.mockito/mockito-core/4.8.1, MIT, approved, clearlydefined +maven/mavencentral/org.mockito/mockito-junit-jupiter/4.8.1, MIT, approved, clearlydefined maven/mavencentral/org.modelmapper/modelmapper/3.1.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.objenesis/objenesis/3.2, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.ow2.asm/asm/9.1, BSD-3-Clause, approved, CQ23029 maven/mavencentral/org.projectlombok/lombok/1.18.24, MIT AND LicenseRef-Public-Domain, approved, CQ23907 +maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.6, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.6, MIT, approved, #5915 maven/mavencentral/org.springdoc/springdoc-openapi-starter-common/2.1.0, Apache-2.0, approved, clearlydefined @@ -41,21 +72,26 @@ maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-api/2.1.0, Apa maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-ui/2.1.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.0.2, Apache-2.0, approved, #6981 maven/mavencentral/org.springframework.boot/spring-boot-configuration-processor/3.0.2, Apache-2.0, approved, #6973 +maven/mavencentral/org.springframework.boot/spring-boot-devtools/3.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.0.2, Apache-2.0, approved, #6965 maven/mavencentral/org.springframework.boot/spring-boot-starter-data-jpa/3.0.2, Apache-2.0, approved, #7351 maven/mavencentral/org.springframework.boot/spring-boot-starter-jdbc/3.0.2, Apache-2.0, approved, #6974 maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.0.2, Apache-2.0, approved, #7006 maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.0.2, Apache-2.0, approved, #6982 maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.0.2, Apache-2.0, approved, #7329 +maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.0.2, Apache-2.0, approved, #7001 maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.0.2, Apache-2.0, approved, #6987 maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.0.2, Apache-2.0, approved, #5945 maven/mavencentral/org.springframework.boot/spring-boot-starter/3.0.2, Apache-2.0, approved, #7330 +maven/mavencentral/org.springframework.boot/spring-boot-test-autoconfigure/3.0.2, Apache-2.0, approved, #6966 +maven/mavencentral/org.springframework.boot/spring-boot-test/3.0.2, Apache-2.0, approved, #6976 maven/mavencentral/org.springframework.boot/spring-boot/3.0.2, Apache-2.0, approved, #7327 maven/mavencentral/org.springframework.data/spring-data-commons/3.0.1, Apache-2.0, approved, #5943 maven/mavencentral/org.springframework.data/spring-data-jpa/3.0.1, Apache-2.0, approved, #5935 maven/mavencentral/org.springframework.security/spring-security-config/6.0.1, Apache-2.0, approved, #7338 maven/mavencentral/org.springframework.security/spring-security-core/6.0.1, Apache-2.0, approved, #7325 maven/mavencentral/org.springframework.security/spring-security-crypto/6.0.1, Apache-2.0 AND ISC, approved, #7326 +maven/mavencentral/org.springframework.security/spring-security-test/6.0.1, Apache-2.0, approved, #7402 maven/mavencentral/org.springframework.security/spring-security-web/6.0.1, Apache-2.0, approved, #7328 maven/mavencentral/org.springframework.session/spring-session-core/3.0.0, Apache-2.0, approved, #7858 maven/mavencentral/org.springframework/spring-aop/6.0.4, Apache-2.0, approved, #5940 @@ -67,8 +103,10 @@ maven/mavencentral/org.springframework/spring-expression/6.0.4, Apache-2.0, appr maven/mavencentral/org.springframework/spring-jcl/6.0.4, Apache-2.0, approved, #3283 maven/mavencentral/org.springframework/spring-jdbc/6.0.4, Apache-2.0, approved, #5924 maven/mavencentral/org.springframework/spring-orm/6.0.4, Apache-2.0, approved, #5925 +maven/mavencentral/org.springframework/spring-test/6.0.4, Apache-2.0, approved, #7003 maven/mavencentral/org.springframework/spring-tx/6.0.4, Apache-2.0, approved, #5926 maven/mavencentral/org.springframework/spring-web/6.0.4, Apache-2.0, approved, #5942 maven/mavencentral/org.springframework/spring-webmvc/6.0.4, Apache-2.0, approved, #5944 maven/mavencentral/org.webjars/swagger-ui/4.18.2, Apache-2.0, approved, #7850 +maven/mavencentral/org.xmlunit/xmlunit-core/2.9.1, Apache-2.0, approved, #6272 maven/mavencentral/org.yaml/snakeyaml/1.33, Apache-2.0, approved, clearlydefined diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/dto/EDR_Dto.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/dto/EDR_Dto.java index 9eb672a9..65b20390 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/dto/EDR_Dto.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/dto/EDR_Dto.java @@ -5,16 +5,30 @@ import org.eclipse.tractusx.puris.backend.common.edc.logic.service.EndpointDataReferenceService; /** - * An internal Dto class used by the {@link EndpointDataReferenceService} + * An internal, immutable Dto class used by the {@link EndpointDataReferenceService} + * It contains an authKey, authCode and endpoint. */ @AllArgsConstructor @Getter public class EDR_Dto { + /** + * This defines the key, under which the + * authCode is to be sent to the data plane. + * For example: "Authorization" + */ private final String authKey; + /** + * This is the secret key to be sent + * to the data plane. + */ private final String authCode; + /** + * The address of the data plane that has + * to handle the consumer pull. + */ private final String endpoint; } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Material.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Material.java index 341a1334..614e2d47 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Material.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Material.java @@ -49,7 +49,7 @@ * to sell it immediately to another partner.

*

Each entity of this class is uniquely identified by the material number defined * by the partner that runs an instance of the PURIS app.

- *

A certain type of semiconductors is produced by partner A. He has labeled his + *

Example: A certain type of semiconductors is produced by partner A. He has labeled his * product with the material number "SC-456.001". Partner B is buying this type of * semiconductors from A. In his own ERP-System, he is referring to this semiconductor * as "A-CHIP-0815".

@@ -58,7 +58,7 @@ * that Partner C now wants to buy this material from A as well. In his own domain, C names * this material "XYZ-123". Therefore C will register the material under this ownMaterialNumber * in his own PURIS app.

- *

When two partner are preparing to establish a business relationship in regard to a specific + *

When two partners are preparing to establish a business relationship in regard to a specific * material, then each partner will create a {@link MaterialPartnerRelation}, where he * designates the other partner as supplier or customer of this entity. He also must define, * under which material number his partner refers to this material.

From 903afbd8fabb85c8742c73849159ed49445c74fa Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 30 Aug 2023 15:13:47 +0200 Subject: [PATCH 09/11] fix: forgot javadocs on some partner attributes --- .../puris/backend/masterdata/domain/model/Partner.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Partner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Partner.java index f56b35f0..f82dcec5 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Partner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Partner.java @@ -50,7 +50,13 @@ public class Partner { * The full name of the partner. */ private String name; + /** + * The EDC-URL of the partner. + */ private String edcUrl; + /** + * The BPNL of the partner. + */ private String bpnl; private String siteBpns; From fbefdcc3f4a4ad6940452d2ea03dd863adbeaf75 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Thu, 31 Aug 2023 13:58:49 +0200 Subject: [PATCH 10/11] fix: forgot to create javadocs in productstockrequestapiserviceimpl --- DEPENDENCIES_BACKEND | 38 ------------------- .../ProductStockRequestApiServiceImpl.java | 12 ++++++ 2 files changed, 12 insertions(+), 38 deletions(-) diff --git a/DEPENDENCIES_BACKEND b/DEPENDENCIES_BACKEND index d7ee2ac8..d41e2849 100644 --- a/DEPENDENCIES_BACKEND +++ b/DEPENDENCIES_BACKEND @@ -8,11 +8,8 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.14.1, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.14.1, Apache-2.0, approved, #4699 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.14.1, Apache-2.0, approved, #5938 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.jayway.jsonpath/json-path/2.7.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 -maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.1, BSD-3-Clause, approved, #2590 -maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined maven/mavencentral/io.micrometer/micrometer-commons/1.10.3, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #7333 maven/mavencentral/io.micrometer/micrometer-observation/1.10.3, Apache-2.0, approved, #7331 @@ -21,50 +18,22 @@ maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.9, Apache-2.0, ap maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.9, Apache-2.0, approved, #5919 maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.1, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca -maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.0, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.persistence/jakarta.persistence-api/3.1.0, EPL-2.0 OR BSD-3-Clause AND (EPL-2.0 OR BSD-3-Clause AND BSD-3-Clause), approved, #7696 maven/mavencentral/jakarta.transaction/jakarta.transaction-api/2.0.1, EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0, approved, #7697 maven/mavencentral/jakarta.validation/jakarta.validation-api/3.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/4.0.0, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.12.22, Apache-2.0, approved, #1810 -maven/mavencentral/net.bytebuddy/byte-buddy/1.12.22, Apache-2.0 AND BSD-3-Clause, approved, #1811 -maven/mavencentral/net.minidev/accessors-smart/2.4.8, Apache-2.0, approved, #7515 -maven/mavencentral/net.minidev/json-smart/2.4.8, Apache-2.0, approved, #3288 -maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.19.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.19.0, Apache-2.0, approved, #5941 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.5, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.5, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.5, Apache-2.0, approved, #7920 -maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.19, EPL-1.0, approved, tools.aspectj -maven/mavencentral/org.assertj/assertj-core/3.23.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.eclipse.angus/angus-activation/1.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus -maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.1, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.1, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/org.glassfish.jaxb/txw2/4.0.1, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined -maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.2.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.1.6.Final, LGPL-2.1-or-later AND (Apache-2.0 AND LGPL-2.1-only) AND (CC-PDDC AND LGPL-2.1-only) AND (EPL-2.0 OR BSD-3-Clause), approved, #5939 maven/mavencentral/org.hibernate.validator/hibernate-validator/8.0.0.Final, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.hsqldb/hsqldb/2.7.1, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.jboss.logging/jboss-logging/3.5.0.Final, Apache-2.0, approved, #9471 -maven/mavencentral/org.jboss/jandex/2.4.2.Final, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.9.2, EPL-2.0, approved, #3133 -maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.9.2, EPL-2.0, approved, #3125 -maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.9.2, EPL-2.0, approved, #3134 -maven/mavencentral/org.junit.jupiter/junit-jupiter/5.9.2, EPL-2.0, approved, #6972 -maven/mavencentral/org.junit.platform/junit-platform-commons/1.9.2, EPL-2.0, approved, #3130 -maven/mavencentral/org.junit.platform/junit-platform-engine/1.9.2, EPL-2.0, approved, #3128 -maven/mavencentral/org.mockito/mockito-core/4.8.1, MIT, approved, clearlydefined -maven/mavencentral/org.mockito/mockito-junit-jupiter/4.8.1, MIT, approved, clearlydefined maven/mavencentral/org.modelmapper/modelmapper/3.1.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.objenesis/objenesis/3.2, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.ow2.asm/asm/9.1, BSD-3-Clause, approved, CQ23029 maven/mavencentral/org.projectlombok/lombok/1.18.24, MIT AND LicenseRef-Public-Domain, approved, CQ23907 -maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.6, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.6, MIT, approved, #5915 maven/mavencentral/org.springdoc/springdoc-openapi-starter-common/2.1.0, Apache-2.0, approved, clearlydefined @@ -72,26 +41,21 @@ maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-api/2.1.0, Apa maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-ui/2.1.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.0.2, Apache-2.0, approved, #6981 maven/mavencentral/org.springframework.boot/spring-boot-configuration-processor/3.0.2, Apache-2.0, approved, #6973 -maven/mavencentral/org.springframework.boot/spring-boot-devtools/3.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.0.2, Apache-2.0, approved, #6965 maven/mavencentral/org.springframework.boot/spring-boot-starter-data-jpa/3.0.2, Apache-2.0, approved, #7351 maven/mavencentral/org.springframework.boot/spring-boot-starter-jdbc/3.0.2, Apache-2.0, approved, #6974 maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.0.2, Apache-2.0, approved, #7006 maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.0.2, Apache-2.0, approved, #6982 maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.0.2, Apache-2.0, approved, #7329 -maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.0.2, Apache-2.0, approved, #7001 maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.0.2, Apache-2.0, approved, #6987 maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.0.2, Apache-2.0, approved, #5945 maven/mavencentral/org.springframework.boot/spring-boot-starter/3.0.2, Apache-2.0, approved, #7330 -maven/mavencentral/org.springframework.boot/spring-boot-test-autoconfigure/3.0.2, Apache-2.0, approved, #6966 -maven/mavencentral/org.springframework.boot/spring-boot-test/3.0.2, Apache-2.0, approved, #6976 maven/mavencentral/org.springframework.boot/spring-boot/3.0.2, Apache-2.0, approved, #7327 maven/mavencentral/org.springframework.data/spring-data-commons/3.0.1, Apache-2.0, approved, #5943 maven/mavencentral/org.springframework.data/spring-data-jpa/3.0.1, Apache-2.0, approved, #5935 maven/mavencentral/org.springframework.security/spring-security-config/6.0.1, Apache-2.0, approved, #7338 maven/mavencentral/org.springframework.security/spring-security-core/6.0.1, Apache-2.0, approved, #7325 maven/mavencentral/org.springframework.security/spring-security-crypto/6.0.1, Apache-2.0 AND ISC, approved, #7326 -maven/mavencentral/org.springframework.security/spring-security-test/6.0.1, Apache-2.0, approved, #7402 maven/mavencentral/org.springframework.security/spring-security-web/6.0.1, Apache-2.0, approved, #7328 maven/mavencentral/org.springframework.session/spring-session-core/3.0.0, Apache-2.0, approved, #7858 maven/mavencentral/org.springframework/spring-aop/6.0.4, Apache-2.0, approved, #5940 @@ -103,10 +67,8 @@ maven/mavencentral/org.springframework/spring-expression/6.0.4, Apache-2.0, appr maven/mavencentral/org.springframework/spring-jcl/6.0.4, Apache-2.0, approved, #3283 maven/mavencentral/org.springframework/spring-jdbc/6.0.4, Apache-2.0, approved, #5924 maven/mavencentral/org.springframework/spring-orm/6.0.4, Apache-2.0, approved, #5925 -maven/mavencentral/org.springframework/spring-test/6.0.4, Apache-2.0, approved, #7003 maven/mavencentral/org.springframework/spring-tx/6.0.4, Apache-2.0, approved, #5926 maven/mavencentral/org.springframework/spring-web/6.0.4, Apache-2.0, approved, #5942 maven/mavencentral/org.springframework/spring-webmvc/6.0.4, Apache-2.0, approved, #5944 maven/mavencentral/org.webjars/swagger-ui/4.18.2, Apache-2.0, approved, #7850 -maven/mavencentral/org.xmlunit/xmlunit-core/2.9.1, Apache-2.0, approved, #6272 maven/mavencentral/org.yaml/snakeyaml/1.33, Apache-2.0, approved, clearlydefined diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java index 9272e8b5..1576c912 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java @@ -112,6 +112,18 @@ public static Predicate distinctByKey( } + /** + * This method should be called in a separate Thread. + * + * It will evaluate the given ProductStockRequest and check, whether this Partner is + * currently known as a customer for the given products. Then this method will assemble + * all necessary information from database, generate ProductStockSammDto's and then send + * them to the Partner via his product-stock-response-api. + * + *

Please note that this method currently does not support multple BPNS's/BPNA's per Partner.

+ * + * @param productStockRequest a ProductStockRequest you received from a Customer Partner + */ public void handleRequest(ProductStockRequest productStockRequest) { productStockRequest = productStockRequestService.updateState(productStockRequest,DT_RequestStateEnum.Working); From 0e5322c95f5b85c9d95bc07e22deded7101bf82d Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Tue, 5 Sep 2023 09:30:48 +0200 Subject: [PATCH 11/11] chore: updated dependencies_backend --- DEPENDENCIES_BACKEND | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/DEPENDENCIES_BACKEND b/DEPENDENCIES_BACKEND index d41e2849..d7ee2ac8 100644 --- a/DEPENDENCIES_BACKEND +++ b/DEPENDENCIES_BACKEND @@ -8,8 +8,11 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.14.1, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.14.1, Apache-2.0, approved, #4699 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.14.1, Apache-2.0, approved, #5938 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.jayway.jsonpath/json-path/2.7.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 +maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.1, BSD-3-Clause, approved, #2590 +maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined maven/mavencentral/io.micrometer/micrometer-commons/1.10.3, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #7333 maven/mavencentral/io.micrometer/micrometer-observation/1.10.3, Apache-2.0, approved, #7331 @@ -18,22 +21,50 @@ maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.9, Apache-2.0, ap maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.9, Apache-2.0, approved, #5919 maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.1, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca +maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.0, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.persistence/jakarta.persistence-api/3.1.0, EPL-2.0 OR BSD-3-Clause AND (EPL-2.0 OR BSD-3-Clause AND BSD-3-Clause), approved, #7696 maven/mavencentral/jakarta.transaction/jakarta.transaction-api/2.0.1, EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0, approved, #7697 maven/mavencentral/jakarta.validation/jakarta.validation-api/3.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/4.0.0, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.12.22, Apache-2.0, approved, #1810 +maven/mavencentral/net.bytebuddy/byte-buddy/1.12.22, Apache-2.0 AND BSD-3-Clause, approved, #1811 +maven/mavencentral/net.minidev/accessors-smart/2.4.8, Apache-2.0, approved, #7515 +maven/mavencentral/net.minidev/json-smart/2.4.8, Apache-2.0, approved, #3288 +maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.19.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.19.0, Apache-2.0, approved, #5941 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.5, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.5, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.5, Apache-2.0, approved, #7920 +maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.19, EPL-1.0, approved, tools.aspectj +maven/mavencentral/org.assertj/assertj-core/3.23.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.eclipse.angus/angus-activation/1.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus +maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.1, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.1, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/org.glassfish.jaxb/txw2/4.0.1, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined +maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.2.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.1.6.Final, LGPL-2.1-or-later AND (Apache-2.0 AND LGPL-2.1-only) AND (CC-PDDC AND LGPL-2.1-only) AND (EPL-2.0 OR BSD-3-Clause), approved, #5939 maven/mavencentral/org.hibernate.validator/hibernate-validator/8.0.0.Final, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.hsqldb/hsqldb/2.7.1, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.jboss.logging/jboss-logging/3.5.0.Final, Apache-2.0, approved, #9471 +maven/mavencentral/org.jboss/jandex/2.4.2.Final, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.9.2, EPL-2.0, approved, #3133 +maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.9.2, EPL-2.0, approved, #3125 +maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.9.2, EPL-2.0, approved, #3134 +maven/mavencentral/org.junit.jupiter/junit-jupiter/5.9.2, EPL-2.0, approved, #6972 +maven/mavencentral/org.junit.platform/junit-platform-commons/1.9.2, EPL-2.0, approved, #3130 +maven/mavencentral/org.junit.platform/junit-platform-engine/1.9.2, EPL-2.0, approved, #3128 +maven/mavencentral/org.mockito/mockito-core/4.8.1, MIT, approved, clearlydefined +maven/mavencentral/org.mockito/mockito-junit-jupiter/4.8.1, MIT, approved, clearlydefined maven/mavencentral/org.modelmapper/modelmapper/3.1.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.objenesis/objenesis/3.2, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.ow2.asm/asm/9.1, BSD-3-Clause, approved, CQ23029 maven/mavencentral/org.projectlombok/lombok/1.18.24, MIT AND LicenseRef-Public-Domain, approved, CQ23907 +maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.6, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.6, MIT, approved, #5915 maven/mavencentral/org.springdoc/springdoc-openapi-starter-common/2.1.0, Apache-2.0, approved, clearlydefined @@ -41,21 +72,26 @@ maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-api/2.1.0, Apa maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-ui/2.1.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.0.2, Apache-2.0, approved, #6981 maven/mavencentral/org.springframework.boot/spring-boot-configuration-processor/3.0.2, Apache-2.0, approved, #6973 +maven/mavencentral/org.springframework.boot/spring-boot-devtools/3.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.0.2, Apache-2.0, approved, #6965 maven/mavencentral/org.springframework.boot/spring-boot-starter-data-jpa/3.0.2, Apache-2.0, approved, #7351 maven/mavencentral/org.springframework.boot/spring-boot-starter-jdbc/3.0.2, Apache-2.0, approved, #6974 maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.0.2, Apache-2.0, approved, #7006 maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.0.2, Apache-2.0, approved, #6982 maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.0.2, Apache-2.0, approved, #7329 +maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.0.2, Apache-2.0, approved, #7001 maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.0.2, Apache-2.0, approved, #6987 maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.0.2, Apache-2.0, approved, #5945 maven/mavencentral/org.springframework.boot/spring-boot-starter/3.0.2, Apache-2.0, approved, #7330 +maven/mavencentral/org.springframework.boot/spring-boot-test-autoconfigure/3.0.2, Apache-2.0, approved, #6966 +maven/mavencentral/org.springframework.boot/spring-boot-test/3.0.2, Apache-2.0, approved, #6976 maven/mavencentral/org.springframework.boot/spring-boot/3.0.2, Apache-2.0, approved, #7327 maven/mavencentral/org.springframework.data/spring-data-commons/3.0.1, Apache-2.0, approved, #5943 maven/mavencentral/org.springframework.data/spring-data-jpa/3.0.1, Apache-2.0, approved, #5935 maven/mavencentral/org.springframework.security/spring-security-config/6.0.1, Apache-2.0, approved, #7338 maven/mavencentral/org.springframework.security/spring-security-core/6.0.1, Apache-2.0, approved, #7325 maven/mavencentral/org.springframework.security/spring-security-crypto/6.0.1, Apache-2.0 AND ISC, approved, #7326 +maven/mavencentral/org.springframework.security/spring-security-test/6.0.1, Apache-2.0, approved, #7402 maven/mavencentral/org.springframework.security/spring-security-web/6.0.1, Apache-2.0, approved, #7328 maven/mavencentral/org.springframework.session/spring-session-core/3.0.0, Apache-2.0, approved, #7858 maven/mavencentral/org.springframework/spring-aop/6.0.4, Apache-2.0, approved, #5940 @@ -67,8 +103,10 @@ maven/mavencentral/org.springframework/spring-expression/6.0.4, Apache-2.0, appr maven/mavencentral/org.springframework/spring-jcl/6.0.4, Apache-2.0, approved, #3283 maven/mavencentral/org.springframework/spring-jdbc/6.0.4, Apache-2.0, approved, #5924 maven/mavencentral/org.springframework/spring-orm/6.0.4, Apache-2.0, approved, #5925 +maven/mavencentral/org.springframework/spring-test/6.0.4, Apache-2.0, approved, #7003 maven/mavencentral/org.springframework/spring-tx/6.0.4, Apache-2.0, approved, #5926 maven/mavencentral/org.springframework/spring-web/6.0.4, Apache-2.0, approved, #5942 maven/mavencentral/org.springframework/spring-webmvc/6.0.4, Apache-2.0, approved, #5944 maven/mavencentral/org.webjars/swagger-ui/4.18.2, Apache-2.0, approved, #7850 +maven/mavencentral/org.xmlunit/xmlunit-core/2.9.1, Apache-2.0, approved, #6272 maven/mavencentral/org.yaml/snakeyaml/1.33, Apache-2.0, approved, clearlydefined