File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed
main/java/org/gridsuite/studyconfig/server
test/java/org/gridsuite/studyconfig/server Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 66 */
77package org .gridsuite .studyconfig .server .dto ;
88
9+ import com .fasterxml .jackson .annotation .JsonInclude ;
910import io .swagger .v3 .oas .annotations .media .Schema ;
1011import jakarta .validation .constraints .NotNull ;
1112import lombok .Builder ;
1920@ Schema (name = "GlobalFilterDto" , description = "Global filter configuration" )
2021public 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
Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff 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 });
You can’t perform that action at this time.
0 commit comments