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 @@ -93,16 +93,16 @@ public static ColumnEntity toColumnEntity(ColumnInfos dto) {
9393 }
9494
9595 public static GlobalFilterInfos toGlobalFilterDto (GlobalFilterEntity entity ) {
96- return new GlobalFilterInfos (
97- entity .getId (),
98- entity .getUuid (),
99- entity .getFilterType (),
100- entity .getFilterSubtype (),
101- entity .getLabel (),
102- entity .isRecent (),
103- entity .getEquipmentType (),
104- entity . getPath ()
105- );
96+ return GlobalFilterInfos . builder ()
97+ . uuid ( entity .getUuid ())
98+ . filterType ( entity .getFilterType ())
99+ . filterSubtype ( entity .getFilterSubtype ())
100+ . label ( entity .getLabel ())
101+ . recent ( entity .isRecent ())
102+ . equipmentType ( entity .getEquipmentType ())
103+ . path ( entity .getPath ())
104+ . build ();
105+
106106 }
107107
108108 public static GlobalFilterEntity toGlobalFilterEntity (GlobalFilterInfos dto ) {
Original file line number Diff line number Diff line change @@ -84,10 +84,7 @@ void testConversionToDtoOfSpreadsheetConfig() {
8484 assertThat (d .columns ().get (1 ).filterValue ()).isNull ();
8585 // Global filters assertions
8686 assertThat (d .globalFilters ()).hasSize (2 );
87- assertThat (d .globalFilters ().get (0 ).id ()).isNotNull ();
8887 assertThat (d .globalFilters ().get (0 ).label ()).isEqualTo ("GlobalFilter1" );
89-
90- assertThat (d .globalFilters ().get (1 ).id ()).isNotNull ();
9188 assertThat (d .globalFilters ().get (1 ).label ()).isEqualTo ("GlobalFilter2" );
9289 });
9390 }
@@ -249,7 +246,6 @@ void testConversionToDtoOfGlobalFilter() {
249246 assertThat (dto )
250247 .as ("DTO conversion result" )
251248 .satisfies (d -> {
252- assertThat (d .id ()).isEqualTo (uuid );
253249 assertThat (d .uuid ()).isEqualTo (filterId );
254250 assertThat (d .label ()).isEqualTo ("TestGlobalFilter" );
255251 });
You can’t perform that action at this time.
0 commit comments