Skip to content

Commit 431a658

Browse files
Merge branch 'main' into send-all-limit-sets-to-branch-forms
2 parents d552f64 + 3ee80f9 commit 431a658

28 files changed

+4341
-142
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
uses: powsybl/github-ci/.github/workflows/build-backend-app-generic.yml@69b162754c0728d9aeb2ea568eaf47f28f60fafb
11+
uses: powsybl/github-ci/.github/workflows/build-backend-app-generic.yml@aaae75875296657028f2805e7a3fbdb1418b8b95
1212
with:
1313
dockerImage: docker.io/gridsuite/network-map-server
1414
dockerUsername: gridsuiteci

.github/workflows/patch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
run-patch:
12-
uses: powsybl/github-ci/.github/workflows/patch-backend-app-generic.yml@69b162754c0728d9aeb2ea568eaf47f28f60fafb
12+
uses: powsybl/github-ci/.github/workflows/patch-backend-app-generic.yml@aaae75875296657028f2805e7a3fbdb1418b8b95
1313
with:
1414
githubappId: ${{ vars.GRIDSUITE_ACTIONS_APPID }}
1515
dockerImage: docker.io/gridsuite/network-map-server

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
run-release:
15-
uses: powsybl/github-ci/.github/workflows/release-backend-app-generic.yml@69b162754c0728d9aeb2ea568eaf47f28f60fafb
15+
uses: powsybl/github-ci/.github/workflows/release-backend-app-generic.yml@aaae75875296657028f2805e7a3fbdb1418b8b95
1616
with:
1717
githubappId: ${{ vars.GRIDSUITE_ACTIONS_APPID }}
1818
dockerImage: docker.io/gridsuite/network-map-server

pom.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<groupId>org.gridsuite</groupId>
2121
<artifactId>gridsuite-network-map-server</artifactId>
22-
<version>2.23.0-SNAPSHOT</version>
22+
<version>2.24.0-SNAPSHOT</version>
2323

2424
<packaging>jar</packaging>
2525
<name>Network map server</name>
@@ -42,7 +42,7 @@
4242
</developers>
4343

4444
<properties>
45-
45+
<jackson-module-jsonSchema.version>2.15.2</jackson-module-jsonSchema.version>
4646
<gridsuite-dependencies.version>43.0.0</gridsuite-dependencies.version>
4747
<sonar.organization>gridsuite</sonar.organization>
4848
<sonar.projectKey>org.gridsuite:network-map-server</sonar.projectKey>
@@ -80,6 +80,12 @@
8080

8181
<dependencyManagement>
8282
<dependencies>
83+
<dependency>
84+
<groupId>com.fasterxml.jackson.module</groupId>
85+
<artifactId>jackson-module-jsonSchema</artifactId>
86+
<version>${jackson-module-jsonSchema.version}</version>
87+
</dependency>
88+
8389
<!-- project specific dependencies (must be before to have priority during resolution) -->
8490
<dependency><!--TODO remove when springboot version will be updated-->
8591
<groupId>org.junit</groupId>
@@ -110,6 +116,10 @@
110116

111117
<!-- Compilation dependencies -->
112118
<!-- overrides of imports -->
119+
<dependency>
120+
<groupId>com.fasterxml.jackson.module</groupId>
121+
<artifactId>jackson-module-jsonSchema</artifactId>
122+
</dependency>
113123
<dependency>
114124
<groupId>com.powsybl</groupId>
115125
<artifactId>powsybl-network-store-client</artifactId>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
package org.gridsuite.network.map;
8+
9+
/**
10+
* @author Hugo Marcellin <hugo.marcelin at rte-france.com>
11+
*/
12+
13+
public final class NetworkMapApi {
14+
15+
private NetworkMapApi() {
16+
}
17+
18+
public static final String API_VERSION = "v1";
19+
}

src/main/java/org/gridsuite/network/map/NetworkMapController.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616
import lombok.AllArgsConstructor;
1717
import org.gridsuite.network.map.dto.*;
1818
import org.gridsuite.network.map.dto.definition.hvdc.HvdcShuntCompensatorsInfos;
19+
import org.gridsuite.network.map.services.NetworkMapService;
1920
import org.springframework.context.annotation.ComponentScan;
2021
import org.springframework.web.bind.annotation.*;
2122

22-
import java.util.Comparator;
23-
import java.util.List;
24-
import java.util.Optional;
25-
import java.util.UUID;
23+
import java.util.*;
2624

2725
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
2826

@@ -31,14 +29,11 @@
3129
* @author Franck Lecuyer <franck.lecuyer at rte-france.com>
3230
*/
3331
@RestController
34-
@RequestMapping(value = "/" + NetworkMapController.API_VERSION + "/")
35-
@Tag(name = "network-map-server")
32+
@RequestMapping(value = "/" + NetworkMapApi.API_VERSION + "/")
33+
@Tag(name = "Network map server")
3634
@ComponentScan(basePackageClasses = NetworkMapService.class)
3735
@AllArgsConstructor
3836
public class NetworkMapController {
39-
40-
public static final String API_VERSION = "v1";
41-
4237
private final NetworkMapService networkMapService;
4338

4439
@PostMapping(value = "/networks/{networkUuid}/elements-ids", produces = APPLICATION_JSON_VALUE)
@@ -52,13 +47,14 @@ public List<String> getElementsIds(@Parameter(description = "Network UUID") @Pat
5247
return networkMapService.getElementsIds(networkUuid, variantId, substationsIds.orElseGet(List::of), elementType, nominalVoltages);
5348
}
5449

55-
@GetMapping(value = "/networks/{networkUuid}/all", produces = APPLICATION_JSON_VALUE)
50+
@PostMapping(value = "/networks/{networkUuid}/all", produces = APPLICATION_JSON_VALUE)
5651
@Operation(summary = "Get all equipments descriptions")
5752
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "all equipments descriptions")})
5853
public AllElementsInfos getAll(@Parameter(description = "Network UUID") @PathVariable("networkUuid") UUID networkUuid,
5954
@Parameter(description = "Variant Id") @RequestParam(name = "variantId", required = false) String variantId,
60-
@Parameter(description = "Substations id") @RequestParam(name = "substationId", defaultValue = "") List<String> substationsIds) {
61-
return networkMapService.getAllElementsInfos(networkUuid, variantId, substationsIds);
55+
@Parameter(description = "Substations id") @RequestParam(name = "substationId", defaultValue = "") List<String> substationsIds,
56+
@RequestBody Map<String, Map<String, String>> additionalParametersByType) {
57+
return networkMapService.getAllElementsInfos(networkUuid, variantId, substationsIds, additionalParametersByType);
6258
}
6359

6460
@PostMapping(value = "/networks/{networkUuid}/elements", produces = APPLICATION_JSON_VALUE)

src/main/java/org/gridsuite/network/map/NetworkMapSwaggerConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ public OpenAPI createOpenApi() {
2222
.info(new Info()
2323
.title("Network map API")
2424
.description("This is the documentation of network map REST API")
25-
.version(NetworkMapController.API_VERSION));
25+
.version(NetworkMapApi.API_VERSION));
2626
}
2727
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
package org.gridsuite.network.map;
8+
9+
import com.fasterxml.jackson.databind.JsonMappingException;
10+
import com.fasterxml.jackson.module.jsonSchema.JsonSchema;
11+
import io.swagger.v3.oas.annotations.Operation;
12+
import io.swagger.v3.oas.annotations.Parameter;
13+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
14+
import io.swagger.v3.oas.annotations.tags.Tag;
15+
import lombok.AllArgsConstructor;
16+
import org.gridsuite.network.map.dto.ElementInfos.InfoType;
17+
import org.gridsuite.network.map.dto.ElementType;
18+
import org.gridsuite.network.map.services.SchemaService;
19+
import org.springframework.http.HttpStatus;
20+
import org.springframework.web.bind.annotation.GetMapping;
21+
import org.springframework.web.bind.annotation.PathVariable;
22+
import org.springframework.web.bind.annotation.RequestMapping;
23+
import org.springframework.web.bind.annotation.RestController;
24+
import org.springframework.web.server.ResponseStatusException;
25+
26+
@RestController
27+
@RequestMapping(value = "/" + NetworkMapApi.API_VERSION + "/schemas")
28+
@Tag(name = "Network map server - Schemas")
29+
@AllArgsConstructor
30+
public class SchemaController {
31+
public static final String APPLICATION_JSON_SCHEMA_VALUE = "application/schema+json";
32+
private final SchemaService schemaService;
33+
34+
@GetMapping(value = "/{elementType}/{infoType}", produces = APPLICATION_JSON_SCHEMA_VALUE)
35+
@Operation(summary = "Get element schema description")
36+
@ApiResponse(responseCode = "200", description = "Element schema")
37+
public JsonSchema getElementSchema(@Parameter(description = "Element type") @PathVariable(name = "elementType") ElementType elementType,
38+
@Parameter(description = "Info type") @PathVariable(name = "infoType") InfoType infoType) {
39+
try {
40+
return schemaService.getSchema(elementType, infoType);
41+
} catch (final UnsupportedOperationException | JsonMappingException ex) {
42+
throw new ResponseStatusException(HttpStatus.NOT_IMPLEMENTED, "The view " + infoType + " for " + elementType + " type is not available yet.");
43+
}
44+
}
45+
}

src/main/java/org/gridsuite/network/map/dto/InfoTypeParameters.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
@Data
1515
public class InfoTypeParameters {
1616
public static final String QUERY_PARAM_DC_POWERFACTOR = "dcPowerFactor";
17+
public static final String QUERY_PARAM_LOAD_OPERATIONAL_LIMIT_GROUPS = "loadOperationalLimitGroups";
18+
public static final String QUERY_PARAM_LOAD_REGULATING_TERMINALS = "loadRegulatingTerminals";
1719

1820
public static final InfoTypeParameters TAB = new InfoTypeParameters(ElementInfos.InfoType.TAB, null);
1921

src/main/java/org/gridsuite/network/map/dto/definition/branch/BranchTabInfos.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,23 @@ public class BranchTabInfos extends ElementInfosWithProperties {
8282
@JsonInclude(Include.NON_EMPTY)
8383
private List<String> operationalLimitsGroup1Names;
8484

85+
@JsonInclude(Include.NON_EMPTY)
86+
private CurrentLimitsData selectedOperationalLimitsGroup1;
87+
8588
@JsonInclude(Include.NON_NULL)
86-
private String selectedOperationalLimitsGroup1;
89+
private String selectedOperationalLimitsGroup1Name;
8790

8891
@JsonInclude(Include.NON_EMPTY)
8992
private Map<String, CurrentLimitsData> operationalLimitsGroup2;
9093

9194
@JsonInclude(Include.NON_EMPTY)
9295
private List<String> operationalLimitsGroup2Names;
9396

97+
@JsonInclude(Include.NON_EMPTY)
98+
private CurrentLimitsData selectedOperationalLimitsGroup2;
99+
94100
@JsonInclude(Include.NON_NULL)
95-
private String selectedOperationalLimitsGroup2;
101+
private String selectedOperationalLimitsGroup2Name;
96102

97103
@JsonInclude(Include.NON_ABSENT)
98104
private Optional<BranchObservabilityInfos> branchObservability;

0 commit comments

Comments
 (0)