5
5
import com .linkedin .common .DataPlatformInstance ;
6
6
import com .linkedin .common .urn .Urn ;
7
7
import com .linkedin .data .DataMap ;
8
- import com .linkedin .data .template .GetMode ;
9
8
import com .linkedin .datahub .graphql .QueryContext ;
10
- import com .linkedin .datahub .graphql .generated .AuditStamp ;
11
9
import com .linkedin .datahub .graphql .generated .DataPlatform ;
12
10
import com .linkedin .datahub .graphql .generated .Dataset ;
13
11
import com .linkedin .datahub .graphql .generated .EntityType ;
14
12
import com .linkedin .datahub .graphql .generated .QueryEntity ;
15
- import com .linkedin .datahub .graphql .generated .QueryLanguage ;
16
- import com .linkedin .datahub .graphql .generated .QuerySource ;
17
- import com .linkedin .datahub .graphql .generated .QueryStatement ;
18
13
import com .linkedin .datahub .graphql .generated .QuerySubject ;
19
- import com .linkedin .datahub .graphql .types .common .mappers .UrnToEntityMapper ;
14
+ import com .linkedin .datahub .graphql .types .common .mappers .QueryPropertiesMapper ;
20
15
import com .linkedin .datahub .graphql .types .common .mappers .util .MappingHelper ;
21
16
import com .linkedin .datahub .graphql .types .mappers .ModelMapper ;
22
17
import com .linkedin .entity .EntityResponse ;
@@ -48,7 +43,10 @@ public QueryEntity apply(
48
43
result .setType (EntityType .QUERY );
49
44
EnvelopedAspectMap aspectMap = entityResponse .getAspects ();
50
45
MappingHelper <QueryEntity > mappingHelper = new MappingHelper <>(aspectMap , result );
51
- mappingHelper .mapToResult (context , QUERY_PROPERTIES_ASPECT_NAME , this ::mapQueryProperties );
46
+ mappingHelper .mapToResult (
47
+ QUERY_PROPERTIES_ASPECT_NAME ,
48
+ (entity , dataMap ) ->
49
+ entity .setProperties (QueryPropertiesMapper .map (context , new QueryProperties (dataMap ))));
52
50
mappingHelper .mapToResult (QUERY_SUBJECTS_ASPECT_NAME , this ::mapQuerySubjects );
53
51
mappingHelper .mapToResult (DATA_PLATFORM_INSTANCE_ASPECT_NAME , this ::mapPlatform );
54
52
return mappingHelper .getResult ();
@@ -64,37 +62,6 @@ private void mapPlatform(@Nonnull QueryEntity query, @Nonnull DataMap dataMap) {
64
62
}
65
63
}
66
64
67
- private void mapQueryProperties (
68
- @ Nullable final QueryContext context , @ Nonnull QueryEntity query , @ Nonnull DataMap dataMap ) {
69
- QueryProperties queryProperties = new QueryProperties (dataMap );
70
- com .linkedin .datahub .graphql .generated .QueryProperties res =
71
- new com .linkedin .datahub .graphql .generated .QueryProperties ();
72
-
73
- // Query Source must be kept in sync.
74
- res .setSource (QuerySource .valueOf (queryProperties .getSource ().toString ()));
75
- res .setStatement (
76
- new QueryStatement (
77
- queryProperties .getStatement ().getValue (),
78
- QueryLanguage .valueOf (queryProperties .getStatement ().getLanguage ().toString ())));
79
- res .setName (queryProperties .getName (GetMode .NULL ));
80
- res .setDescription (queryProperties .getDescription (GetMode .NULL ));
81
- if (queryProperties .hasOrigin () && queryProperties .getOrigin () != null ) {
82
- res .setOrigin (UrnToEntityMapper .map (context , queryProperties .getOrigin ()));
83
- }
84
-
85
- AuditStamp created = new AuditStamp ();
86
- created .setTime (queryProperties .getCreated ().getTime ());
87
- created .setActor (queryProperties .getCreated ().getActor (GetMode .NULL ).toString ());
88
- res .setCreated (created );
89
-
90
- AuditStamp lastModified = new AuditStamp ();
91
- lastModified .setTime (queryProperties .getLastModified ().getTime ());
92
- lastModified .setActor (queryProperties .getLastModified ().getActor (GetMode .NULL ).toString ());
93
- res .setLastModified (lastModified );
94
-
95
- query .setProperties (res );
96
- }
97
-
98
65
@ Nonnull
99
66
private void mapQuerySubjects (@ Nonnull QueryEntity query , @ Nonnull DataMap dataMap ) {
100
67
QuerySubjects querySubjects = new QuerySubjects (dataMap );
0 commit comments