Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,18 @@ public ResponseEntity<String> getVoltageLevelSwitches(
return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(studyService.getVoltageLevelSwitches(nodeUuid, rootNetworkUuid, voltageLevelId, inUpstreamBuiltParentNode));
}

@GetMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/network/voltage-levels/{voltageLevelId}/topology")
@Operation(summary = "get the topology for a given network and a given voltage level")
@ApiResponse(responseCode = "200", description = "The topology of given voltage level")
public ResponseEntity<String> getVoltageLevelTopology(
@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.getVoltageLevelTopology(nodeUuid, rootNetworkUuid, voltageLevelId, inUpstreamBuiltParentNode));
}

@GetMapping(value = "/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/network/voltage-levels/{voltageLevelId}/substation-id")
@Operation(summary = "get the substation ID for a given network and a given voltage level")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The substation Id for a voltageLevel")})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,20 @@ public String getVoltageLevelSwitches(UUID networkUuid, String variantId,
}, networkUuid, voltageLevelId).getBody();
}

public String getVoltageLevelTopology(UUID networkUuid, String variantId,
String voltageLevelId,
String topologyPath) {
UriComponentsBuilder builder = UriComponentsBuilder.fromPath(DELIMITER + NETWORK_MAP_API_VERSION
+ "/networks/{networkUuid}/voltage-levels/{voltageLevelId}/" + topologyPath);
if (!StringUtils.isBlank(variantId)) {
builder = builder.queryParam(QUERY_PARAM_VARIANT_ID, variantId);
}

return restTemplate.exchange(networkMapServerBaseUri + builder.build().toUriString(), HttpMethod.GET, null,
new ParameterizedTypeReference<String>() {
}, networkUuid, voltageLevelId).getBody();
}

public void setNetworkMapServerBaseUri(String networkMapServerBaseUri) {
this.networkMapServerBaseUri = networkMapServerBaseUri;
}
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/org/gridsuite/study/server/service/StudyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1841,6 +1841,14 @@ public String getVoltageLevelSwitches(UUID nodeUuid, UUID rootNetworkUuid, Strin
return networkMapService.getVoltageLevelSwitches(networkUuid, variantId, voltageLevelId, switchesPath);
}

public String getVoltageLevelTopology(UUID nodeUuid, UUID rootNetworkUuid, String voltageLevelId,
String topologyPath) {
UUID networkUuid = rootNetworkService.getNetworkUuid(rootNetworkUuid);
String variantId = networkModificationTreeService.getVariantId(nodeUuid, rootNetworkUuid);

return networkMapService.getVoltageLevelTopology(networkUuid, variantId, voltageLevelId, topologyPath);
}

public String getVoltageLevelSubstationId(UUID studyUuid, UUID nodeUuid, UUID rootNetworkUuid, String voltageLevelId, boolean inUpstreamBuiltParentNode) {
UUID nodeUuidToSearchIn = getNodeUuidToSearchIn(nodeUuid, rootNetworkUuid, inUpstreamBuiltParentNode);
return getVoltageLevelSubstationId(nodeUuidToSearchIn, rootNetworkUuid, voltageLevelId);
Expand All @@ -1856,6 +1864,11 @@ public String getVoltageLevelSwitches(UUID nodeUuid, UUID rootNetworkUuid, Strin
return getVoltageLevelSwitches(nodeUuidToSearchIn, rootNetworkUuid, voltageLevelId, "switches");
}

public String getVoltageLevelTopology(UUID nodeUuid, UUID rootNetworkUuid, String voltageLevelId, boolean inUpstreamBuiltParentNode) {
UUID nodeUuidToSearchIn = getNodeUuidToSearchIn(nodeUuid, rootNetworkUuid, inUpstreamBuiltParentNode);
return getVoltageLevelTopology(nodeUuidToSearchIn, rootNetworkUuid, voltageLevelId, "topology");
}

@Transactional
public void buildNode(@NonNull UUID studyUuid, @NonNull UUID nodeUuid, @NonNull UUID rootNetworkUuid, @NonNull String userId) {
buildNode(studyUuid, nodeUuid, rootNetworkUuid, userId, null);
Expand Down