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 6
6
*/
7
7
package org .gridsuite .studyconfig .server .dto ;
8
8
9
+ import com .fasterxml .jackson .annotation .JsonInclude ;
9
10
import io .swagger .v3 .oas .annotations .media .Schema ;
10
11
import jakarta .validation .constraints .NotNull ;
11
12
import lombok .Builder ;
19
20
@ Schema (name = "GlobalFilterDto" , description = "Global filter configuration" )
20
21
public record GlobalFilterInfos (
21
22
23
+ @ JsonInclude (JsonInclude .Include .NON_NULL )
22
24
@ Schema (description = "Global filter UUID" )
23
25
UUID id ,
24
26
27
+ @ JsonInclude (JsonInclude .Include .NON_NULL )
25
28
@ Schema (description = "Generic filter ID" )
26
29
UUID uuid ,
27
30
28
31
@ NotNull (message = "Filter type is mandatory" )
29
32
@ Schema (description = "Filter type" )
30
33
String filterType ,
31
34
35
+ @ JsonInclude (JsonInclude .Include .NON_NULL )
32
36
@ Schema (description = "Filter subtype" )
33
37
String filterSubtype ,
34
38
@@ -39,9 +43,11 @@ public record GlobalFilterInfos(
39
43
@ Schema (description = "Was filter recently applied" )
40
44
boolean recent ,
41
45
46
+ @ JsonInclude (JsonInclude .Include .NON_NULL )
42
47
@ Schema (description = "Generic filter related equipment type" )
43
48
String equipmentType ,
44
49
50
+ @ JsonInclude (JsonInclude .Include .NON_NULL )
45
51
@ Schema (description = "Generic filter path" )
46
52
String path
47
53
Original file line number Diff line number Diff line change @@ -93,16 +93,16 @@ public static ColumnEntity toColumnEntity(ColumnInfos dto) {
93
93
}
94
94
95
95
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
+
106
106
}
107
107
108
108
public static GlobalFilterEntity toGlobalFilterEntity (GlobalFilterInfos dto ) {
Original file line number Diff line number Diff line change @@ -84,10 +84,7 @@ void testConversionToDtoOfSpreadsheetConfig() {
84
84
assertThat (d .columns ().get (1 ).filterValue ()).isNull ();
85
85
// Global filters assertions
86
86
assertThat (d .globalFilters ()).hasSize (2 );
87
- assertThat (d .globalFilters ().get (0 ).id ()).isNotNull ();
88
87
assertThat (d .globalFilters ().get (0 ).label ()).isEqualTo ("GlobalFilter1" );
89
-
90
- assertThat (d .globalFilters ().get (1 ).id ()).isNotNull ();
91
88
assertThat (d .globalFilters ().get (1 ).label ()).isEqualTo ("GlobalFilter2" );
92
89
});
93
90
}
@@ -249,7 +246,6 @@ void testConversionToDtoOfGlobalFilter() {
249
246
assertThat (dto )
250
247
.as ("DTO conversion result" )
251
248
.satisfies (d -> {
252
- assertThat (d .id ()).isEqualTo (uuid );
253
249
assertThat (d .uuid ()).isEqualTo (filterId );
254
250
assertThat (d .label ()).isEqualTo ("TestGlobalFilter" );
255
251
});
You can’t perform that action at this time.
0 commit comments