From cba6d5f9a0a6e5756af8b6295813e50a3547b22c Mon Sep 17 00:00:00 2001 From: ReneSchroederLJ Date: Tue, 28 May 2024 10:32:58 +0200 Subject: [PATCH 1/3] feat: implemented the puris backend for demand and capacity notifications 2.0 --- .../common/security/SecurityConfig.java | 2 +- .../controller/NotificationController.java | 252 ++++++++++++++++++ .../domain/model/EffectEnumeration.java | 43 +++ .../model/LeadingRootCauseEnumeration.java | 46 ++++ .../domain/model/Notification.java | 100 +++++++ .../domain/model/OwnNotification.java | 34 +++ .../domain/model/ReportedNotification.java | 34 +++ .../domain/model/StatusEnumeration.java | 41 +++ .../repository/OwnNotificationRepository.java | 32 +++ .../ReportedNotificationRepository.java | 32 +++ .../logic/dto/NotificationDto.java | 67 +++++ .../logic/service/NotificationService.java | 85 ++++++ .../logic/service/OwnNotificationService.java | 74 +++++ .../service/ReportedNotificationService.java | 76 ++++++ 14 files changed, 917 insertions(+), 1 deletion(-) create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/NotificationController.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/EffectEnumeration.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/LeadingRootCauseEnumeration.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/Notification.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnNotification.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedNotification.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/StatusEnumeration.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnNotificationRepository.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedNotificationRepository.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/dto/NotificationDto.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/NotificationService.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnNotificationService.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedNotificationService.java diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/security/SecurityConfig.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/security/SecurityConfig.java index 6bdc8372..e89487a3 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/security/SecurityConfig.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/security/SecurityConfig.java @@ -83,7 +83,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .authorizeHttpRequests( // any request in spring context (authorizeHttpRequests) -> authorizeHttpRequests - .requestMatchers("/stockView/**", "/partners/**", "/materials/**", "/materialpartnerrelations/**", "/item-stock/**", "/production/**", "/delivery/**", "/demand/**", "/planned-production/**", "/material-demand/**", "/delivery-information/**", "/edc/**", "/parttypeinformation/**") + .requestMatchers("/stockView/**", "/partners/**", "/materials/**", "/materialpartnerrelations/**", "/item-stock/**", "/production/**", "/delivery/**", "/demand/**", "/notification/**", "/planned-production/**", "/material-demand/**", "/delivery-information/**", "/edrendpoint/**", "/edc/**", "/parttypeinformation/**") .authenticated() .requestMatchers("/swagger-ui/**", "/v3/api-docs/**", "/health/**").permitAll() .dispatcherTypeMatchers(DispatcherType.ERROR).permitAll() diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/NotificationController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/NotificationController.java new file mode 100644 index 00000000..1ef45955 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/NotificationController.java @@ -0,0 +1,252 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.controller; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +import java.util.stream.Collectors; + +import javax.management.openmbean.KeyAlreadyExistsException; + +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Site; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; +import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnNotification; +import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedNotification; +import org.eclipse.tractusx.puris.backend.notification.logic.dto.NotificationDto; +import org.eclipse.tractusx.puris.backend.notification.logic.service.OwnNotificationService; +import org.eclipse.tractusx.puris.backend.notification.logic.service.ReportedNotificationService; +import org.modelmapper.ModelMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.server.ResponseStatusException; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Validator; + +@RestController +@RequestMapping("notification") +public class NotificationController { + @Autowired + private OwnNotificationService ownNotificationService; + + @Autowired + private ReportedNotificationService reportedNotificationService; + + @Autowired + private MaterialService materialService; + + @Autowired + private PartnerService partnerService; + + @Autowired + private ModelMapper modelMapper; + + @Autowired + private Validator validator; + + @GetMapping() + @ResponseBody + @Operation(summary = "Get all own notifications", description = "Get all own notifications. Optionally the partner can be filtered by its bpnl.") + public List getAllNotifications(Optional partnerBpnl) { + if (partnerBpnl.isEmpty()) { + return ownNotificationService.findAll().stream().map(this::convertToDto).collect(Collectors.toList()); + } else { + return ownNotificationService.findAllByPartnerBpnl(partnerBpnl.get()).stream().map(this::convertToDto).collect(Collectors.toList()); + } + } + + @PostMapping() + @ResponseBody + @Operation(summary = "Creates a new notification") + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Notification was created."), + @ApiResponse(responseCode = "400", description = "Malformed or invalid request body."), + @ApiResponse(responseCode = "409", description = "Notification already exists. Use PUT instead."), + @ApiResponse(responseCode = "500", description = "Internal Server Error.") + }) + @ResponseStatus(HttpStatus.CREATED) + public NotificationDto createNotification(@RequestBody NotificationDto notificationDto) { + if (!validator.validate(notificationDto).isEmpty()) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid Notification."); + } + + if (notificationDto.getPartnerBpnl() == null || notificationDto.getPartnerBpnl().isEmpty()) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, + "Demand Information misses partner identification."); + } + + try { + return convertToDto(ownNotificationService.create(convertToEntity(notificationDto))); + } catch (KeyAlreadyExistsException e) { + throw new ResponseStatusException(HttpStatus.CONFLICT, "Notification already exists. Use PUT instead."); + } catch (IllegalArgumentException e) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Notification is invalid."); + } catch (IllegalStateException e) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, e.getMessage()); + } + } + + @PutMapping() + @Operation(summary = "Updates a notification by its UUID") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Notification was updated."), + @ApiResponse(responseCode = "400", description = "Malformed or invalid request body."), + @ApiResponse(responseCode = "404", description = "Notification does not exist."), + @ApiResponse(responseCode = "500", description = "Internal Server Error.") + }) + @ResponseStatus(HttpStatus.OK) + public NotificationDto updateNotification(@RequestBody NotificationDto dto) { + OwnNotification updatedNotification = ownNotificationService.update(convertToEntity(dto)); + if (updatedNotification == null) { + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Notification does not exist."); + } + return convertToDto(updatedNotification); + } + + @DeleteMapping("{id}") + @Operation(summary = "Deletes a notification by its UUID") + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "Notification was deleted."), + @ApiResponse(responseCode = "400", description = "Malformed or invalid request body."), + @ApiResponse(responseCode = "404", description = "Notification does not exist."), + @ApiResponse(responseCode = "500", description = "Internal Server Error.") + }) + @ResponseStatus(HttpStatus.NO_CONTENT) + public void deleteNotification(@PathVariable UUID id) { + OwnNotification demand = ownNotificationService.findById(id); + if (demand == null) { + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Notification does not exist."); + } + ownNotificationService.delete(id); + } + + @GetMapping("reported") + @ResponseBody + @Operation(summary = "Get all reported notifications", description = "Get all reported notifications. Optionally the partner can be filtered by its bpnl.") + public List getAllReportedNotifications(Optional partnerBpnl) { + if (partnerBpnl.isEmpty()) { + return reportedNotificationService.findAll().stream().map(this::convertToDto).collect(Collectors.toList()); + } else { + return reportedNotificationService.findAllByPartnerBpnl(partnerBpnl.get()).stream().map(this::convertToDto).collect(Collectors.toList()); + } + } + + private NotificationDto convertToDto(OwnNotification entity) { + NotificationDto dto = modelMapper.map(entity, NotificationDto.class); + if (entity.getMaterials() != null) { + dto.setAffectedMaterialNumbers(entity.getMaterials().stream().map(Material::getOwnMaterialNumber).toList()); + } + if (entity.getAffectedSitesRecipient() != null) { + dto.setAffectedSitesBpnsRecipient(entity.getAffectedSitesRecipient().stream().map(Site::getBpns).toList()); + } + if (entity.getAffectedSitesSender() != null) { + dto.setAffectedSitesBpnsSender(entity.getAffectedSitesSender().stream().map(Site::getBpns).toList()); + } + dto.setPartnerBpnl(entity.getPartner().getBpnl()); + dto.setPartnerBpnl(entity.getPartner().getBpnl()); + dto.setReported(false); + return dto; + } + + private NotificationDto convertToDto(ReportedNotification entity) { + NotificationDto dto = modelMapper.map(entity, NotificationDto.class); + if (entity.getMaterials() != null) { + dto.setAffectedMaterialNumbers(entity.getMaterials().stream().map(Material::getOwnMaterialNumber).toList()); + } + if (entity.getAffectedSitesRecipient() != null) { + dto.setAffectedSitesBpnsRecipient(entity.getAffectedSitesRecipient().stream().map(Site::getBpns).toList()); + } + if (entity.getAffectedSitesSender() != null) { + dto.setAffectedSitesBpnsSender(entity.getAffectedSitesSender().stream().map(Site::getBpns).toList()); + } + dto.setPartnerBpnl(entity.getPartner().getBpnl()); + return dto; + } + + private OwnNotification convertToEntity(NotificationDto dto) { + OwnNotification entity = modelMapper.map(dto, OwnNotification.class); + + Partner existingPartner = partnerService.findByBpnl(dto.getPartnerBpnl()); + if (existingPartner == null) { + throw new IllegalStateException(String.format( + "Partner for bpnl %s could not be found", + dto.getPartnerBpnl())); + } + entity.setPartner(existingPartner); + + List materials = new ArrayList<>(); + for (String ownMaterialNumber : dto.getAffectedMaterialNumbers()) { + Material material = materialService.findByOwnMaterialNumber(ownMaterialNumber); + if (material == null) { + throw new IllegalStateException(String.format( + "Material for ownMaterialNumber %s could not be found", + ownMaterialNumber)); + } + materials.add(material); + } + entity.setMaterials(materials); + + List affectedSitesRecipient = new ArrayList<>(); + for (String bpns : dto.getAffectedSitesBpnsRecipient()) { + Site site = existingPartner.getSites().stream().filter(p -> p.getBpns().equals(bpns)).findFirst() + .orElse(null); + if (site == null) { + throw new IllegalStateException(String.format( + "Site for bpns %s could not be found", + bpns)); + } + affectedSitesRecipient.add(site); + } + entity.setAffectedSitesRecipient(affectedSitesRecipient); + + Partner ownPartner = partnerService.getOwnPartnerEntity(); + List affectedSitesSender = new ArrayList<>(); + for (String bpns : dto.getAffectedSitesBpnsSender()) { + Site site = ownPartner.getSites().stream().filter(p -> p.getBpns().equals(bpns)).findFirst().orElse(null); + if (site == null) { + throw new IllegalStateException(String.format( + "Site for bpns %s could not be found", + bpns)); + } + affectedSitesSender.add(site); + } + entity.setAffectedSitesSender(affectedSitesSender); + + if (dto.getRelatedNotificationId() != null) { + OwnNotification relatedNotification = ownNotificationService.findById(dto.getRelatedNotificationId()); + if (relatedNotification == null) { + throw new IllegalStateException(String.format( + "Related notification for UUID %s could not be found", + dto.getRelatedNotificationId())); + } + } + + return entity; + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/EffectEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/EffectEnumeration.java new file mode 100644 index 00000000..0c35c10f --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/EffectEnumeration.java @@ -0,0 +1,43 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.domain.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonValue; + +@JsonFormat(shape = JsonFormat.Shape.OBJECT) +public enum EffectEnumeration { + DEMAND_REDUCTION("demand-reduction"), + DEMAND_INCREASE("demand-increase"), + CAPACITY_REDUCTION("capacity-reduction"), + CAPACITY_INCREASE("capacity-increase"); + + private String value; + + EffectEnumeration(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/LeadingRootCauseEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/LeadingRootCauseEnumeration.java new file mode 100644 index 00000000..bf36e3eb --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/LeadingRootCauseEnumeration.java @@ -0,0 +1,46 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.domain.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonValue; + +@JsonFormat(shape = JsonFormat.Shape.OBJECT) +public enum LeadingRootCauseEnumeration { + STRIKE("strike"), + NATURAL_DISASTER("natural-disaster"), + PRODUCTION_INCIDENT("production-incident"), + PANDEMIC_OR_EPIDEMIC("pandemic-or-epidemic"), + LOGISTICS_DISRUPTION("logistics-disruption"), + WAR("war"), + OTHER("other"); + + private String value; + + LeadingRootCauseEnumeration(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/Notification.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/Notification.java new file mode 100644 index 00000000..6ac81dee --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/Notification.java @@ -0,0 +1,100 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.domain.model; + +import java.util.Date; +import java.util.List; +import java.util.UUID; + +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Site; + +import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.SuperBuilder; + +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +@SuperBuilder +@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) +@Entity +@ToString +public abstract class Notification { + @Id + @GeneratedValue + protected UUID uuid; + + protected UUID relatedNotificationId; + + @ManyToOne() + @JoinColumn(name = "partner_uuid") + @ToString.Exclude + @NotNull + protected Partner partner; + + @ManyToMany() + @JoinTable( + name = "notification_material", + joinColumns = @JoinColumn(name = "notification_uuid"), + inverseJoinColumns = @JoinColumn(name = "material_ownMaterialNumber")) + @ToString.Exclude + protected List materials; + + protected String text; + + @NotNull + protected LeadingRootCauseEnumeration leadingRootCause; + + @NotNull + protected EffectEnumeration effect; + + @NotNull + protected StatusEnumeration status; + + @NotNull + protected Date startDateOfEffect; + protected Date expectedEndDateOfEffect; + + @ManyToMany() + @JoinTable( + name = "notification_affected_sites_sender", + joinColumns = @JoinColumn(name = "notification_uuid"), + inverseJoinColumns = @JoinColumn(name = "site_bpns")) + protected List affectedSitesSender; + + @ManyToMany() + @JoinTable( + name = "notification_affected_sites_recipient", + joinColumns = @JoinColumn(name = "notification_uuid"), + inverseJoinColumns = @JoinColumn(name = "site_bpns")) + protected List affectedSitesRecipient; + + @NotNull + protected Date contentChangedAt; +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnNotification.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnNotification.java new file mode 100644 index 00000000..e91c2bf1 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnNotification.java @@ -0,0 +1,34 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.domain.model; + +import jakarta.persistence.Entity; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.SuperBuilder; + +@Entity +@SuperBuilder +@NoArgsConstructor +@ToString(callSuper = true) +public class OwnNotification extends Notification { + +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedNotification.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedNotification.java new file mode 100644 index 00000000..fa0817a2 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedNotification.java @@ -0,0 +1,34 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.domain.model; + +import jakarta.persistence.Entity; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.SuperBuilder; + +@Entity +@SuperBuilder +@NoArgsConstructor +@ToString(callSuper = true) +public class ReportedNotification extends Notification { + +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/StatusEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/StatusEnumeration.java new file mode 100644 index 00000000..8c50f262 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/StatusEnumeration.java @@ -0,0 +1,41 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.domain.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonValue; + +@JsonFormat(shape = JsonFormat.Shape.OBJECT) +public enum StatusEnumeration { + RESOLVED("resolved"), + OPEN("open"); + + private String value; + + StatusEnumeration(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnNotificationRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnNotificationRepository.java new file mode 100644 index 00000000..e9e5252b --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnNotificationRepository.java @@ -0,0 +1,32 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.domain.repository; + +import java.util.UUID; + +import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnNotification; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface OwnNotificationRepository extends JpaRepository{ + +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedNotificationRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedNotificationRepository.java new file mode 100644 index 00000000..2fc86bca --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedNotificationRepository.java @@ -0,0 +1,32 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.domain.repository; + +import java.util.UUID; + +import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedNotification; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface ReportedNotificationRepository extends JpaRepository{ + +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/dto/NotificationDto.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/dto/NotificationDto.java new file mode 100644 index 00000000..8ac40f90 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/dto/NotificationDto.java @@ -0,0 +1,67 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.logic.dto; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +import org.eclipse.tractusx.puris.backend.common.util.PatternStore; +import org.eclipse.tractusx.puris.backend.notification.domain.model.EffectEnumeration; +import org.eclipse.tractusx.puris.backend.notification.domain.model.LeadingRootCauseEnumeration; +import org.eclipse.tractusx.puris.backend.notification.domain.model.StatusEnumeration; + +import jakarta.validation.constraints.Pattern; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@NoArgsConstructor +@ToString +public class NotificationDto implements Serializable { + private UUID uuid; + + private UUID relatedNotificationId; + + @Pattern(regexp = PatternStore.BPNL_STRING) + private String partnerBpnl; + + private List<@Pattern(regexp = PatternStore.NON_EMPTY_NON_VERTICAL_WHITESPACE_STRING) String> affectedMaterialNumbers; + + private String text; + + private LeadingRootCauseEnumeration leadingRootCause; + private EffectEnumeration effect; + + private StatusEnumeration status; + + private Date startDateOfEffect; + private Date expectedEndDateOfEffect; + + private List<@Pattern(regexp = PatternStore.BPNS_STRING) String> affectedSitesBpnsSender; + private List<@Pattern(regexp = PatternStore.BPNS_STRING) String> affectedSitesBpnsRecipient; + + private boolean isReported; +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/NotificationService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/NotificationService.java new file mode 100644 index 00000000..fd45b6eb --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/NotificationService.java @@ -0,0 +1,85 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.logic.service; + +import java.util.Date; +import java.util.List; +import java.util.UUID; +import java.util.function.Function; + +import javax.management.openmbean.KeyAlreadyExistsException; + +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; +import org.eclipse.tractusx.puris.backend.notification.domain.model.Notification; +import org.springframework.data.jpa.repository.JpaRepository; + +public abstract class NotificationService> { + protected final TRepository repository; + protected final PartnerService partnerService; + protected final MaterialPartnerRelationService mprService; + + protected final Function validator; + + public NotificationService(TRepository repository, PartnerService partnerService, MaterialPartnerRelationService mprService) { + this.repository = repository; + this.partnerService = partnerService; + this.mprService = mprService; + this.validator = this::validate; + } + + public final TEntity findById(UUID uuid) { + return repository.findById(uuid).orElse(null); + } + + public final List findAll() { + return repository.findAll(); + } + + public final List findAllByBpnl(String bpnl) { + return repository.findAll().stream().filter(demand -> demand.getPartner().getBpnl().equals(bpnl)) + .toList(); + } + + public final TEntity create(TEntity notification) { + if (!validator.apply(notification)) { + throw new IllegalArgumentException("Invalid notification"); + } + if (repository.findAll().stream().anyMatch(d -> d.equals(notification))) { + throw new KeyAlreadyExistsException("Notification already exists"); + } + notification.setContentChangedAt(new Date()); + return repository.save(notification); + } + + public final TEntity update(TEntity notification) { + if (notification.getUuid() == null || repository.findById(notification.getUuid()).isEmpty()) { + return null; + } + return repository.save(notification); + } + + public final void delete(UUID uuid) { + repository.deleteById(uuid); + } + + public abstract boolean validate(TEntity notification); +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnNotificationService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnNotificationService.java new file mode 100644 index 00000000..fb905107 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnNotificationService.java @@ -0,0 +1,74 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.logic.service; + +import java.util.List; + +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; +import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnNotification; +import org.eclipse.tractusx.puris.backend.notification.domain.repository.OwnNotificationRepository; +import org.springframework.stereotype.Service; + +@Service +public class OwnNotificationService extends NotificationService{ + + public OwnNotificationService(OwnNotificationRepository ownNotificationRepository, PartnerService partnerService, MaterialPartnerRelationService mpr) { + super(ownNotificationRepository, partnerService, mpr); + } + + public List findAllByPartnerBpnl(String bpnl) { + return repository.findAll().stream().filter(notification -> notification.getPartner().getBpnl().equals(bpnl)).toList(); + } + + public boolean validate(OwnNotification notification) { + return notification.getPartner() != null && + notification.getText() != null && + notification.getLeadingRootCause() != null && + notification.getEffect() != null && + notification.getStatus() != null && + notification.getStartDateOfEffect() != null && + notification.getExpectedEndDateOfEffect() != null && + validateMaterials(notification) && + validateSites(notification); + } + + public boolean validateMaterials(OwnNotification notification) { + if (notification.getMaterials() == null || notification.getMaterials().isEmpty()) { + return true; + } + return mprService.findAll().stream().filter(mpr -> + mpr.getPartner().equals(notification.getPartner()) && + notification.getMaterials().contains(mpr.getMaterial())).count() == notification.getMaterials().size(); + } + + public boolean validateSites(OwnNotification notification) { + return ( + notification.getAffectedSitesRecipient() == null || + notification.getAffectedSitesRecipient().isEmpty() || + notification.getAffectedSitesRecipient().stream().allMatch(site -> notification.getPartner().getSites().contains(site)) + ) && ( + notification.getAffectedSitesSender() == null || + notification.getAffectedSitesSender().isEmpty() || + notification.getAffectedSitesSender().stream().allMatch(site -> partnerService.getOwnPartnerEntity().getSites().contains(site)) + ); + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedNotificationService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedNotificationService.java new file mode 100644 index 00000000..27199dd4 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedNotificationService.java @@ -0,0 +1,76 @@ +/* +Copyright (c) 2024 Volkswagen AG +Copyright (c) 2024 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.notification.logic.service; + +import java.util.List; + +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; +import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedNotification; +import org.eclipse.tractusx.puris.backend.notification.domain.repository.ReportedNotificationRepository; +import org.springframework.stereotype.Service; + +@Service +public class ReportedNotificationService extends NotificationService { + + public ReportedNotificationService(ReportedNotificationRepository reportedNotificationRepository, + PartnerService partnerService, MaterialPartnerRelationService mpr) { + super(reportedNotificationRepository, partnerService, mpr); + } + + public List findAllByPartnerBpnl(String bpnl) { + return repository.findAll().stream().filter(notification -> notification.getPartner().getBpnl().equals(bpnl)) + .toList(); + } + + public boolean validate(ReportedNotification notification) { + return notification.getPartner() != null && + notification.getText() != null && + notification.getLeadingRootCause() != null && + notification.getEffect() != null && + notification.getStatus() != null && + notification.getStartDateOfEffect() != null && + notification.getExpectedEndDateOfEffect() != null && + validateMaterials(notification) && + validateSites(notification); + } + + public boolean validateMaterials(ReportedNotification notification) { + if (notification.getMaterials() == null || notification.getMaterials().isEmpty()) { + return true; + } + return mprService.findAll().stream().filter(mpr -> + mpr.getPartner().equals(notification.getPartner()) && + notification.getMaterials().contains(mpr.getMaterial())).count() == notification.getMaterials().size(); + } + + public boolean validateSites(ReportedNotification notification) { + return ( + notification.getAffectedSitesSender() == null || + notification.getAffectedSitesSender().isEmpty() || + notification.getAffectedSitesSender().stream().allMatch(site -> notification.getPartner().getSites().contains(site)) + ) && ( + notification.getAffectedSitesRecipient() == null || + notification.getAffectedSitesRecipient().isEmpty() || + notification.getAffectedSitesRecipient().stream().allMatch(site -> partnerService.getOwnPartnerEntity().getSites().contains(site)) + ); + } +} From c7119295a37ce4c65d78863894a346f4bb3b6bad Mon Sep 17 00:00:00 2001 From: ReneSchroederLJ Date: Wed, 29 May 2024 13:01:47 +0200 Subject: [PATCH 2/3] feat: updated naming convention from Notification to DemandAndCapacityNotification --- .../common/security/SecurityConfig.java | 2 +- ...andAndCapacityNotificationController.java} | 34 ++++++++++--------- ...ava => DemandAndCapacityNotification.java} | 7 +++- ... => OwnDemandAndCapacityNotification.java} | 2 +- ...eportedDemandAndCapacityNotification.java} | 2 +- ...andAndCapacityNotificationRepository.java} | 4 +-- ...andAndCapacityNotificationRepository.java} | 4 +-- .../logic/dto/NotificationDto.java | 3 ++ ...DemandAndCapacityNotificationService.java} | 7 ++-- ...DemandAndCapacityNotificationService.java} | 17 +++++----- ...DemandAndCapacityNotificationService.java} | 17 +++++----- 11 files changed, 56 insertions(+), 43 deletions(-) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/{NotificationController.java => DemandAndCapacityNotificationController.java} (88%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/{Notification.java => DemandAndCapacityNotification.java} (90%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/{OwnNotification.java => OwnDemandAndCapacityNotification.java} (92%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/{ReportedNotification.java => ReportedDemandAndCapacityNotification.java} (91%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/{OwnNotificationRepository.java => OwnDemandAndCapacityNotificationRepository.java} (86%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/{ReportedNotificationRepository.java => ReportedDemandAndCapacityNotificationRepository.java} (85%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/{NotificationService.java => DemandAndCapacityNotificationService.java} (88%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/{OwnNotificationService.java => OwnDemandAndCapacityNotificationService.java} (78%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/{ReportedNotificationService.java => ReportedDemandAndCapacityNotificationService.java} (78%) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/security/SecurityConfig.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/security/SecurityConfig.java index e89487a3..221bddda 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/security/SecurityConfig.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/security/SecurityConfig.java @@ -83,7 +83,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .authorizeHttpRequests( // any request in spring context (authorizeHttpRequests) -> authorizeHttpRequests - .requestMatchers("/stockView/**", "/partners/**", "/materials/**", "/materialpartnerrelations/**", "/item-stock/**", "/production/**", "/delivery/**", "/demand/**", "/notification/**", "/planned-production/**", "/material-demand/**", "/delivery-information/**", "/edrendpoint/**", "/edc/**", "/parttypeinformation/**") + .requestMatchers("/stockView/**", "/partners/**", "/materials/**", "/materialpartnerrelations/**", "/item-stock/**", "/production/**", "/delivery/**", "/demand/**", "/notification/**", "/planned-production/**", "/material-demand/**", "/delivery-information/**", "/edc/**", "/parttypeinformation/**") .authenticated() .requestMatchers("/swagger-ui/**", "/v3/api-docs/**", "/health/**").permitAll() .dispatcherTypeMatchers(DispatcherType.ERROR).permitAll() diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/NotificationController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/DemandAndCapacityNotificationController.java similarity index 88% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/NotificationController.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/DemandAndCapacityNotificationController.java index 1ef45955..9b149a9c 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/NotificationController.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/DemandAndCapacityNotificationController.java @@ -28,16 +28,17 @@ See the NOTICE file(s) distributed with this work for additional import javax.management.openmbean.KeyAlreadyExistsException; +import org.eclipse.tractusx.puris.backend.common.util.PatternStore; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Site; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; -import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnNotification; -import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedNotification; +import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnDemandAndCapacityNotification; +import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedDemandAndCapacityNotification; import org.eclipse.tractusx.puris.backend.notification.logic.dto.NotificationDto; -import org.eclipse.tractusx.puris.backend.notification.logic.service.OwnNotificationService; -import org.eclipse.tractusx.puris.backend.notification.logic.service.ReportedNotificationService; +import org.eclipse.tractusx.puris.backend.notification.logic.service.OwnDemandAndCapacityNotificationService; +import org.eclipse.tractusx.puris.backend.notification.logic.service.ReportedDemandAndCapacityNotificationService; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -48,15 +49,16 @@ See the NOTICE file(s) distributed with this work for additional import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import jakarta.validation.Validator; +import jakarta.validation.constraints.Pattern; @RestController @RequestMapping("notification") -public class NotificationController { +public class DemandAndCapacityNotificationController { @Autowired - private OwnNotificationService ownNotificationService; + private OwnDemandAndCapacityNotificationService ownNotificationService; @Autowired - private ReportedNotificationService reportedNotificationService; + private ReportedDemandAndCapacityNotificationService reportedNotificationService; @Autowired private MaterialService materialService; @@ -73,7 +75,7 @@ public class NotificationController { @GetMapping() @ResponseBody @Operation(summary = "Get all own notifications", description = "Get all own notifications. Optionally the partner can be filtered by its bpnl.") - public List getAllNotifications(Optional partnerBpnl) { + public List getAllNotifications(Optional<@Pattern(regexp = PatternStore.BPNL_STRING) String> partnerBpnl) { if (partnerBpnl.isEmpty()) { return ownNotificationService.findAll().stream().map(this::convertToDto).collect(Collectors.toList()); } else { @@ -122,7 +124,7 @@ public NotificationDto createNotification(@RequestBody NotificationDto notificat }) @ResponseStatus(HttpStatus.OK) public NotificationDto updateNotification(@RequestBody NotificationDto dto) { - OwnNotification updatedNotification = ownNotificationService.update(convertToEntity(dto)); + OwnDemandAndCapacityNotification updatedNotification = ownNotificationService.update(convertToEntity(dto)); if (updatedNotification == null) { throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Notification does not exist."); } @@ -139,7 +141,7 @@ public NotificationDto updateNotification(@RequestBody NotificationDto dto) { }) @ResponseStatus(HttpStatus.NO_CONTENT) public void deleteNotification(@PathVariable UUID id) { - OwnNotification demand = ownNotificationService.findById(id); + OwnDemandAndCapacityNotification demand = ownNotificationService.findById(id); if (demand == null) { throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Notification does not exist."); } @@ -149,7 +151,7 @@ public void deleteNotification(@PathVariable UUID id) { @GetMapping("reported") @ResponseBody @Operation(summary = "Get all reported notifications", description = "Get all reported notifications. Optionally the partner can be filtered by its bpnl.") - public List getAllReportedNotifications(Optional partnerBpnl) { + public List getAllReportedNotifications(Optional<@Pattern(regexp = PatternStore.BPNL_STRING) String> partnerBpnl) { if (partnerBpnl.isEmpty()) { return reportedNotificationService.findAll().stream().map(this::convertToDto).collect(Collectors.toList()); } else { @@ -157,7 +159,7 @@ public List getAllReportedNotifications(Optional partne } } - private NotificationDto convertToDto(OwnNotification entity) { + private NotificationDto convertToDto(OwnDemandAndCapacityNotification entity) { NotificationDto dto = modelMapper.map(entity, NotificationDto.class); if (entity.getMaterials() != null) { dto.setAffectedMaterialNumbers(entity.getMaterials().stream().map(Material::getOwnMaterialNumber).toList()); @@ -174,7 +176,7 @@ private NotificationDto convertToDto(OwnNotification entity) { return dto; } - private NotificationDto convertToDto(ReportedNotification entity) { + private NotificationDto convertToDto(ReportedDemandAndCapacityNotification entity) { NotificationDto dto = modelMapper.map(entity, NotificationDto.class); if (entity.getMaterials() != null) { dto.setAffectedMaterialNumbers(entity.getMaterials().stream().map(Material::getOwnMaterialNumber).toList()); @@ -189,8 +191,8 @@ private NotificationDto convertToDto(ReportedNotification entity) { return dto; } - private OwnNotification convertToEntity(NotificationDto dto) { - OwnNotification entity = modelMapper.map(dto, OwnNotification.class); + private OwnDemandAndCapacityNotification convertToEntity(NotificationDto dto) { + OwnDemandAndCapacityNotification entity = modelMapper.map(dto, OwnDemandAndCapacityNotification.class); Partner existingPartner = partnerService.findByBpnl(dto.getPartnerBpnl()); if (existingPartner == null) { @@ -239,7 +241,7 @@ private OwnNotification convertToEntity(NotificationDto dto) { entity.setAffectedSitesSender(affectedSitesSender); if (dto.getRelatedNotificationId() != null) { - OwnNotification relatedNotification = ownNotificationService.findById(dto.getRelatedNotificationId()); + OwnDemandAndCapacityNotification relatedNotification = ownNotificationService.findById(dto.getRelatedNotificationId()); if (relatedNotification == null) { throw new IllegalStateException(String.format( "Related notification for UUID %s could not be found", diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/Notification.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/DemandAndCapacityNotification.java similarity index 90% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/Notification.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/DemandAndCapacityNotification.java index 6ac81dee..e540a4f1 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/Notification.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/DemandAndCapacityNotification.java @@ -24,12 +24,14 @@ See the NOTICE file(s) distributed with this work for additional import java.util.List; import java.util.UUID; +import org.eclipse.tractusx.puris.backend.common.util.PatternStore; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Site; import jakarta.persistence.*; import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -45,13 +47,15 @@ See the NOTICE file(s) distributed with this work for additional @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @Entity @ToString -public abstract class Notification { +public abstract class DemandAndCapacityNotification { @Id @GeneratedValue protected UUID uuid; protected UUID relatedNotificationId; + protected UUID sourceNotificationId; + @ManyToOne() @JoinColumn(name = "partner_uuid") @ToString.Exclude @@ -66,6 +70,7 @@ public abstract class Notification { @ToString.Exclude protected List materials; + @Pattern(regexp = PatternStore.NON_EMPTY_NON_VERTICAL_WHITESPACE_STRING) protected String text; @NotNull diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnNotification.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnDemandAndCapacityNotification.java similarity index 92% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnNotification.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnDemandAndCapacityNotification.java index e91c2bf1..6134fdaa 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnNotification.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnDemandAndCapacityNotification.java @@ -29,6 +29,6 @@ See the NOTICE file(s) distributed with this work for additional @SuperBuilder @NoArgsConstructor @ToString(callSuper = true) -public class OwnNotification extends Notification { +public class OwnDemandAndCapacityNotification extends DemandAndCapacityNotification { } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedNotification.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedDemandAndCapacityNotification.java similarity index 91% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedNotification.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedDemandAndCapacityNotification.java index fa0817a2..8f1e4e80 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedNotification.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedDemandAndCapacityNotification.java @@ -29,6 +29,6 @@ See the NOTICE file(s) distributed with this work for additional @SuperBuilder @NoArgsConstructor @ToString(callSuper = true) -public class ReportedNotification extends Notification { +public class ReportedDemandAndCapacityNotification extends DemandAndCapacityNotification { } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnNotificationRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnDemandAndCapacityNotificationRepository.java similarity index 86% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnNotificationRepository.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnDemandAndCapacityNotificationRepository.java index e9e5252b..b2a436af 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnNotificationRepository.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnDemandAndCapacityNotificationRepository.java @@ -22,11 +22,11 @@ See the NOTICE file(s) distributed with this work for additional import java.util.UUID; -import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnNotification; +import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnDemandAndCapacityNotification; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository -public interface OwnNotificationRepository extends JpaRepository{ +public interface OwnDemandAndCapacityNotificationRepository extends JpaRepository{ } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedNotificationRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedDemandAndCapacityNotificationRepository.java similarity index 85% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedNotificationRepository.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedDemandAndCapacityNotificationRepository.java index 2fc86bca..63e1c54d 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedNotificationRepository.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedDemandAndCapacityNotificationRepository.java @@ -22,11 +22,11 @@ See the NOTICE file(s) distributed with this work for additional import java.util.UUID; -import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedNotification; +import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedDemandAndCapacityNotification; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository -public interface ReportedNotificationRepository extends JpaRepository{ +public interface ReportedDemandAndCapacityNotificationRepository extends JpaRepository{ } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/dto/NotificationDto.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/dto/NotificationDto.java index 8ac40f90..cb925ecf 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/dto/NotificationDto.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/dto/NotificationDto.java @@ -45,11 +45,14 @@ public class NotificationDto implements Serializable { private UUID relatedNotificationId; + private UUID sourceNotificationId; + @Pattern(regexp = PatternStore.BPNL_STRING) private String partnerBpnl; private List<@Pattern(regexp = PatternStore.NON_EMPTY_NON_VERTICAL_WHITESPACE_STRING) String> affectedMaterialNumbers; + @Pattern(regexp = PatternStore.NON_EMPTY_NON_VERTICAL_WHITESPACE_STRING) private String text; private LeadingRootCauseEnumeration leadingRootCause; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/NotificationService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/DemandAndCapacityNotificationService.java similarity index 88% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/NotificationService.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/DemandAndCapacityNotificationService.java index fd45b6eb..c811b09c 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/NotificationService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/DemandAndCapacityNotificationService.java @@ -29,17 +29,17 @@ See the NOTICE file(s) distributed with this work for additional import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; -import org.eclipse.tractusx.puris.backend.notification.domain.model.Notification; +import org.eclipse.tractusx.puris.backend.notification.domain.model.DemandAndCapacityNotification; import org.springframework.data.jpa.repository.JpaRepository; -public abstract class NotificationService> { +public abstract class DemandAndCapacityNotificationService> { protected final TRepository repository; protected final PartnerService partnerService; protected final MaterialPartnerRelationService mprService; protected final Function validator; - public NotificationService(TRepository repository, PartnerService partnerService, MaterialPartnerRelationService mprService) { + public DemandAndCapacityNotificationService(TRepository repository, PartnerService partnerService, MaterialPartnerRelationService mprService) { this.repository = repository; this.partnerService = partnerService; this.mprService = mprService; @@ -74,6 +74,7 @@ public final TEntity update(TEntity notification) { if (notification.getUuid() == null || repository.findById(notification.getUuid()).isEmpty()) { return null; } + notification.setContentChangedAt(new Date()); return repository.save(notification); } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnNotificationService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnDemandAndCapacityNotificationService.java similarity index 78% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnNotificationService.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnDemandAndCapacityNotificationService.java index fb905107..727515bb 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnNotificationService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnDemandAndCapacityNotificationService.java @@ -24,22 +24,23 @@ See the NOTICE file(s) distributed with this work for additional import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; -import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnNotification; -import org.eclipse.tractusx.puris.backend.notification.domain.repository.OwnNotificationRepository; +import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnDemandAndCapacityNotification; +import org.eclipse.tractusx.puris.backend.notification.domain.repository.OwnDemandAndCapacityNotificationRepository; import org.springframework.stereotype.Service; @Service -public class OwnNotificationService extends NotificationService{ +public class OwnDemandAndCapacityNotificationService extends DemandAndCapacityNotificationService{ - public OwnNotificationService(OwnNotificationRepository ownNotificationRepository, PartnerService partnerService, MaterialPartnerRelationService mpr) { + public OwnDemandAndCapacityNotificationService(OwnDemandAndCapacityNotificationRepository ownNotificationRepository, PartnerService partnerService, MaterialPartnerRelationService mpr) { super(ownNotificationRepository, partnerService, mpr); } - public List findAllByPartnerBpnl(String bpnl) { + public List findAllByPartnerBpnl(String bpnl) { return repository.findAll().stream().filter(notification -> notification.getPartner().getBpnl().equals(bpnl)).toList(); } - public boolean validate(OwnNotification notification) { + @Override + public boolean validate(OwnDemandAndCapacityNotification notification) { return notification.getPartner() != null && notification.getText() != null && notification.getLeadingRootCause() != null && @@ -51,7 +52,7 @@ public boolean validate(OwnNotification notification) { validateSites(notification); } - public boolean validateMaterials(OwnNotification notification) { + public boolean validateMaterials(OwnDemandAndCapacityNotification notification) { if (notification.getMaterials() == null || notification.getMaterials().isEmpty()) { return true; } @@ -60,7 +61,7 @@ public boolean validateMaterials(OwnNotification notification) { notification.getMaterials().contains(mpr.getMaterial())).count() == notification.getMaterials().size(); } - public boolean validateSites(OwnNotification notification) { + public boolean validateSites(OwnDemandAndCapacityNotification notification) { return ( notification.getAffectedSitesRecipient() == null || notification.getAffectedSitesRecipient().isEmpty() || diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedNotificationService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedDemandAndCapacityNotificationService.java similarity index 78% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedNotificationService.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedDemandAndCapacityNotificationService.java index 27199dd4..af3b8a76 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedNotificationService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedDemandAndCapacityNotificationService.java @@ -24,24 +24,25 @@ See the NOTICE file(s) distributed with this work for additional import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; -import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedNotification; -import org.eclipse.tractusx.puris.backend.notification.domain.repository.ReportedNotificationRepository; +import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedDemandAndCapacityNotification; +import org.eclipse.tractusx.puris.backend.notification.domain.repository.ReportedDemandAndCapacityNotificationRepository; import org.springframework.stereotype.Service; @Service -public class ReportedNotificationService extends NotificationService { +public class ReportedDemandAndCapacityNotificationService extends DemandAndCapacityNotificationService { - public ReportedNotificationService(ReportedNotificationRepository reportedNotificationRepository, + public ReportedDemandAndCapacityNotificationService(ReportedDemandAndCapacityNotificationRepository reportedNotificationRepository, PartnerService partnerService, MaterialPartnerRelationService mpr) { super(reportedNotificationRepository, partnerService, mpr); } - public List findAllByPartnerBpnl(String bpnl) { + public List findAllByPartnerBpnl(String bpnl) { return repository.findAll().stream().filter(notification -> notification.getPartner().getBpnl().equals(bpnl)) .toList(); } - public boolean validate(ReportedNotification notification) { + @Override + public boolean validate(ReportedDemandAndCapacityNotification notification) { return notification.getPartner() != null && notification.getText() != null && notification.getLeadingRootCause() != null && @@ -53,7 +54,7 @@ public boolean validate(ReportedNotification notification) { validateSites(notification); } - public boolean validateMaterials(ReportedNotification notification) { + public boolean validateMaterials(ReportedDemandAndCapacityNotification notification) { if (notification.getMaterials() == null || notification.getMaterials().isEmpty()) { return true; } @@ -62,7 +63,7 @@ public boolean validateMaterials(ReportedNotification notification) { notification.getMaterials().contains(mpr.getMaterial())).count() == notification.getMaterials().size(); } - public boolean validateSites(ReportedNotification notification) { + public boolean validateSites(ReportedDemandAndCapacityNotification notification) { return ( notification.getAffectedSitesSender() == null || notification.getAffectedSitesSender().isEmpty() || From 5986299cea96b4bbd43dd63c12c41c34f06485e9 Mon Sep 17 00:00:00 2001 From: ReneSchroederLJ Date: Thu, 30 May 2024 08:55:11 +0200 Subject: [PATCH 3/3] chore: unified the naming for demand and capacity notification --- ...mandAndCapacityNotificationController.java | 32 +++++++++---------- .../model/DemandAndCapacityNotification.java | 2 +- .../domain/model/EffectEnumeration.java | 2 +- .../model/LeadingRootCauseEnumeration.java | 2 +- .../OwnDemandAndCapacityNotification.java | 2 +- ...ReportedDemandAndCapacityNotification.java | 2 +- .../domain/model/StatusEnumeration.java | 2 +- ...mandAndCapacityNotificationRepository.java | 4 +-- ...mandAndCapacityNotificationRepository.java | 4 +-- .../DemandAndCapacityNotificationDto.java} | 10 +++--- .../DemandAndCapacityNotificationService.java | 4 +-- ...nDemandAndCapacityNotificationService.java | 6 ++-- ...dDemandAndCapacityNotificationService.java | 6 ++-- 13 files changed, 39 insertions(+), 39 deletions(-) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/controller/DemandAndCapacityNotificationController.java (85%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/domain/model/DemandAndCapacityNotification.java (97%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/domain/model/EffectEnumeration.java (90%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/domain/model/LeadingRootCauseEnumeration.java (91%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/domain/model/OwnDemandAndCapacityNotification.java (92%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/domain/model/ReportedDemandAndCapacityNotification.java (92%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/domain/model/StatusEnumeration.java (89%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/domain/repository/OwnDemandAndCapacityNotificationRepository.java (82%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/domain/repository/ReportedDemandAndCapacityNotificationRepository.java (82%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification/logic/dto/NotificationDto.java => demandandcapacitynotification/logic/dto/DemandAndCapacityNotificationDto.java} (80%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/logic/service/DemandAndCapacityNotificationService.java (93%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/logic/service/OwnDemandAndCapacityNotificationService.java (90%) rename backend/src/main/java/org/eclipse/tractusx/puris/backend/{notification => demandandcapacitynotification}/logic/service/ReportedDemandAndCapacityNotificationService.java (90%) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/DemandAndCapacityNotificationController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/controller/DemandAndCapacityNotificationController.java similarity index 85% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/DemandAndCapacityNotificationController.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/controller/DemandAndCapacityNotificationController.java index 9b149a9c..20cb99f6 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/controller/DemandAndCapacityNotificationController.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/controller/DemandAndCapacityNotificationController.java @@ -17,7 +17,7 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.controller; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.controller; import java.util.ArrayList; import java.util.List; @@ -29,16 +29,16 @@ See the NOTICE file(s) distributed with this work for additional import javax.management.openmbean.KeyAlreadyExistsException; import org.eclipse.tractusx.puris.backend.common.util.PatternStore; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.OwnDemandAndCapacityNotification; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.ReportedDemandAndCapacityNotification; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.logic.dto.DemandAndCapacityNotificationDto; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.logic.service.OwnDemandAndCapacityNotificationService; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.logic.service.ReportedDemandAndCapacityNotificationService; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Site; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; -import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnDemandAndCapacityNotification; -import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedDemandAndCapacityNotification; -import org.eclipse.tractusx.puris.backend.notification.logic.dto.NotificationDto; -import org.eclipse.tractusx.puris.backend.notification.logic.service.OwnDemandAndCapacityNotificationService; -import org.eclipse.tractusx.puris.backend.notification.logic.service.ReportedDemandAndCapacityNotificationService; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -52,7 +52,7 @@ See the NOTICE file(s) distributed with this work for additional import jakarta.validation.constraints.Pattern; @RestController -@RequestMapping("notification") +@RequestMapping("demand-and-capacity-notification") public class DemandAndCapacityNotificationController { @Autowired private OwnDemandAndCapacityNotificationService ownNotificationService; @@ -75,7 +75,7 @@ public class DemandAndCapacityNotificationController { @GetMapping() @ResponseBody @Operation(summary = "Get all own notifications", description = "Get all own notifications. Optionally the partner can be filtered by its bpnl.") - public List getAllNotifications(Optional<@Pattern(regexp = PatternStore.BPNL_STRING) String> partnerBpnl) { + public List getAllNotifications(Optional<@Pattern(regexp = PatternStore.BPNL_STRING) String> partnerBpnl) { if (partnerBpnl.isEmpty()) { return ownNotificationService.findAll().stream().map(this::convertToDto).collect(Collectors.toList()); } else { @@ -93,7 +93,7 @@ public List getAllNotifications(Optional<@Pattern(regexp = Patt @ApiResponse(responseCode = "500", description = "Internal Server Error.") }) @ResponseStatus(HttpStatus.CREATED) - public NotificationDto createNotification(@RequestBody NotificationDto notificationDto) { + public DemandAndCapacityNotificationDto createNotification(@RequestBody DemandAndCapacityNotificationDto notificationDto) { if (!validator.validate(notificationDto).isEmpty()) { throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid Notification."); } @@ -123,7 +123,7 @@ public NotificationDto createNotification(@RequestBody NotificationDto notificat @ApiResponse(responseCode = "500", description = "Internal Server Error.") }) @ResponseStatus(HttpStatus.OK) - public NotificationDto updateNotification(@RequestBody NotificationDto dto) { + public DemandAndCapacityNotificationDto updateNotification(@RequestBody DemandAndCapacityNotificationDto dto) { OwnDemandAndCapacityNotification updatedNotification = ownNotificationService.update(convertToEntity(dto)); if (updatedNotification == null) { throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Notification does not exist."); @@ -151,7 +151,7 @@ public void deleteNotification(@PathVariable UUID id) { @GetMapping("reported") @ResponseBody @Operation(summary = "Get all reported notifications", description = "Get all reported notifications. Optionally the partner can be filtered by its bpnl.") - public List getAllReportedNotifications(Optional<@Pattern(regexp = PatternStore.BPNL_STRING) String> partnerBpnl) { + public List getAllReportedNotifications(Optional<@Pattern(regexp = PatternStore.BPNL_STRING) String> partnerBpnl) { if (partnerBpnl.isEmpty()) { return reportedNotificationService.findAll().stream().map(this::convertToDto).collect(Collectors.toList()); } else { @@ -159,8 +159,8 @@ public List getAllReportedNotifications(Optional<@Pattern(regex } } - private NotificationDto convertToDto(OwnDemandAndCapacityNotification entity) { - NotificationDto dto = modelMapper.map(entity, NotificationDto.class); + private DemandAndCapacityNotificationDto convertToDto(OwnDemandAndCapacityNotification entity) { + DemandAndCapacityNotificationDto dto = modelMapper.map(entity, DemandAndCapacityNotificationDto.class); if (entity.getMaterials() != null) { dto.setAffectedMaterialNumbers(entity.getMaterials().stream().map(Material::getOwnMaterialNumber).toList()); } @@ -176,8 +176,8 @@ private NotificationDto convertToDto(OwnDemandAndCapacityNotification entity) { return dto; } - private NotificationDto convertToDto(ReportedDemandAndCapacityNotification entity) { - NotificationDto dto = modelMapper.map(entity, NotificationDto.class); + private DemandAndCapacityNotificationDto convertToDto(ReportedDemandAndCapacityNotification entity) { + DemandAndCapacityNotificationDto dto = modelMapper.map(entity, DemandAndCapacityNotificationDto.class); if (entity.getMaterials() != null) { dto.setAffectedMaterialNumbers(entity.getMaterials().stream().map(Material::getOwnMaterialNumber).toList()); } @@ -191,7 +191,7 @@ private NotificationDto convertToDto(ReportedDemandAndCapacityNotification entit return dto; } - private OwnDemandAndCapacityNotification convertToEntity(NotificationDto dto) { + private OwnDemandAndCapacityNotification convertToEntity(DemandAndCapacityNotificationDto dto) { OwnDemandAndCapacityNotification entity = modelMapper.map(dto, OwnDemandAndCapacityNotification.class); Partner existingPartner = partnerService.findByBpnl(dto.getPartnerBpnl()); diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/DemandAndCapacityNotification.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/DemandAndCapacityNotification.java similarity index 97% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/DemandAndCapacityNotification.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/DemandAndCapacityNotification.java index e540a4f1..344a1b36 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/DemandAndCapacityNotification.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/DemandAndCapacityNotification.java @@ -18,7 +18,7 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.domain.model; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model; import java.util.Date; import java.util.List; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/EffectEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/EffectEnumeration.java similarity index 90% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/EffectEnumeration.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/EffectEnumeration.java index 0c35c10f..c0b4016f 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/EffectEnumeration.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/EffectEnumeration.java @@ -18,7 +18,7 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.domain.model; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/LeadingRootCauseEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/LeadingRootCauseEnumeration.java similarity index 91% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/LeadingRootCauseEnumeration.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/LeadingRootCauseEnumeration.java index bf36e3eb..0d282aa6 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/LeadingRootCauseEnumeration.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/LeadingRootCauseEnumeration.java @@ -18,7 +18,7 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.domain.model; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnDemandAndCapacityNotification.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/OwnDemandAndCapacityNotification.java similarity index 92% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnDemandAndCapacityNotification.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/OwnDemandAndCapacityNotification.java index 6134fdaa..501572c0 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/OwnDemandAndCapacityNotification.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/OwnDemandAndCapacityNotification.java @@ -18,7 +18,7 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.domain.model; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model; import jakarta.persistence.Entity; import lombok.NoArgsConstructor; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedDemandAndCapacityNotification.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/ReportedDemandAndCapacityNotification.java similarity index 92% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedDemandAndCapacityNotification.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/ReportedDemandAndCapacityNotification.java index 8f1e4e80..83f79a34 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/ReportedDemandAndCapacityNotification.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/ReportedDemandAndCapacityNotification.java @@ -18,7 +18,7 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.domain.model; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model; import jakarta.persistence.Entity; import lombok.NoArgsConstructor; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/StatusEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/StatusEnumeration.java similarity index 89% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/StatusEnumeration.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/StatusEnumeration.java index 8c50f262..4089f3d6 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/model/StatusEnumeration.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/model/StatusEnumeration.java @@ -18,7 +18,7 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.domain.model; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnDemandAndCapacityNotificationRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/repository/OwnDemandAndCapacityNotificationRepository.java similarity index 82% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnDemandAndCapacityNotificationRepository.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/repository/OwnDemandAndCapacityNotificationRepository.java index b2a436af..f4aa6748 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/OwnDemandAndCapacityNotificationRepository.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/repository/OwnDemandAndCapacityNotificationRepository.java @@ -18,11 +18,11 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.domain.repository; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.repository; import java.util.UUID; -import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnDemandAndCapacityNotification; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.OwnDemandAndCapacityNotification; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedDemandAndCapacityNotificationRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/repository/ReportedDemandAndCapacityNotificationRepository.java similarity index 82% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedDemandAndCapacityNotificationRepository.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/repository/ReportedDemandAndCapacityNotificationRepository.java index 63e1c54d..12154b2a 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/domain/repository/ReportedDemandAndCapacityNotificationRepository.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/domain/repository/ReportedDemandAndCapacityNotificationRepository.java @@ -18,11 +18,11 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.domain.repository; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.repository; import java.util.UUID; -import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedDemandAndCapacityNotification; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.ReportedDemandAndCapacityNotification; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/dto/NotificationDto.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/dto/DemandAndCapacityNotificationDto.java similarity index 80% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/dto/NotificationDto.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/dto/DemandAndCapacityNotificationDto.java index cb925ecf..12295eaa 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/dto/NotificationDto.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/dto/DemandAndCapacityNotificationDto.java @@ -18,7 +18,7 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.logic.dto; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.logic.dto; import java.io.Serializable; import java.util.Date; @@ -26,9 +26,9 @@ See the NOTICE file(s) distributed with this work for additional import java.util.UUID; import org.eclipse.tractusx.puris.backend.common.util.PatternStore; -import org.eclipse.tractusx.puris.backend.notification.domain.model.EffectEnumeration; -import org.eclipse.tractusx.puris.backend.notification.domain.model.LeadingRootCauseEnumeration; -import org.eclipse.tractusx.puris.backend.notification.domain.model.StatusEnumeration; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.EffectEnumeration; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.LeadingRootCauseEnumeration; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.StatusEnumeration; import jakarta.validation.constraints.Pattern; import lombok.Getter; @@ -40,7 +40,7 @@ See the NOTICE file(s) distributed with this work for additional @Setter @NoArgsConstructor @ToString -public class NotificationDto implements Serializable { +public class DemandAndCapacityNotificationDto implements Serializable { private UUID uuid; private UUID relatedNotificationId; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/DemandAndCapacityNotificationService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/service/DemandAndCapacityNotificationService.java similarity index 93% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/DemandAndCapacityNotificationService.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/service/DemandAndCapacityNotificationService.java index c811b09c..ecd517a1 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/DemandAndCapacityNotificationService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/service/DemandAndCapacityNotificationService.java @@ -18,7 +18,7 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.logic.service; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.logic.service; import java.util.Date; import java.util.List; @@ -27,9 +27,9 @@ See the NOTICE file(s) distributed with this work for additional import javax.management.openmbean.KeyAlreadyExistsException; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.DemandAndCapacityNotification; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; -import org.eclipse.tractusx.puris.backend.notification.domain.model.DemandAndCapacityNotification; import org.springframework.data.jpa.repository.JpaRepository; public abstract class DemandAndCapacityNotificationService> { diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnDemandAndCapacityNotificationService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/service/OwnDemandAndCapacityNotificationService.java similarity index 90% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnDemandAndCapacityNotificationService.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/service/OwnDemandAndCapacityNotificationService.java index 727515bb..91a7c38c 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/OwnDemandAndCapacityNotificationService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/service/OwnDemandAndCapacityNotificationService.java @@ -18,14 +18,14 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.logic.service; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.logic.service; import java.util.List; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.OwnDemandAndCapacityNotification; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.repository.OwnDemandAndCapacityNotificationRepository; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; -import org.eclipse.tractusx.puris.backend.notification.domain.model.OwnDemandAndCapacityNotification; -import org.eclipse.tractusx.puris.backend.notification.domain.repository.OwnDemandAndCapacityNotificationRepository; import org.springframework.stereotype.Service; @Service diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedDemandAndCapacityNotificationService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/service/ReportedDemandAndCapacityNotificationService.java similarity index 90% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedDemandAndCapacityNotificationService.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/service/ReportedDemandAndCapacityNotificationService.java index af3b8a76..7aa2f7f8 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/notification/logic/service/ReportedDemandAndCapacityNotificationService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/demandandcapacitynotification/logic/service/ReportedDemandAndCapacityNotificationService.java @@ -18,14 +18,14 @@ See the NOTICE file(s) distributed with this work for additional SPDX-License-Identifier: Apache-2.0 */ -package org.eclipse.tractusx.puris.backend.notification.logic.service; +package org.eclipse.tractusx.puris.backend.demandandcapacitynotification.logic.service; import java.util.List; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.model.ReportedDemandAndCapacityNotification; +import org.eclipse.tractusx.puris.backend.demandandcapacitynotification.domain.repository.ReportedDemandAndCapacityNotificationRepository; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; -import org.eclipse.tractusx.puris.backend.notification.domain.model.ReportedDemandAndCapacityNotification; -import org.eclipse.tractusx.puris.backend.notification.domain.repository.ReportedDemandAndCapacityNotificationRepository; import org.springframework.stereotype.Service; @Service