diff --git a/src/main/java/org/gridsuite/study/server/controller/StudyController.java b/src/main/java/org/gridsuite/study/server/controller/StudyController.java index 19648a426..b606028d0 100644 --- a/src/main/java/org/gridsuite/study/server/controller/StudyController.java +++ b/src/main/java/org/gridsuite/study/server/controller/StudyController.java @@ -457,31 +457,31 @@ public ResponseEntity getVoltageLevelSwitches( @PathVariable("nodeUuid") UUID nodeUuid, @PathVariable("voltageLevelId") String voltageLevelId, @Parameter(description = "Should get in upstream built node ?") @RequestParam(value = "inUpstreamBuiltParentNode", required = false, defaultValue = "false") boolean inUpstreamBuiltParentNode) { - return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.getVoltageLevelInformation(nodeUuid, rootNetworkUuid, voltageLevelId, inUpstreamBuiltParentNode, "switches")); + return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.getVoltageLevelTopologyInfos(nodeUuid, rootNetworkUuid, voltageLevelId, inUpstreamBuiltParentNode, "switches")); } @GetMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/network/voltage-levels/{voltageLevelId}/bus-bar-sections") @Operation(summary = "get bus bar sections information for a given network and voltage level") @ApiResponse(responseCode = "200", description = "Bus bar sections information of the given voltage level retrieved") - public ResponseEntity getBusBarSectionsInfo( + public ResponseEntity getVoltageLevelBusBarSections( @PathVariable("studyUuid") UUID studyUuid, @PathVariable("rootNetworkUuid") UUID rootNetworkUuid, @PathVariable("nodeUuid") UUID nodeUuid, @PathVariable("voltageLevelId") String voltageLevelId, @Parameter(description = "Should get in upstream built node ?") @RequestParam(value = "inUpstreamBuiltParentNode", required = false, defaultValue = "false") boolean inUpstreamBuiltParentNode) { - return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.getVoltageLevelInformation(nodeUuid, rootNetworkUuid, voltageLevelId, inUpstreamBuiltParentNode, "bus-bar-sections")); + return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.getVoltageLevelTopologyInfos(nodeUuid, rootNetworkUuid, voltageLevelId, inUpstreamBuiltParentNode, "bus-bar-sections")); } - @GetMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/network/voltage-levels/{voltageLevelId}/feeder-bays-and-bus-bar-sections") - @Operation(summary = "get feeder bays and bus bar sections information for a given network and voltage level") - @ApiResponse(responseCode = "200", description = "Feeder bays and bus bar sections information of the given voltage level retrieved") - public ResponseEntity getFeederBaysBusBarSectionsInfo( + @GetMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/network/voltage-levels/{voltageLevelId}/feeder-bays") + @Operation(summary = "get feeder bays informations for a given network and voltage level") + @ApiResponse(responseCode = "200", description = "Feeder bays informations of the given voltage level retrieved") + public ResponseEntity getVoltageLevelFeederBays( @PathVariable("studyUuid") UUID studyUuid, @PathVariable("rootNetworkUuid") UUID rootNetworkUuid, @PathVariable("nodeUuid") UUID nodeUuid, @PathVariable("voltageLevelId") String voltageLevelId, @Parameter(description = "Should get in upstream built node ?") @RequestParam(value = "inUpstreamBuiltParentNode", required = false, defaultValue = "false") boolean inUpstreamBuiltParentNode) { - return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.getVoltageLevelInformation(nodeUuid, rootNetworkUuid, voltageLevelId, inUpstreamBuiltParentNode, "feeder-bays-and-bus-bar-sections")); + return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.getVoltageLevelTopologyInfos(nodeUuid, rootNetworkUuid, voltageLevelId, inUpstreamBuiltParentNode, "feeder-bays")); } @GetMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/network/voltage-levels/{voltageLevelId}/substation-id") diff --git a/src/main/java/org/gridsuite/study/server/service/NetworkMapService.java b/src/main/java/org/gridsuite/study/server/service/NetworkMapService.java index 2c41b6634..4331c3566 100644 --- a/src/main/java/org/gridsuite/study/server/service/NetworkMapService.java +++ b/src/main/java/org/gridsuite/study/server/service/NetworkMapService.java @@ -251,9 +251,9 @@ public List getVoltageLevelBusesOrBusbarSections(UUID network }, networkUuid, voltageLevelId).getBody(); } - public String getVoltageLevelInformation(UUID networkUuid, String variantId, - String voltageLevelId, - String path) { + public String getVoltageLevelTopologyInfos(UUID networkUuid, String variantId, + String voltageLevelId, + String path) { UriComponentsBuilder builder = UriComponentsBuilder.fromPath(DELIMITER + NETWORK_MAP_API_VERSION + "/networks/{networkUuid}/voltage-levels/{voltageLevelId}/" + path); if (!StringUtils.isBlank(variantId)) { diff --git a/src/main/java/org/gridsuite/study/server/service/StudyService.java b/src/main/java/org/gridsuite/study/server/service/StudyService.java index e2a274b4f..adf64874c 100644 --- a/src/main/java/org/gridsuite/study/server/service/StudyService.java +++ b/src/main/java/org/gridsuite/study/server/service/StudyService.java @@ -1792,12 +1792,12 @@ public List getVoltageLevelBusesOrBusbarSections(UUID nodeUui return networkMapService.getVoltageLevelBusesOrBusbarSections(networkUuid, variantId, voltageLevelId, busPath); } - public String getVoltageLevelInformation(UUID nodeUuid, UUID rootNetworkUuid, String voltageLevelId, - String path) { + public String getVoltageLevelTopologyInfos(UUID nodeUuid, UUID rootNetworkUuid, String voltageLevelId, + String path) { UUID networkUuid = rootNetworkService.getNetworkUuid(rootNetworkUuid); String variantId = networkModificationTreeService.getVariantId(nodeUuid, rootNetworkUuid); - return networkMapService.getVoltageLevelInformation(networkUuid, variantId, voltageLevelId, path); + return networkMapService.getVoltageLevelTopologyInfos(networkUuid, variantId, voltageLevelId, path); } public String getVoltageLevelSubstationId(UUID studyUuid, UUID nodeUuid, UUID rootNetworkUuid, String voltageLevelId, boolean inUpstreamBuiltParentNode) { @@ -1810,9 +1810,9 @@ public List getVoltageLevelBusesOrBusbarSections(UUID nodeUui return getVoltageLevelBusesOrBusbarSections(nodeUuidToSearchIn, rootNetworkUuid, voltageLevelId, "buses-or-busbar-sections"); } - public String getVoltageLevelInformation(UUID nodeUuid, UUID rootNetworkUuid, String voltageLevelId, boolean inUpstreamBuiltParentNode, String path) { + public String getVoltageLevelTopologyInfos(UUID nodeUuid, UUID rootNetworkUuid, String voltageLevelId, boolean inUpstreamBuiltParentNode, String path) { UUID nodeUuidToSearchIn = getNodeUuidToSearchIn(nodeUuid, rootNetworkUuid, inUpstreamBuiltParentNode); - return getVoltageLevelInformation(nodeUuidToSearchIn, rootNetworkUuid, voltageLevelId, path); + return getVoltageLevelTopologyInfos(nodeUuidToSearchIn, rootNetworkUuid, voltageLevelId, path); } @Transactional diff --git a/src/test/java/org/gridsuite/study/server/NetworkMapTest.java b/src/test/java/org/gridsuite/study/server/NetworkMapTest.java index e5702c723..73484226f 100644 --- a/src/test/java/org/gridsuite/study/server/NetworkMapTest.java +++ b/src/test/java/org/gridsuite/study/server/NetworkMapTest.java @@ -185,7 +185,7 @@ public MockResponse dispatch(RecordedRequest request) { return new MockResponse(200, Headers.of(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE), SWITCHES_INFOS_JSON); case "/v1/networks/" + NETWORK_UUID_STRING + "/voltage-levels/" + VOLTAGE_LEVEL_ID + "/bus-bar-sections?variantId=first_variant_id": return new MockResponse(200, Headers.of(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE), BUSBAR_SECTIONS_INFO_JSON); - case "/v1/networks/" + NETWORK_UUID_STRING + "/voltage-levels/" + VOLTAGE_LEVEL_ID + "/feeder-bays-and-bus-bar-sections?variantId=first_variant_id": + case "/v1/networks/" + NETWORK_UUID_STRING + "/voltage-levels/" + VOLTAGE_LEVEL_ID + "/feeder-bays?variantId=first_variant_id": return new MockResponse(200, Headers.of(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE), FEEDER_BAYS_BUSBAR_SECTIONS_INFO_JSON); case "/v1/networks/" + NETWORK_UUID_STRING + "/voltage-levels/" + VOLTAGE_LEVEL_ID + "/substation-id?variantId=first_variant_id": return new MockResponse.Builder().code(200).body(SUBSTATION_ID_1).build(); @@ -605,7 +605,7 @@ void testGetFeederBaysBusBarSectionsInfo(final MockWebServer server) throws Exce UUID firstRootNetworkUuid = studyTestUtils.getOneRootNetworkUuid(studyEntity.getId()); AbstractNode node = getRootNode(studyEntity.getId()).getChildren().stream().findFirst().orElseThrow(); - mvcResult = mockMvc.perform(get("/v1/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/network/voltage-levels/{voltageLevelId}/feeder-bays-and-bus-bar-sections", + mvcResult = mockMvc.perform(get("/v1/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/network/voltage-levels/{voltageLevelId}/feeder-bays", studyEntity.getId(), firstRootNetworkUuid, node.getId(), VOLTAGE_LEVEL_ID)) .andExpect(status().isOk()) .andReturn(); @@ -614,7 +614,7 @@ void testGetFeederBaysBusBarSectionsInfo(final MockWebServer server) throws Exce var requests = TestUtils.getRequestsDone(1, server); assertTrue(requests.stream().anyMatch(r -> r.matches( - "/v1/networks/" + NETWORK_UUID_STRING + "/voltage-levels/" + VOLTAGE_LEVEL_ID + "/feeder-bays-and-bus-bar-sections\\?variantId=first_variant_id"))); + "/v1/networks/" + NETWORK_UUID_STRING + "/voltage-levels/" + VOLTAGE_LEVEL_ID + "/feeder-bays\\?variantId=first_variant_id"))); }