Skip to content

Commit e30f074

Browse files
authored
Merge branch 'main' into spreadsheet/persist-column-visibility
2 parents 497666b + ff2d4e1 commit e30f074

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
package org.gridsuite.studyconfig.server.dto;
88

9+
import com.fasterxml.jackson.annotation.JsonInclude;
910
import io.swagger.v3.oas.annotations.media.Schema;
1011
import jakarta.validation.constraints.NotNull;
1112
import lombok.Builder;
@@ -19,16 +20,19 @@
1920
@Schema(name = "GlobalFilterDto", description = "Global filter configuration")
2021
public record GlobalFilterInfos(
2122

23+
@JsonInclude(JsonInclude.Include.NON_NULL)
2224
@Schema(description = "Global filter UUID")
2325
UUID id,
2426

27+
@JsonInclude(JsonInclude.Include.NON_NULL)
2528
@Schema(description = "Generic filter ID")
2629
UUID uuid,
2730

2831
@NotNull(message = "Filter type is mandatory")
2932
@Schema(description = "Filter type")
3033
String filterType,
3134

35+
@JsonInclude(JsonInclude.Include.NON_NULL)
3236
@Schema(description = "Filter subtype")
3337
String filterSubtype,
3438

@@ -39,9 +43,11 @@ public record GlobalFilterInfos(
3943
@Schema(description = "Was filter recently applied")
4044
boolean recent,
4145

46+
@JsonInclude(JsonInclude.Include.NON_NULL)
4247
@Schema(description = "Generic filter related equipment type")
4348
String equipmentType,
4449

50+
@JsonInclude(JsonInclude.Include.NON_NULL)
4551
@Schema(description = "Generic filter path")
4652
String path
4753

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,16 @@ public static ColumnEntity toColumnEntity(ColumnInfos dto) {
9595
}
9696

9797
public static GlobalFilterInfos toGlobalFilterDto(GlobalFilterEntity entity) {
98-
return new GlobalFilterInfos(
99-
entity.getId(),
100-
entity.getUuid(),
101-
entity.getFilterType(),
102-
entity.getFilterSubtype(),
103-
entity.getLabel(),
104-
entity.isRecent(),
105-
entity.getEquipmentType(),
106-
entity.getPath()
107-
);
98+
return GlobalFilterInfos.builder()
99+
.uuid(entity.getUuid())
100+
.filterType(entity.getFilterType())
101+
.filterSubtype(entity.getFilterSubtype())
102+
.label(entity.getLabel())
103+
.recent(entity.isRecent())
104+
.equipmentType(entity.getEquipmentType())
105+
.path(entity.getPath())
106+
.build();
107+
108108
}
109109

110110
public static GlobalFilterEntity toGlobalFilterEntity(GlobalFilterInfos dto) {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ void testConversionToDtoOfSpreadsheetConfig() {
8888

8989
// Global filters assertions
9090
assertThat(d.globalFilters()).hasSize(2);
91-
assertThat(d.globalFilters().get(0).id()).isNotNull();
9291
assertThat(d.globalFilters().get(0).label()).isEqualTo("GlobalFilter1");
93-
94-
assertThat(d.globalFilters().get(1).id()).isNotNull();
9592
assertThat(d.globalFilters().get(1).label()).isEqualTo("GlobalFilter2");
9693
});
9794
}
@@ -259,7 +256,6 @@ void testConversionToDtoOfGlobalFilter() {
259256
assertThat(dto)
260257
.as("DTO conversion result")
261258
.satisfies(d -> {
262-
assertThat(d.id()).isEqualTo(uuid);
263259
assertThat(d.uuid()).isEqualTo(filterId);
264260
assertThat(d.label()).isEqualTo("TestGlobalFilter");
265261
});

0 commit comments

Comments
 (0)