From 5acecf225c3b6bb00abda74b504a784dfb209bfb Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Thu, 22 Aug 2024 11:03:06 +0200 Subject: [PATCH] fix: initial commit --- .../masterdata/controller/PartnerController.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/controller/PartnerController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/controller/PartnerController.java index d99fbee8..7fea5cb2 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/controller/PartnerController.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/controller/PartnerController.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2023, 2024 Volkswagen AG - * Copyright (c) 2023, 2024 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. * (represented by Fraunhofer ISST) * Copyright (c) 2023, 2024 Contributors to the Eclipse Foundation * @@ -29,6 +29,7 @@ import jakarta.validation.Validator; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.puris.backend.common.util.PatternStore; +import org.eclipse.tractusx.puris.backend.common.util.VariablesService; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Address; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; @@ -59,6 +60,9 @@ public class PartnerController { @Autowired private PartnerService partnerService; + @Autowired + private VariablesService variablesService; + @Autowired private Validator validator; private final ModelMapper modelMapper = new ModelMapper(); @@ -221,8 +225,11 @@ public ResponseEntity getPartner( @GetMapping("/all") @Operation(description = "Returns a list of all Partners. ") public ResponseEntity> listPartners() { - return new ResponseEntity<>(partnerService.findAll(). - stream().map(partner -> modelMapper.map(partner, PartnerDto.class)).collect(Collectors.toList()), + final String ownBpnl = variablesService.getOwnBpnl(); + return new ResponseEntity<>(partnerService.findAll().stream() + .filter(partner -> !partner.getBpnl().equals(ownBpnl)) + .map(partner -> modelMapper.map(partner, PartnerDto.class)) + .collect(Collectors.toList()), HttpStatusCode.valueOf(200)); }