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 @@ -95,16 +95,16 @@ public static ColumnEntity toColumnEntity(ColumnInfos dto) {
95
95
}
96
96
97
97
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
+
108
108
}
109
109
110
110
public static GlobalFilterEntity toGlobalFilterEntity (GlobalFilterInfos dto ) {
Original file line number Diff line number Diff line change @@ -88,10 +88,7 @@ void testConversionToDtoOfSpreadsheetConfig() {
88
88
89
89
// Global filters assertions
90
90
assertThat (d .globalFilters ()).hasSize (2 );
91
- assertThat (d .globalFilters ().get (0 ).id ()).isNotNull ();
92
91
assertThat (d .globalFilters ().get (0 ).label ()).isEqualTo ("GlobalFilter1" );
93
-
94
- assertThat (d .globalFilters ().get (1 ).id ()).isNotNull ();
95
92
assertThat (d .globalFilters ().get (1 ).label ()).isEqualTo ("GlobalFilter2" );
96
93
});
97
94
}
@@ -259,7 +256,6 @@ void testConversionToDtoOfGlobalFilter() {
259
256
assertThat (dto )
260
257
.as ("DTO conversion result" )
261
258
.satisfies (d -> {
262
- assertThat (d .id ()).isEqualTo (uuid );
263
259
assertThat (d .uuid ()).isEqualTo (filterId );
264
260
assertThat (d .label ()).isEqualTo ("TestGlobalFilter" );
265
261
});
You can’t perform that action at this time.
0 commit comments