-
Notifications
You must be signed in to change notification settings - Fork 0
persist computation result filters #97
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
ghazwarhili
merged 25 commits into
main
from
persist-computation-result-global-column-filters
Feb 6, 2026
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
dc88850
persist computation result filters
ghazwarhili ce26203
refacto column entity
ghazwarhili e3b2318
refacto to column filter entity
ghazwarhili 2530469
Merge branch 'main' into persist-computation-result-global-column-fil…
ghazwarhili 1fb33f7
add TU
ghazwarhili a06a86f
some fix
ghazwarhili f8b91f5
some fix
ghazwarhili b12a1e0
update TU
ghazwarhili c0da42d
unused functions
ghazwarhili cd19324
fix TU
ghazwarhili 460d3fa
add sql file data migration
ghazwarhili a1f9136
fix sql script
ghazwarhili 5699270
formatted file
ghazwarhili 7cf28fc
code review remarks
ghazwarhili 4531f52
revert
ghazwarhili 4340731
code review remarks
ghazwarhili bc2aa72
rename to computationResultFiltersId
ghazwarhili 64a8651
rename to computationResultsFiltersId
ghazwarhili 2f4d5df
Merge branch 'main' into persist-computation-result-global-column-fil…
ghazwarhili 805a0af
code review remarks
ghazwarhili cb1606e
Merge branch 'persist-computation-result-global-column-filters' of ht…
ghazwarhili 300546b
add idx_computation_result_filters_id
ghazwarhili 8def8ad
add delete column case
ghazwarhili fa3eced
code review remarks
ghazwarhili 972b4a5
rename parameter
etiennehomer 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
95 changes: 95 additions & 0 deletions
95
.../java/org/gridsuite/studyconfig/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,95 @@ | ||
| /** | ||
| * 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.studyconfig.server.controller; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.Parameter; | ||
| import io.swagger.v3.oas.annotations.media.Content; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
| import jakarta.validation.Valid; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.gridsuite.studyconfig.server.StudyConfigApi; | ||
| import org.gridsuite.studyconfig.server.dto.*; | ||
| import org.gridsuite.studyconfig.server.dto.ComputationResultColumnFilterInfos; | ||
| import org.gridsuite.studyconfig.server.service.ComputationResultFiltersService; | ||
| import org.springframework.http.HttpStatus; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| import java.util.List; | ||
| import java.util.UUID; | ||
|
|
||
| /** | ||
| * @author Rehili Ghazwa <ghazwa.rehili at rte-france.com> | ||
| */ | ||
| @RestController | ||
| @RequestMapping(value = "/" + StudyConfigApi.API_VERSION + "/computation-result-filters") | ||
| @RequiredArgsConstructor | ||
| public class ComputationResultFiltersController { | ||
| private final ComputationResultFiltersService computationGlobalFiltersService; | ||
|
|
||
| @PostMapping(value = "/default") | ||
| @Operation(summary = "Create a default computation result filters", | ||
| description = "Creates a default computation result filters") | ||
| @ApiResponse(responseCode = "201", description = "Default computation result filters created", | ||
| content = @Content(schema = @Schema(implementation = UUID.class))) | ||
| public ResponseEntity<UUID> createDefaultComputationResultFilters() { | ||
| UUID id = computationGlobalFiltersService.createDefaultComputingResultFilters(); | ||
| return ResponseEntity.status(HttpStatus.CREATED).body(id); | ||
| } | ||
|
|
||
| @GetMapping("/{computationResultFiltersId}/{computationType}") | ||
| @Operation(summary = "Get a computation result global filters", | ||
| description = "Fetches the computation result global filters for a given computation type") | ||
| @ApiResponse(responseCode = "200", description = "Computation result global filters found", | ||
| content = @Content(schema = @Schema(implementation = GlobalFilterInfos.class))) | ||
| @ApiResponse(responseCode = "404", description = "Computation result global filters not found") | ||
| public ResponseEntity<List<GlobalFilterInfos>> getComputingResultGlobalFilters( | ||
| @Parameter(description = "Computation result filters Id") @PathVariable UUID computationResultFiltersId, | ||
| @Parameter(description = "Computation type") @PathVariable String computationType) { | ||
| return ResponseEntity.ok(computationGlobalFiltersService.getComputingResultGlobalFilters(computationResultFiltersId, computationType)); | ||
| } | ||
|
|
||
| @GetMapping("/{computationResultFiltersId}/{computationType}/{computationSubType}") | ||
| @Operation(summary = "Get a computation result column filters", | ||
| description = "Fetches the computation result column filters for a given computation type and subtype") | ||
| @ApiResponse(responseCode = "200", description = "Computation result column filters found", | ||
| content = @Content(schema = @Schema(implementation = ComputationResultColumnFilterInfos.class))) | ||
| @ApiResponse(responseCode = "404", description = "Computation result column filters not found") | ||
| public ResponseEntity<List<ComputationResultColumnFilterInfos>> getComputingResultColumnFilters( | ||
| @Parameter(description = "Computation result filters Id") @PathVariable UUID computationResultFiltersId, | ||
| @Parameter(description = "Computation type") @PathVariable String computationType, | ||
| @Parameter(description = "Computation subtype") @PathVariable String computationSubType) { | ||
| return ResponseEntity.ok(computationGlobalFiltersService.getComputingResultColumnFilters(computationResultFiltersId, computationType, computationSubType)); | ||
| } | ||
|
|
||
| @PostMapping("/{computationResultFiltersId}/{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 filters not found") | ||
| public ResponseEntity<Void> setGlobalFiltersForComputingResult( | ||
| @PathVariable UUID computationResultFiltersId, | ||
| @PathVariable String computationType, | ||
| @Valid @RequestBody List<GlobalFilterInfos> filters) { | ||
| computationGlobalFiltersService.setGlobalFiltersForComputationResult(computationResultFiltersId, computationType, filters); | ||
| return ResponseEntity.noContent().build(); | ||
| } | ||
|
|
||
| @PutMapping("/{computationResultFiltersId}/{computationType}/{computationSubType}/columns") | ||
| @Operation(summary = "Update a column", description = "Updates an existing column") | ||
| @ApiResponse(responseCode = "204", description = "Column updated") | ||
| public ResponseEntity<Void> updateColumn( | ||
| @PathVariable UUID computationResultFiltersId, | ||
| @PathVariable String computationType, | ||
| @PathVariable String computationSubType, | ||
| @Valid @RequestBody ComputationResultColumnFilterInfos dto) { | ||
| computationGlobalFiltersService.updateColumn(computationResultFiltersId, computationType, computationSubType, dto); | ||
| 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
27 changes: 27 additions & 0 deletions
27
src/main/java/org/gridsuite/studyconfig/server/dto/ColumnFilterInfos.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,27 @@ | ||
| /** | ||
| * 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.studyconfig.server.dto; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| /** | ||
| * @author Rehili Ghazwa <ghazwa.rehili at rte-france.com> | ||
| */ | ||
| @Schema(name = "ColumnFilterInfos", description = "Column filter infos") | ||
| public record ColumnFilterInfos( | ||
| @Schema(description = "Filter data type") | ||
| String filterDataType, | ||
|
|
||
| @Schema(description = "Filter type") | ||
| String filterType, | ||
|
|
||
| @Schema(description = "Filter value") | ||
| String filterValue, | ||
|
|
||
| @Schema(description = "Filter tolerance for numeric comparisons") | ||
| Double filterTolerance | ||
| ) { } |
22 changes: 22 additions & 0 deletions
22
src/main/java/org/gridsuite/studyconfig/server/dto/ComputationResultColumnFilterInfos.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,22 @@ | ||
| /** | ||
| * 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.studyconfig.server.dto; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| /** | ||
| * @author Rehili Ghazwa <ghazwa.rehili at rte-france.com> | ||
| */ | ||
| @Schema(name = "ComputationResultColumnFilterInfos", description = "Computation Result Column filter infos") | ||
| public record ComputationResultColumnFilterInfos( | ||
|
|
||
| @Schema(description = "Column id") | ||
| String columnId, | ||
|
|
||
| @Schema(description = "column filter infos") | ||
| ColumnFilterInfos columnFilterInfos | ||
| ) { } |
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
58 changes: 58 additions & 0 deletions
58
src/main/java/org/gridsuite/studyconfig/server/entities/ColumnFilterEntity.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,58 @@ | ||
| /** | ||
| * 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.studyconfig.server.entities; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.*; | ||
|
|
||
| import java.util.UUID; | ||
|
|
||
| /** | ||
| * @author Rehili Ghazwa <ghazwa.rehili at rte-france.com> | ||
| */ | ||
| @Entity | ||
| @Table(name = "column_filter") | ||
| @Getter | ||
| @Setter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| @Builder(toBuilder = true) | ||
| public class ColumnFilterEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.AUTO) | ||
| @Column(name = "uuid") | ||
| private UUID uuid; | ||
|
|
||
| @Column(name = "filter_data_type", columnDefinition = "varchar(255)") | ||
| private String filterDataType; | ||
|
|
||
| @Column(name = "filter_type", columnDefinition = "varchar(255)") | ||
| private String filterType; | ||
|
|
||
| @Column(name = "filter_value", columnDefinition = "CLOB") | ||
| private String filterValue; | ||
|
|
||
| @Column(name = "filter_tolerance") | ||
| private Double filterTolerance; | ||
|
|
||
| public void resetFilter() { | ||
| this.filterDataType = null; | ||
| this.filterType = null; | ||
| this.filterTolerance = null; | ||
| this.filterValue = null; | ||
| } | ||
|
|
||
| public ColumnFilterEntity copy() { | ||
| return ColumnFilterEntity.builder() | ||
| .filterDataType(this.getFilterDataType()) | ||
| .filterType(this.getFilterType()) | ||
| .filterValue(this.getFilterValue()) | ||
| .filterTolerance(this.getFilterTolerance()) | ||
| .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
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.