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)); }