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 1ff8dc831..6789091e0 100644 --- a/src/main/java/org/gridsuite/study/server/controller/StudyController.java +++ b/src/main/java/org/gridsuite/study/server/controller/StudyController.java @@ -17,7 +17,6 @@ import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.gridsuite.study.server.StudyApi; -import org.gridsuite.study.server.StudyConstants.*; import org.gridsuite.study.server.StudyException; import org.gridsuite.study.server.StudyException.Type; import org.gridsuite.study.server.dto.*; @@ -600,6 +599,19 @@ public ResponseEntity getVoltageLevelEquipments( return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.getVoltageLevelEquipments(nodeUuid, rootNetworkUuid, inUpstreamBuiltParentNode, voltageLevelId)); } + @GetMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/network-map/voltage-levels/{voltageLevelId}/connections") + @Operation(summary = "Get voltage level equipments") + @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Voltage level equipments")}) + public ResponseEntity getVoltageLevelConnections( + @PathVariable("studyUuid") UUID studyUuid, + @PathVariable("rootNetworkUuid") UUID rootNetworkUuid, + @PathVariable("nodeUuid") UUID nodeUuid, + @Parameter(description = "voltage level id") @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.getVoltageLevelConnections(nodeUuid, rootNetworkUuid, inUpstreamBuiltParentNode, voltageLevelId)); + } + @GetMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/network-map/all") @Operation(summary = "Get Network equipments description") @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The list of equipments data")}) 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 6d998c812..9101aa10b 100644 --- a/src/main/java/org/gridsuite/study/server/service/StudyService.java +++ b/src/main/java/org/gridsuite/study/server/service/StudyService.java @@ -844,6 +844,13 @@ public String getVoltageLevelEquipments(UUID nodeUuid, UUID rootNetworkUuid, boo null, equipmentPath); } + public String getVoltageLevelConnections(UUID nodeUuid, UUID rootNetworkUuid, boolean inUpstreamBuiltParentNode, String voltageLevelId) { + UUID nodeUuidToSearchIn = getNodeUuidToSearchIn(nodeUuid, rootNetworkUuid, inUpstreamBuiltParentNode); + String equipmentPath = "voltage-levels" + StudyConstants.DELIMITER + voltageLevelId + StudyConstants.DELIMITER + "connections"; + return networkMapService.getEquipmentsMapData(rootNetworkService.getNetworkUuid(rootNetworkUuid), networkModificationTreeService.getVariantId(nodeUuidToSearchIn, rootNetworkUuid), + null, equipmentPath); + } + public String getHvdcLineShuntCompensators(UUID nodeUuid, UUID rootNetworkUuid, boolean inUpstreamBuiltParentNode, String hvdcId) { UUID nodeUuidToSearchIn = getNodeUuidToSearchIn(nodeUuid, rootNetworkUuid, inUpstreamBuiltParentNode); UUID networkUuid = rootNetworkService.getNetworkUuid(rootNetworkUuid);