-
Notifications
You must be signed in to change notification settings - Fork 2
implement computation result filters uuid #884
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
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
96aa117
implement computation result filters uuid
ghazwarhili da16f38
clean code
ghazwarhili c2c5efd
merge main into branch
ghazwarhili beb30da
resolve conflicts
ghazwarhili fb3ecee
add TU
ghazwarhili 1865754
Merge branch 'main' into implement-computation-result-filters-uuid
ghazwarhili 1cc78e2
add TU
ghazwarhili 87532f1
code review remarks
ghazwarhili d0de69b
Merge branch 'main' into implement-computation-result-filters-uuid
ghazwarhili d119f17
use WireMock for TU
ghazwarhili df1bdc5
unused import
ghazwarhili f7fd1be
fix TU
ghazwarhili 73d3e41
fix to send computationType and computationSubType
ghazwarhili 79d4156
use only computationSubType
ghazwarhili 8a79ec3
update ComputationResultFiltersController
ghazwarhili 4806432
resolve conflicts
ghazwarhili 0b12f16
clean code
ghazwarhili c8b6328
Merge branch 'main' into implement-computation-result-filters-uuid
Meklo bce1a37
update controller computation result filters
ghazwarhili ad57b14
Merge remote-tracking branch 'origin/implement-computation-result-fil…
ghazwarhili 059e7d2
resolve conflicts
ghazwarhili 8cd1419
fix checkstyle
ghazwarhili 81a7076
resolve conflicts
ghazwarhili ff14529
update endpoint
ghazwarhili f2167e5
Merge branch 'main' into implement-computation-result-filters-uuid
ghazwarhili 9acb6f5
enhance coverage code
ghazwarhili f048f19
refacto TU
ghazwarhili c73f48f
Merge branch 'main' into implement-computation-result-filters-uuid
ghazwarhili 381bf77
code review remarks
ghazwarhili 20df8b0
Merge remote-tracking branch 'origin/implement-computation-result-fil…
ghazwarhili d74cad8
rename to omputationResultsFiltersId
ghazwarhili 7f7f670
Merge branch 'main' into implement-computation-result-filters-uuid
ghazwarhili File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
src/main/java/org/gridsuite/study/server/controller/ComputationResultFiltersController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /* | ||
| * Copyright (c) 2025, RTE (http://www.rte-france.com) | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| */ | ||
| package org.gridsuite.study.server.controller; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import jakarta.validation.Valid; | ||
| import org.gridsuite.study.server.StudyApi; | ||
| import org.gridsuite.study.server.service.StudyService; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
| /** | ||
| * @author Rehili Ghazwa <ghazwa.rehili at rte-france.com> | ||
| */ | ||
|
|
||
| @RestController | ||
| @RequestMapping(value = "/" + StudyApi.API_VERSION + "/studies/{studyUuid}/computation-result-filters") | ||
| @Tag(name = "Study server - Computation result filters") | ||
| public class ComputationResultFiltersController { | ||
| private final StudyService studyService; | ||
|
|
||
| public ComputationResultFiltersController(StudyService studyService) { | ||
| this.studyService = studyService; | ||
| } | ||
|
|
||
| @GetMapping("/{computationType}") | ||
| @Operation(summary = "Get study's computation result global filters") | ||
| @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The computation result global filters")}) | ||
| public ResponseEntity<String> getComputationResultGlobalFilters( | ||
| @PathVariable("studyUuid") UUID studyUuid, | ||
| @PathVariable("computationType") String computationType) { | ||
| return Optional.ofNullable(studyService.getComputationResultGlobalFilters(studyUuid, computationType)) | ||
| .map(ResponseEntity::ok) | ||
| .orElseGet(() -> ResponseEntity.noContent().build()); | ||
| } | ||
|
|
||
| @GetMapping("/{computationType}/{computationSubType}") | ||
| @Operation(summary = "Get study's computation result column filters") | ||
| @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The computation result column filters")}) | ||
| public ResponseEntity<String> getComputationResultColumnFilters( | ||
| @PathVariable("studyUuid") UUID studyUuid, | ||
| @PathVariable("computationType") String computationType, | ||
| @PathVariable("computationSubType") String computationSubType) { | ||
| return Optional.ofNullable(studyService.getComputationResultColumnFilters(studyUuid, computationType, computationSubType)) | ||
| .map(ResponseEntity::ok) | ||
| .orElseGet(() -> ResponseEntity.noContent().build()); | ||
| } | ||
|
|
||
| @PostMapping("/{computationType}/global-filters") | ||
| @Operation(summary = "Set global filters", | ||
| description = "Replaces all existing global filters with the provided list for a computation result") | ||
| @ApiResponse(responseCode = "204", description = "Global filters set successfully") | ||
| @ApiResponse(responseCode = "404", description = "computation result global filters not found") | ||
| public ResponseEntity<Void> setGlobalFiltersForComputationResult( | ||
| @PathVariable("studyUuid") UUID studyUuid, | ||
| @PathVariable String computationType, | ||
| @RequestBody String globalFilters) { | ||
| studyService.setGlobalFiltersForComputationResult(studyUuid, computationType, globalFilters); | ||
| return ResponseEntity.noContent().build(); | ||
| } | ||
|
|
||
| @PutMapping("/{computationType}/{computationSubType}/columns") | ||
| @Operation(summary = "Update a column", description = "Updates a column") | ||
| @ApiResponse(responseCode = "204", description = "Column updated") | ||
| public ResponseEntity<Void> updateColumns( | ||
| @PathVariable("studyUuid") UUID studyUuid, | ||
| @PathVariable String computationType, | ||
| @PathVariable String computationSubType, | ||
| @Valid @RequestBody String columnInfos) { | ||
| studyService.updateColumns(studyUuid, computationType, computationSubType, columnInfos); | ||
| return ResponseEntity.noContent().build(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/resources/db/changelog/changesets/changelog_20251117T095627Z.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.1" encoding="UTF-8" standalone="no"?> | ||
| <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> | ||
| <changeSet author="rehiligha (generated)" id="1763373405443-18"> | ||
| <addColumn tableName="study"> | ||
| <column name="computation_result_filters_uuid" type="uuid"/> | ||
| </addColumn> | ||
| </changeSet> | ||
| </databaseChangeLog> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.