Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into create-new-modificati…
Browse files Browse the repository at this point in the history
…on-element

# Conflicts:
#	src/main/resources/application-local.yml
  • Loading branch information
dbraquart committed Feb 13, 2024
2 parents c6f3487 + a90530e commit d63481e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</developers>

<properties>
<gridsuite-dependencies.version>28</gridsuite-dependencies.version>
<powsybl-ws-dependencies.version>2.7.0</powsybl-ws-dependencies.version>
</properties>

<build>
Expand Down Expand Up @@ -83,9 +83,9 @@
<dependencies>
<!-- imports -->
<dependency>
<groupId>org.gridsuite</groupId>
<artifactId>gridsuite-dependencies</artifactId>
<version>${gridsuite-dependencies.version}</version>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-ws-dependencies</artifactId>
<version>${powsybl-ws-dependencies.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public DirectoryService(
DIRECTORY, this,
MODIFICATION, networkModificationService,
CASE, caseService,
ParametersType.VOLTAGE_INIT_PARAMETERS.name(), parametersService);
ParametersType.VOLTAGE_INIT_PARAMETERS.name(), parametersService,
ParametersType.SECURITY_ANALYSIS_PARAMETERS.name(), parametersService);
}

public void setDirectoryServerBaseUri(String directoryServerBaseUri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ParametersService implements IDirectoryElementsService {

private DirectoryService directoryService;

private final Map<ParametersType, String> genericParametersServices = Map.of(ParametersType.VOLTAGE_INIT_PARAMETERS, "voltage-init-server");
private final Map<ParametersType, String> genericParametersServices = Map.of(ParametersType.VOLTAGE_INIT_PARAMETERS, "voltage-init-server", ParametersType.SECURITY_ANALYSIS_PARAMETERS, "security-analysis-server");

private RemoteServicesProperties remoteServicesProperties;

Expand Down Expand Up @@ -86,12 +86,11 @@ public void updateParameters(UUID parametersUuid, String parameters, ParametersT
public UUID createParameters(UUID sourceParametersUuid, ParametersType parametersType) {
String parametersServerBaseUri = remoteServicesProperties.getServiceUri(genericParametersServices.get(parametersType));
Objects.requireNonNull(sourceParametersUuid);

String urlParams = parametersType == ParametersType.VOLTAGE_INIT_PARAMETERS ? "?" + HEADER_DUPLICATE_FROM + "=" + sourceParametersUuid : "/" + sourceParametersUuid;
var path = UriComponentsBuilder
.fromPath(DELIMITER + SERVER_API_VERSION + "/parameters")
.queryParam(HEADER_DUPLICATE_FROM, sourceParametersUuid)
.toUriString();

.fromPath(DELIMITER + SERVER_API_VERSION + "/parameters" + urlParams)
.buildAndExpand()
.toUriString();
HttpHeaders headers = new HttpHeaders();
HttpEntity<String> httpEntity = new HttpEntity<>(headers);
return restTemplate.exchange(parametersServerBaseUri + path, HttpMethod.POST, httpEntity, UUID.class).getBody();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
public enum ParametersType {

VOLTAGE_INIT_PARAMETERS,
SECURITY_ANALYSIS_PARAMETERS

}
3 changes: 3 additions & 0 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ gridsuite:
-
name: voltage-init-server
base-uri: http://localhost:5038
-
name: security-analysis-server
base-uri: http://localhost:5023

0 comments on commit d63481e

Please sign in to comment.