Skip to content

Commit 888a429

Browse files
committed
Merge remote-tracking branch 'origin/main' into spreadsheet/persist-column-visibility
# Conflicts: # src/main/resources/db/changelog/db.changelog-master.yaml # src/test/java/org/gridsuite/studyconfig/server/DtoConverterTest.java
2 parents 029b3ee + a781dd1 commit 888a429

File tree

8 files changed

+44
-23
lines changed

8 files changed

+44
-23
lines changed

src/main/java/org/gridsuite/studyconfig/server/dto/GlobalFilterInfos.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88

99
import io.swagger.v3.oas.annotations.media.Schema;
1010
import jakarta.validation.constraints.NotNull;
11+
import lombok.Builder;
1112

1213
import java.util.UUID;
1314

1415
/**
1516
* @author Achour BERRAHMA <achour.berrahma at rte-france.com>
1617
*/
18+
@Builder
1719
@Schema(name = "GlobalFilterDto", description = "Global filter configuration")
1820
public record GlobalFilterInfos(
1921

@@ -27,6 +29,9 @@ public record GlobalFilterInfos(
2729
@Schema(description = "Filter type")
2830
String filterType,
2931

32+
@Schema(description = "Filter subtype")
33+
String filterSubtype,
34+
3035
@NotNull(message = "Filter label is mandatory")
3136
@Schema(description = "Filter label")
3237
String label,

src/main/java/org/gridsuite/studyconfig/server/entities/GlobalFilterEntity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public class GlobalFilterEntity {
3131
@Column(name = "filter_type", nullable = false)
3232
private String filterType;
3333

34+
@Column(name = "filter_subtype")
35+
private String filterSubtype;
36+
3437
@Column(name = "label", nullable = false)
3538
private String label;
3639

src/main/java/org/gridsuite/studyconfig/server/mapper/SpreadsheetConfigMapper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public static GlobalFilterInfos toGlobalFilterDto(GlobalFilterEntity entity) {
9999
entity.getId(),
100100
entity.getUuid(),
101101
entity.getFilterType(),
102+
entity.getFilterSubtype(),
102103
entity.getLabel(),
103104
entity.isRecent(),
104105
entity.getEquipmentType(),
@@ -109,6 +110,7 @@ public static GlobalFilterInfos toGlobalFilterDto(GlobalFilterEntity entity) {
109110
public static GlobalFilterEntity toGlobalFilterEntity(GlobalFilterInfos dto) {
110111
return GlobalFilterEntity.builder()
111112
.filterType(dto.filterType())
113+
.filterSubtype(dto.filterSubtype())
112114
.uuid(dto.uuid())
113115
.label(dto.label())
114116
.recent(dto.recent())
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
2+
<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">
3+
<changeSet author="marcelinhug (generated)" id="1749048080912-4">
4+
<addColumn tableName="spreadsheet_global_filter">
5+
<column name="filter_subtype" type="varchar(255)"/>
6+
</addColumn>
7+
</changeSet>
8+
</databaseChangeLog>

src/main/resources/db/changelog/db.changelog-master.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ databaseChangeLog:
4747
- include:
4848
file: changesets/changelog_20250519T134047Z.xml
4949
relativeToChangelogFile: true
50+
- include:
51+
file: changesets/changelog_20250604T144112Z.xml
52+
relativeToChangelogFile: true
5053
- include:
5154
file: changesets/changelog_20250606T123216Z.xml
5255
relativeToChangelogFile: true

src/test/java/org/gridsuite/studyconfig/server/DtoConverterTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ void testConversionToDtoOfSpreadsheetConfig() {
5151
))
5252
.globalFilters(Arrays.asList(
5353
GlobalFilterEntity.builder()
54-
.uuid(UUID.randomUUID())
55-
.label("GlobalFilter1")
56-
.build(),
54+
.id(UUID.randomUUID())
55+
.label("GlobalFilter1")
56+
.build(),
5757
GlobalFilterEntity.builder()
58-
.uuid(UUID.randomUUID())
59-
.label("GlobalFilter2")
60-
.build()
58+
.id(UUID.randomUUID())
59+
.label("GlobalFilter2")
60+
.build()
6161
))
6262
.build();
6363

@@ -88,10 +88,10 @@ void testConversionToDtoOfSpreadsheetConfig() {
8888

8989
// Global filters assertions
9090
assertThat(d.globalFilters()).hasSize(2);
91-
assertThat(d.globalFilters().get(0).uuid()).isNotNull();
91+
assertThat(d.globalFilters().get(0).id()).isNotNull();
9292
assertThat(d.globalFilters().get(0).label()).isEqualTo("GlobalFilter1");
9393

94-
assertThat(d.globalFilters().get(1).uuid()).isNotNull();
94+
assertThat(d.globalFilters().get(1).id()).isNotNull();
9595
assertThat(d.globalFilters().get(1).label()).isEqualTo("GlobalFilter2");
9696
});
9797
}
@@ -111,7 +111,7 @@ void testConversionToEntityOfSpreadsheetConfig() {
111111
null, null, null, null, true)
112112
),
113113
List.of(
114-
new GlobalFilterInfos(null, filterId, "country", "GlobalFilter1", false, null, null)
114+
GlobalFilterInfos.builder().uuid(filterId).filterType("country").label("GlobalFilter1").recent(false).build()
115115
)
116116
);
117117

@@ -269,7 +269,7 @@ void testConversionToDtoOfGlobalFilter() {
269269
void testConversionToEntityOfGlobalFilter() {
270270
UUID uuid = UUID.randomUUID();
271271
UUID filterId = UUID.randomUUID();
272-
GlobalFilterInfos dto = new GlobalFilterInfos(uuid, filterId, "country", "TestGlobalFilter", false, null, null);
272+
GlobalFilterInfos dto = GlobalFilterInfos.builder().id(uuid).uuid(filterId).filterType("country").label("TestGlobalFilter").recent(false).build();
273273

274274
GlobalFilterEntity entity = SpreadsheetConfigMapper.toGlobalFilterEntity(dto);
275275

src/test/java/org/gridsuite/studyconfig/server/SpreadsheetConfigCollectionIntegrationTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ private List<SpreadsheetConfigInfos> createSpreadsheetConfigsWithFilters() {
425425
);
426426

427427
List<GlobalFilterInfos> globalFiltersConfig1 = Arrays.asList(
428-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Global Filter 1", false, null, null),
429-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Global Filter 2", false, null, null)
428+
GlobalFilterInfos.builder().uuid(UUID.randomUUID()).filterType("country").label("Global Filter 1").recent(false).build(),
429+
GlobalFilterInfos.builder().uuid(UUID.randomUUID()).filterType("country").label("Global Filter 2").recent(false).build()
430430
);
431431

432432
List<ColumnInfos> columnsConfig2 = Arrays.asList(
@@ -439,7 +439,7 @@ private List<SpreadsheetConfigInfos> createSpreadsheetConfigsWithFilters() {
439439
);
440440

441441
List<GlobalFilterInfos> globalFiltersConfig2 = List.of(
442-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Another Global Filter", false, null, null)
442+
GlobalFilterInfos.builder().uuid(UUID.randomUUID()).filterType("country").label("Another Global Filter").recent(false).build()
443443
);
444444

445445
return List.of(
@@ -472,9 +472,9 @@ private List<SpreadsheetConfigInfos> createUpdatedSpreadsheetConfigsWithFilters(
472472
);
473473

474474
List<GlobalFilterInfos> globalFiltersConfig1 = Arrays.asList(
475-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Updated Filter 1", false, null, null),
476-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Updated Filter 2", false, null, null),
477-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Updated Filter 3", false, null, null)
475+
GlobalFilterInfos.builder().uuid(UUID.randomUUID()).filterType("country").label("Updated Filter 1").recent(false).build(),
476+
GlobalFilterInfos.builder().uuid(UUID.randomUUID()).filterType("country").label("Updated Filter 2").recent(false).build(),
477+
GlobalFilterInfos.builder().uuid(UUID.randomUUID()).filterType("country").label("Updated Filter 3").recent(false).build()
478478
);
479479

480480
List<ColumnInfos> columnsConfig2 = Arrays.asList(
@@ -485,7 +485,7 @@ private List<SpreadsheetConfigInfos> createUpdatedSpreadsheetConfigsWithFilters(
485485
);
486486

487487
List<GlobalFilterInfos> globalFiltersConfig2 = List.of(
488-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Updated Other Filter", false, null, null)
488+
GlobalFilterInfos.builder().uuid(UUID.randomUUID()).filterType("country").label("Updated Other Filter").recent(false).build()
489489
);
490490

491491
List<ColumnInfos> columnsConfig3 = Arrays.asList(
@@ -496,7 +496,7 @@ private List<SpreadsheetConfigInfos> createUpdatedSpreadsheetConfigsWithFilters(
496496
);
497497

498498
List<GlobalFilterInfos> globalFiltersConfig3 = List.of(
499-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Third Config Filter", false, null, null)
499+
GlobalFilterInfos.builder().uuid(UUID.randomUUID()).filterType("country").label("Third Config Filter").recent(false).build()
500500
);
501501

502502
return List.of(

src/test/java/org/gridsuite/studyconfig/server/SpreadsheetConfigIntegrationTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ void testSetGlobalFiltersForSpreadsheetConfig() throws Exception {
492492

493493
// Create new filters to set
494494
List<GlobalFilterInfos> filtersToSet = List.of(
495-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Replacement Filter", false, null, null)
495+
GlobalFilterInfos.builder().id(UUID.randomUUID()).filterType("country").label("Replacement Filter").recent(false).build()
496496
);
497497

498498
// Call the endpoint to set the filters
@@ -513,7 +513,7 @@ void testSetGlobalFiltersForSpreadsheetConfig() throws Exception {
513513
void testSetGlobalFiltersToNonExistentConfig() throws Exception {
514514
UUID nonExistentConfigId = UUID.randomUUID();
515515
List<GlobalFilterInfos> filtersToAdd = List.of(
516-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Test Filter", false, null, null)
516+
GlobalFilterInfos.builder().id(UUID.randomUUID()).filterType("country").label("Test Filter").recent(false).build()
517517
);
518518

519519
mockMvc.perform(post(URI_SPREADSHEET_CONFIG_GET_PUT + nonExistentConfigId + "/global-filters")
@@ -565,14 +565,14 @@ private List<ColumnInfos> createUpdatedColumnsWithFilters() {
565565

566566
private List<GlobalFilterInfos> createGlobalFilters() {
567567
return Arrays.asList(
568-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Global Filter 1", false, null, null),
569-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Global Filter 2", false, null, null)
568+
GlobalFilterInfos.builder().id(UUID.randomUUID()).filterType("country").label("Global Filter 1").recent(false).build(),
569+
GlobalFilterInfos.builder().id(UUID.randomUUID()).filterType("country").label("Global Filter 2").recent(false).build()
570570
);
571571
}
572572

573573
private List<GlobalFilterInfos> createUpdatedGlobalFilters() {
574574
return List.of(
575-
new GlobalFilterInfos(null, UUID.randomUUID(), "country", "Updated Global Filter", false, null, null)
575+
GlobalFilterInfos.builder().id(UUID.randomUUID()).filterType("country").label("Updated Global Filter").recent(false).build()
576576
);
577577
}
578578

0 commit comments

Comments
 (0)