-
Notifications
You must be signed in to change notification settings - Fork 2
Moving Dynamic Simulation params to dynamic-simulation-server #969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4dc8419
897204b
c9c5686
b7aa47b
b574144
1f0df04
cc6f307
2cac2a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,6 @@ | |
| import org.gridsuite.study.server.dto.dynamicmapping.ModelInfos; | ||
| import org.gridsuite.study.server.dto.dynamicmargincalculation.DynamicMarginCalculationStatus; | ||
| import org.gridsuite.study.server.dto.dynamicsecurityanalysis.DynamicSecurityAnalysisStatus; | ||
| import org.gridsuite.study.server.dto.dynamicsimulation.DynamicSimulationParametersInfos; | ||
| import org.gridsuite.study.server.dto.dynamicsimulation.DynamicSimulationStatus; | ||
| import org.gridsuite.study.server.dto.dynamicsimulation.event.EventInfos; | ||
| import org.gridsuite.study.server.dto.elasticsearch.EquipmentInfos; | ||
|
|
@@ -1836,8 +1835,10 @@ | |
| @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "All models of dynamic simulation"), | ||
| @ApiResponse(responseCode = "204", description = "No dynamic simulation models"), | ||
| @ApiResponse(responseCode = "404", description = "The dynamic simulation models has not been found")}) | ||
| public ResponseEntity<List<ModelInfos>> getDynamicSimulationModels(@Parameter(description = "study UUID") @PathVariable("studyUuid") UUID studyUuid) { | ||
| List<ModelInfos> models = studyService.getDynamicSimulationModels(studyUuid); | ||
| public ResponseEntity<List<ModelInfos>> getDynamicSimulationModels( | ||
| @Parameter(description = "study UUID") @PathVariable("studyUuid") UUID studyUuid, | ||
| @Parameter(description = "mapping") @RequestParam(name = "mapping", required = false) String mapping) { | ||
| List<ModelInfos> models = studyService.getDynamicSimulationModels(studyUuid, mapping); | ||
| return models != null ? ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(models) : | ||
| ResponseEntity.noContent().build(); | ||
| } | ||
|
|
@@ -1847,7 +1848,7 @@ | |
| @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The dynamic simulation parameters are set")}) | ||
| public ResponseEntity<Void> setDynamicSimulationParameters( | ||
| @PathVariable("studyUuid") UUID studyUuid, | ||
| @RequestBody(required = false) DynamicSimulationParametersInfos dsParameter, | ||
| @RequestBody(required = false) String dsParameter, | ||
| @RequestHeader(HEADER_USER_ID) String userId) { | ||
| studyService.setDynamicSimulationParameters(studyUuid, dsParameter, userId); | ||
| return ResponseEntity.ok().build(); | ||
|
Comment on lines
1849
to
1854
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Dynamic simulation parameter setter declarations/usages:"
rg -n -C2 '\bsetDynamicSimulationParameters\s*\(' --type java
echo
echo "Existing controller branches that map service results to HTTP 200/204:"
rg -n -C2 'ResponseEntity\.noContent\(\)\.build\(\)' src/main/java/org/gridsuite/study/server/controller/StudyController.javaRepository: gridsuite/study-server Length of output: 15539 Fix inconsistent response codes for The service method returns a Affected pattern in other setters// Line 980 (setVoltageInitParameters)
return studyService.setVoltageInitParameters(studyUuid, voltageInitParameters, userId) ? ResponseEntity.noContent().build() : ResponseEntity.ok().build();
// Line 1128 (setLoadFlowParameters)
return studyService.setLoadFlowParameters(studyUuid, lfParameter, userId) ? ResponseEntity.noContent().build() : ResponseEntity.ok().build();
// Line 2009-2011 (setDynamicSecurityAnalysisParameters)
return studyService.setDynamicSecurityAnalysisParameters(studyUuid, dsaParameter, userId) ?
ResponseEntity.noContent().build() :
ResponseEntity.ok().build();🤖 Prompt for AI Agents
khouadrired marked this conversation as resolved.
|
||
|
|
@@ -1856,7 +1857,7 @@ | |
| @GetMapping(value = "/studies/{studyUuid}/dynamic-simulation/parameters") | ||
| @Operation(summary = "Get dynamic simulation parameters on study") | ||
| @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The dynamic simulation parameters")}) | ||
| public ResponseEntity<DynamicSimulationParametersInfos> getDynamicSimulationParameters( | ||
| public ResponseEntity<String> getDynamicSimulationParameters( | ||
|
khouadrired marked this conversation as resolved.
|
||
| @PathVariable("studyUuid") UUID studyUuid) { | ||
| return ResponseEntity.ok().body(studyService.getDynamicSimulationParameters(studyUuid)); | ||
|
Comment on lines
1857
to
1862
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the parameter GET response explicitly JSON. Once this endpoint returns a raw 💡 Suggested fix- `@GetMapping`(value = "/studies/{studyUuid}/dynamic-simulation/parameters")
+ `@GetMapping`(value = "/studies/{studyUuid}/dynamic-simulation/parameters", produces = MediaType.APPLICATION_JSON_VALUE)
`@Operation`(summary = "Get dynamic simulation parameters on study")
`@ApiResponses`(value = {`@ApiResponse`(responseCode = "200", description = "The dynamic simulation parameters")})
public ResponseEntity<String> getDynamicSimulationParameters(
`@PathVariable`("studyUuid") UUID studyUuid) {
- return ResponseEntity.ok().body(studyService.getDynamicSimulationParameters(studyUuid));
+ return ResponseEntity.ok()
+ .contentType(MediaType.APPLICATION_JSON)
+ .body(studyService.getDynamicSimulationParameters(studyUuid));
}🤖 Prompt for AI Agents |
||
| } | ||
|
|
@@ -1934,11 +1935,10 @@ | |
| @Parameter(description = "rootNetworkUuid") @PathVariable("rootNetworkUuid") UUID rootNetworkUuid, | ||
| @Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid, | ||
| @Parameter(description = "debug") @RequestParam(name = "debug", required = false, defaultValue = "false") boolean debug, | ||
| @RequestBody(required = false) DynamicSimulationParametersInfos parameters, | ||
| @RequestHeader(HEADER_USER_ID) String userId) { | ||
| studyService.assertIsNodeNotReadOnly(nodeUuid); | ||
| studyService.assertCanRunOnConstructionNode(studyUuid, nodeUuid, List.of(DYNAWO_PROVIDER), studyService::getDynamicSimulationProvider); | ||
| studyService.runDynamicSimulation(studyUuid, nodeUuid, rootNetworkUuid, parameters, userId, debug); | ||
| studyService.runDynamicSimulation(studyUuid, nodeUuid, rootNetworkUuid, userId, debug); | ||
| return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).build(); | ||
| } | ||
|
|
||
|
|
@@ -2079,7 +2079,7 @@ | |
| @Parameter(description = "root network id") @PathVariable("rootNetworkUuid") UUID rootNetworkUuid, | ||
| @Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid, | ||
| @Parameter(description = "debug") @RequestParam(name = "debug", required = false, defaultValue = "false") boolean debug, | ||
| @RequestHeader(HEADER_USER_ID) String userId) throws JsonProcessingException { | ||
|
Check warning on line 2082 in src/main/java/org/gridsuite/study/server/controller/StudyController.java
|
||
| studyService.assertIsNodeNotReadOnly(nodeUuid); | ||
| studyService.assertCanRunOnConstructionNode(studyUuid, nodeUuid, List.of(DYNAWO_PROVIDER), studyService::getDynamicMarginCalculationProvider); | ||
| studyService.runDynamicMarginCalculation(studyUuid, nodeUuid, rootNetworkUuid, userId, debug); | ||
|
|
||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.