Skip to content

Commit c8aeec1

Browse files
committed
fix: initial commit
1 parent 260c08e commit c8aeec1

File tree

13 files changed

+144
-149
lines changed

13 files changed

+144
-149
lines changed

backend/src/main/java/org/eclipse/tractusx/puris/backend/delivery/controller/DeliveryController.java

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@
2020

2121
package org.eclipse.tractusx.puris.backend.delivery.controller;
2222

23-
import java.util.List;
24-
import java.util.Optional;
25-
import java.util.UUID;
26-
import java.util.concurrent.ExecutorService;
27-
import java.util.regex.Pattern;
28-
import java.util.stream.Collectors;
29-
30-
import javax.management.openmbean.KeyAlreadyExistsException;
31-
23+
import io.swagger.v3.oas.annotations.Operation;
24+
import io.swagger.v3.oas.annotations.media.Content;
25+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
26+
import io.swagger.v3.oas.annotations.responses.ApiResponses;
27+
import jakarta.validation.Validator;
28+
import lombok.extern.slf4j.Slf4j;
3229
import org.eclipse.tractusx.puris.backend.common.util.PatternStore;
3330
import org.eclipse.tractusx.puris.backend.delivery.domain.model.OwnDelivery;
3431
import org.eclipse.tractusx.puris.backend.delivery.domain.model.ReportedDelivery;
@@ -47,24 +44,16 @@
4744
import org.springframework.http.HttpStatus;
4845
import org.springframework.http.HttpStatusCode;
4946
import org.springframework.http.ResponseEntity;
50-
import org.springframework.web.bind.annotation.DeleteMapping;
51-
import org.springframework.web.bind.annotation.GetMapping;
52-
import org.springframework.web.bind.annotation.PathVariable;
53-
import org.springframework.web.bind.annotation.PostMapping;
54-
import org.springframework.web.bind.annotation.PutMapping;
55-
import org.springframework.web.bind.annotation.RequestBody;
56-
import org.springframework.web.bind.annotation.RequestMapping;
57-
import org.springframework.web.bind.annotation.RequestParam;
58-
import org.springframework.web.bind.annotation.ResponseBody;
59-
import org.springframework.web.bind.annotation.ResponseStatus;
60-
import org.springframework.web.bind.annotation.RestController;
47+
import org.springframework.web.bind.annotation.*;
6148
import org.springframework.web.server.ResponseStatusException;
6249

63-
import io.swagger.v3.oas.annotations.Operation;
64-
import io.swagger.v3.oas.annotations.responses.ApiResponse;
65-
import io.swagger.v3.oas.annotations.responses.ApiResponses;
66-
import jakarta.validation.Validator;
67-
import lombok.extern.slf4j.Slf4j;
50+
import javax.management.openmbean.KeyAlreadyExistsException;
51+
import java.util.List;
52+
import java.util.Optional;
53+
import java.util.UUID;
54+
import java.util.concurrent.ExecutorService;
55+
import java.util.regex.Pattern;
56+
import java.util.stream.Collectors;
6857

6958
@RestController
7059
@RequestMapping("delivery")
@@ -119,10 +108,10 @@ public List<DeliveryDto> getAllDeliveries(String ownMaterialNumber, Optional<Str
119108
@ResponseBody
120109
@Operation(summary = "Creates a new delivery")
121110
@ApiResponses(value = {
122-
@ApiResponse(responseCode = "200", description = "Delivery was created."),
123-
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body."),
124-
@ApiResponse(responseCode = "409", description = "Delivery already exists."),
125-
@ApiResponse(responseCode = "500", description = "Internal Server Error.")
111+
@ApiResponse(responseCode = "201", description = "Delivery was created."),
112+
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body.", content = @Content),
113+
@ApiResponse(responseCode = "409", description = "Delivery already exists.", content = @Content),
114+
@ApiResponse(responseCode = "500", description = "Internal Server Error.", content = @Content)
126115
})
127116
@ResponseStatus(HttpStatus.CREATED)
128117
public DeliveryDto createDelivery(@RequestBody DeliveryDto deliveryDto) {
@@ -153,12 +142,12 @@ public DeliveryDto createDelivery(@RequestBody DeliveryDto deliveryDto) {
153142
@PutMapping()
154143
@Operation(summary = "Updates a delivery by its UUID")
155144
@ApiResponses(value = {
156-
@ApiResponse(responseCode = "204", description = "Delivery was updated."),
157-
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body."),
158-
@ApiResponse(responseCode = "404", description = "Delivery does not exist."),
159-
@ApiResponse(responseCode = "500", description = "Internal Server Error.")
145+
@ApiResponse(responseCode = "202", description = "Delivery was updated."),
146+
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body.", content = @Content),
147+
@ApiResponse(responseCode = "404", description = "Delivery does not exist.", content = @Content),
148+
@ApiResponse(responseCode = "500", description = "Internal Server Error.", content = @Content)
160149
})
161-
@ResponseStatus(HttpStatus.OK)
150+
@ResponseStatus(HttpStatus.ACCEPTED)
162151
public DeliveryDto updateDelivery(@RequestBody DeliveryDto dto) {
163152
OwnDelivery updatedDelivery = ownDeliveryService.update(convertToEntity(dto));
164153
if (updatedDelivery == null) {

backend/src/main/java/org/eclipse/tractusx/puris/backend/delivery/controller/DeliveryRequestApiController.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package org.eclipse.tractusx.puris.backend.delivery.controller;
2222

2323
import io.swagger.v3.oas.annotations.Operation;
24+
import io.swagger.v3.oas.annotations.media.Content;
2425
import io.swagger.v3.oas.annotations.responses.ApiResponse;
2526
import io.swagger.v3.oas.annotations.responses.ApiResponses;
2627
import lombok.extern.slf4j.Slf4j;
@@ -49,12 +50,13 @@ public class DeliveryRequestApiController {
4950
private final Pattern urnPattern = PatternStore.URN_OR_UUID_PATTERN;
5051

5152

52-
@Operation(summary = "This endpoint receives the Delivery Information Submodel 2.0.0 requests")
53+
@Operation(summary = "This endpoint receives the Delivery Information Submodel 2.0.0 requests. " +
54+
"This endpoint is meant to be accessed by partners via EDC only. ")
5355
@ApiResponses(value = {
5456
@ApiResponse(responseCode = "200", description = "Ok"),
55-
@ApiResponse(responseCode = "400", description = "Bad Request"),
56-
@ApiResponse(responseCode = "500", description = "Internal Server Error"),
57-
@ApiResponse(responseCode = "501", description = "Unsupported representation")
57+
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content),
58+
@ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content),
59+
@ApiResponse(responseCode = "501", description = "Unsupported representation", content = @Content)
5860
})
5961
@GetMapping("request/{materialNumberCx}/{representation}")
6062
public ResponseEntity<DeliveryInformation> getDeliveryMapping(

backend/src/main/java/org/eclipse/tractusx/puris/backend/demand/controller/DemandController.java

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,11 @@ See the NOTICE file(s) distributed with this work for additional
1919
*/
2020
package org.eclipse.tractusx.puris.backend.demand.controller;
2121

22-
import java.util.List;
23-
import java.util.Optional;
24-
import java.util.UUID;
25-
import java.util.concurrent.ExecutorService;
26-
import java.util.regex.Pattern;
27-
import java.util.stream.Collectors;
28-
29-
import javax.management.openmbean.KeyAlreadyExistsException;
30-
22+
import io.swagger.v3.oas.annotations.Operation;
23+
import io.swagger.v3.oas.annotations.media.Content;
24+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
25+
import io.swagger.v3.oas.annotations.responses.ApiResponses;
26+
import jakarta.validation.Validator;
3127
import org.eclipse.tractusx.puris.backend.common.util.PatternStore;
3228
import org.eclipse.tractusx.puris.backend.demand.domain.model.OwnDemand;
3329
import org.eclipse.tractusx.puris.backend.demand.domain.model.ReportedDemand;
@@ -41,7 +37,6 @@ See the NOTICE file(s) distributed with this work for additional
4137
import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService;
4238
import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialService;
4339
import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService;
44-
4540
import org.modelmapper.ModelMapper;
4641
import org.springframework.beans.factory.annotation.Autowired;
4742
import org.springframework.http.HttpStatus;
@@ -50,10 +45,13 @@ See the NOTICE file(s) distributed with this work for additional
5045
import org.springframework.web.bind.annotation.*;
5146
import org.springframework.web.server.ResponseStatusException;
5247

53-
import io.swagger.v3.oas.annotations.Operation;
54-
import io.swagger.v3.oas.annotations.responses.ApiResponse;
55-
import io.swagger.v3.oas.annotations.responses.ApiResponses;
56-
import jakarta.validation.Validator;
48+
import javax.management.openmbean.KeyAlreadyExistsException;
49+
import java.util.List;
50+
import java.util.Optional;
51+
import java.util.UUID;
52+
import java.util.concurrent.ExecutorService;
53+
import java.util.regex.Pattern;
54+
import java.util.stream.Collectors;
5755

5856
@RestController
5957
@RequestMapping("demand")
@@ -100,9 +98,9 @@ public List<DemandDto> getAllDemands(String ownMaterialNumber, Optional<String>
10098
@Operation(summary = "Creates a new demand")
10199
@ApiResponses(value = {
102100
@ApiResponse(responseCode = "201", description = "Demand was created."),
103-
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body."),
104-
@ApiResponse(responseCode = "409", description = "Demand already exists. Use PUT instead."),
105-
@ApiResponse(responseCode = "500", description = "Internal Server Error.")
101+
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body.", content = @Content),
102+
@ApiResponse(responseCode = "409", description = "Demand already exists. Use PUT instead.", content = @Content),
103+
@ApiResponse(responseCode = "500", description = "Internal Server Error.", content = @Content)
106104
})
107105
@ResponseStatus(HttpStatus.CREATED)
108106
public DemandDto createDemand(@RequestBody DemandDto demandDto) {
@@ -133,9 +131,9 @@ public DemandDto createDemand(@RequestBody DemandDto demandDto) {
133131
@Operation(summary = "Updates a demand by its UUID")
134132
@ApiResponses(value = {
135133
@ApiResponse(responseCode = "200", description = "Demand was updated."),
136-
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body."),
137-
@ApiResponse(responseCode = "404", description = "Demand does not exist."),
138-
@ApiResponse(responseCode = "500", description = "Internal Server Error.")
134+
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body.", content = @Content),
135+
@ApiResponse(responseCode = "404", description = "Demand does not exist.", content = @Content),
136+
@ApiResponse(responseCode = "500", description = "Internal Server Error.", content = @Content)
139137
})
140138
@ResponseStatus(HttpStatus.OK)
141139
public DemandDto updateDemand(@RequestBody DemandDto dto) {

backend/src/main/java/org/eclipse/tractusx/puris/backend/demand/controller/DemandRequestApiController.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package org.eclipse.tractusx.puris.backend.demand.controller;
2222

2323
import io.swagger.v3.oas.annotations.Operation;
24+
import io.swagger.v3.oas.annotations.media.Content;
2425
import io.swagger.v3.oas.annotations.responses.ApiResponse;
2526
import io.swagger.v3.oas.annotations.responses.ApiResponses;
2627
import lombok.extern.slf4j.Slf4j;
@@ -49,12 +50,13 @@ public class DemandRequestApiController {
4950
private final Pattern urnPattern = PatternStore.URN_OR_UUID_PATTERN;
5051

5152

52-
@Operation(summary = "This endpoint receives the ShortTermMaterialDemand Submodel 1.0.0 requests")
53+
@Operation(summary = "This endpoint receives the ShortTermMaterialDemand Submodel 1.0.0 requests. " +
54+
"This endpoint is meant to be accessed by partners via EDC only. ")
5355
@ApiResponses(value = {
5456
@ApiResponse(responseCode = "200", description = "Ok"),
55-
@ApiResponse(responseCode = "400", description = "Bad Request"),
56-
@ApiResponse(responseCode = "500", description = "Internal Server Error"),
57-
@ApiResponse(responseCode = "501", description = "Unsupported representation")
57+
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content),
58+
@ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content),
59+
@ApiResponse(responseCode = "501", description = "Unsupported representation", content = @Content)
5860
})
5961
@GetMapping("request/{materialnumbercx}/{representation}")
6062
public ResponseEntity<ShortTermMaterialDemand> getDemandMapping(

backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/controller/DemandAndCapacityNotificationController.java

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,13 @@ See the NOTICE file(s) distributed with this work for additional
1919
*/
2020
package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.controller;
2121

22-
import java.util.ArrayList;
23-
import java.util.List;
24-
import java.util.Optional;
25-
import java.util.UUID;
26-
import java.util.concurrent.ExecutorService;
27-
import java.util.stream.Collectors;
28-
29-
import javax.management.openmbean.KeyAlreadyExistsException;
30-
22+
import io.swagger.v3.oas.annotations.Operation;
23+
import io.swagger.v3.oas.annotations.media.Content;
24+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
25+
import io.swagger.v3.oas.annotations.responses.ApiResponses;
26+
import jakarta.validation.Validator;
27+
import jakarta.validation.constraints.Pattern;
3128
import org.eclipse.tractusx.puris.backend.common.util.PatternStore;
32-
import org.eclipse.tractusx.puris.backend.demand.logic.services.DemandRequestApiService;
3329
import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.OwnDemandAndCapacityNotification;
3430
import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.ReportedDemandAndCapacityNotification;
3531
import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.logic.dto.DemandAndCapacityNotificationDto;
@@ -39,22 +35,21 @@ See the NOTICE file(s) distributed with this work for additional
3935
import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material;
4036
import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner;
4137
import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Site;
42-
import org.eclipse.tractusx.puris.backend.masterdata.logic.dto.PartnerDto;
4338
import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialService;
4439
import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService;
4540
import org.modelmapper.ModelMapper;
4641
import org.springframework.beans.factory.annotation.Autowired;
4742
import org.springframework.http.HttpStatus;
48-
import org.springframework.http.HttpStatusCode;
49-
import org.springframework.http.ResponseEntity;
5043
import org.springframework.web.bind.annotation.*;
5144
import org.springframework.web.server.ResponseStatusException;
5245

53-
import io.swagger.v3.oas.annotations.Operation;
54-
import io.swagger.v3.oas.annotations.responses.ApiResponse;
55-
import io.swagger.v3.oas.annotations.responses.ApiResponses;
56-
import jakarta.validation.Validator;
57-
import jakarta.validation.constraints.Pattern;
46+
import javax.management.openmbean.KeyAlreadyExistsException;
47+
import java.util.ArrayList;
48+
import java.util.List;
49+
import java.util.Optional;
50+
import java.util.UUID;
51+
import java.util.concurrent.ExecutorService;
52+
import java.util.stream.Collectors;
5853

5954
@RestController
6055
@RequestMapping("demand-and-capacity-notification")
@@ -99,9 +94,9 @@ public List<DemandAndCapacityNotificationDto> getAllNotifications(Optional<@Patt
9994
@Operation(summary = "Creates a new notification")
10095
@ApiResponses(value = {
10196
@ApiResponse(responseCode = "201", description = "Notification was created."),
102-
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body."),
103-
@ApiResponse(responseCode = "409", description = "Notification already exists. Use PUT instead."),
104-
@ApiResponse(responseCode = "500", description = "Internal Server Error.")
97+
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body.", content = @Content),
98+
@ApiResponse(responseCode = "409", description = "Notification already exists. Use PUT instead.", content = @Content),
99+
@ApiResponse(responseCode = "500", description = "Internal Server Error.", content = @Content)
105100
})
106101
@ResponseStatus(HttpStatus.CREATED)
107102
public DemandAndCapacityNotificationDto createNotification(@RequestBody DemandAndCapacityNotificationDto notificationDto) {
@@ -131,9 +126,9 @@ public DemandAndCapacityNotificationDto createNotification(@RequestBody DemandAn
131126
@Operation(summary = "Updates a notification by its UUID")
132127
@ApiResponses(value = {
133128
@ApiResponse(responseCode = "200", description = "Notification was updated."),
134-
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body."),
135-
@ApiResponse(responseCode = "404", description = "Notification does not exist."),
136-
@ApiResponse(responseCode = "500", description = "Internal Server Error.")
129+
@ApiResponse(responseCode = "400", description = "Malformed or invalid request body.", content = @Content),
130+
@ApiResponse(responseCode = "404", description = "Notification does not exist.", content = @Content),
131+
@ApiResponse(responseCode = "500", description = "Internal Server Error.", content = @Content)
137132
})
138133
@ResponseStatus(HttpStatus.OK)
139134
public DemandAndCapacityNotificationDto updateNotification(@RequestBody DemandAndCapacityNotificationDto dto) {

backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/controller/DemandAndCapacityNotificationRequestApiController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public class DemandAndCapacityNotificationRequestApiController {
5151
@Autowired
5252
private ObjectMapper objectMapper;
5353

54-
@Operation(summary = "This endpoint receives the DemandAndCapacityNotification 2.0.0 requests")
54+
@Operation(summary = "This endpoint receives the DemandAndCapacityNotification 2.0.0 requests. " +
55+
"This endpoint is meant to be accessed by partners via EDC only. ")
5556
@ApiResponses(value = {
5657
@ApiResponse(responseCode = "200", description = "Ok", content = @Content),
5758
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content),

backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/controller/MaterialController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import io.swagger.v3.oas.annotations.Operation;
2525
import io.swagger.v3.oas.annotations.Parameter;
26+
import io.swagger.v3.oas.annotations.media.Content;
2627
import io.swagger.v3.oas.annotations.responses.ApiResponse;
2728
import io.swagger.v3.oas.annotations.responses.ApiResponses;
2829
import jakarta.validation.Validator;
@@ -130,8 +131,8 @@ public ResponseEntity<?> updateMaterial(@RequestBody MaterialEntityDto materialD
130131
@Operation(description = "Returns the requested Material dto, specified by the given ownMaterialNumber.")
131132
@ApiResponses(value = {
132133
@ApiResponse(responseCode = "200", description = "Returns the requested Material."),
133-
@ApiResponse(responseCode = "400", description = "Invalid parameter"),
134-
@ApiResponse(responseCode = "404", description = "Requested Material was not found.")
134+
@ApiResponse(responseCode = "400", description = "Invalid parameter", content = @Content),
135+
@ApiResponse(responseCode = "404", description = "Requested Material was not found.", content = @Content)
135136
})
136137
public ResponseEntity<MaterialEntityDto> getMaterial(@Parameter(name = "ownMaterialNumber",
137138
description = "The Material Number that is used in your own company to identify the Material.",

0 commit comments

Comments
 (0)