5
5
6
6
public class GetAnalysisRequest {
7
7
private GetAnalysisKey key ;
8
+ private AnalysisContext analysisContext ;
8
9
private Integer severity ;
9
10
private boolean prioritized ;
10
11
private boolean legacy ;
11
12
12
13
/**
13
14
* @param bundleHash
14
- * @param limitToFiles list of filePath
15
+ * @param limitToFiles list of filePath
15
16
* @param severity
16
- * @param shard uniq String (hash) per Project to optimize jobs on backend (run on the same worker to reuse caches)
17
+ * @param shard uniq String (hash) per Project to optimize jobs on backend (run on the same worker to reuse caches)
18
+ * @param ideProductName specific IDE
19
+ * @param orgDisplayName client’s snyk organization name
17
20
* @param prioritized
18
21
* @param legacy
19
22
*/
@@ -22,17 +25,25 @@ public GetAnalysisRequest(
22
25
List <String > limitToFiles ,
23
26
Integer severity ,
24
27
String shard ,
25
- boolean prioritized ,
28
+ String ideProductName , String orgDisplayName , boolean prioritized ,
26
29
boolean legacy
27
30
) {
28
31
this .key = new GetAnalysisKey (bundleHash , limitToFiles , shard );
32
+ this .analysisContext = new AnalysisContext (ideProductName , orgDisplayName );
29
33
this .severity = severity ;
30
34
this .prioritized = prioritized ;
31
35
this .legacy = legacy ;
32
36
}
33
37
34
- public GetAnalysisRequest (String bundleHash , List <String > limitToFiles , Integer severity , String shard ) {
35
- this (bundleHash , limitToFiles , severity , shard , false , true );
38
+ public GetAnalysisRequest (
39
+ String bundleHash ,
40
+ List <String > limitToFiles ,
41
+ Integer severity ,
42
+ String shard ,
43
+ String ideProductName ,
44
+ String orgDisplayName
45
+ ) {
46
+ this (bundleHash , limitToFiles , severity , shard , ideProductName , orgDisplayName , false , true );
36
47
}
37
48
38
49
private static class GetAnalysisKey {
@@ -65,27 +76,72 @@ public boolean equals(Object o) {
65
76
if (o == null || getClass () != o .getClass ()) return false ;
66
77
GetAnalysisKey that = (GetAnalysisKey ) o ;
67
78
return type .equals (that .type )
68
- && hash .equals (that .hash )
69
- && Objects .equals (limitToFiles , that .limitToFiles );
79
+ && hash .equals (that .hash )
80
+ && Objects .equals (limitToFiles , that .limitToFiles );
70
81
}
71
82
72
83
@ Override
73
84
public String toString () {
74
85
return "GetAnalysisKey{"
75
- + "type='"
76
- + type
77
- + '\''
78
- + ", hash='"
79
- + hash
80
- + '\''
81
- + ", limitToFiles="
82
- + limitToFiles
83
- + '}' ;
86
+ + "type='"
87
+ + type
88
+ + '\''
89
+ + ", hash='"
90
+ + hash
91
+ + '\''
92
+ + ", limitToFiles="
93
+ + limitToFiles
94
+ + '}' ;
84
95
}
85
96
86
97
@ Override
87
98
public int hashCode () {
88
99
return Objects .hash (type , hash , limitToFiles );
89
100
}
90
101
}
102
+
103
+ private static class AnalysisContext {
104
+ private final String flow ;
105
+ private final String initiator = "IDE" ;
106
+ private final String orgDisplayName ;
107
+
108
+ public AnalysisContext (String flow , String orgDisplayName ) {
109
+ this .flow = flow ;
110
+ this .orgDisplayName = orgDisplayName ;
111
+ }
112
+
113
+ public String getFlow () {
114
+ return flow ;
115
+ }
116
+
117
+ public String getOrgDisplayName () {
118
+ return orgDisplayName ;
119
+ }
120
+
121
+ public String getInitiator () {
122
+ return initiator ;
123
+ }
124
+
125
+ @ Override
126
+ public boolean equals (Object o ) {
127
+ if (this == o ) return true ;
128
+ if (o == null || getClass () != o .getClass ()) return false ;
129
+ AnalysisContext that = (AnalysisContext ) o ;
130
+ return Objects .equals (flow , that .flow ) && Objects .equals (orgDisplayName , that .orgDisplayName );
131
+ }
132
+
133
+ @ Override
134
+ public int hashCode () {
135
+ return Objects .hash (flow , orgDisplayName );
136
+ }
137
+
138
+ @ Override
139
+ public String toString () {
140
+ return "AnalysisContext{" +
141
+ "flow='" + flow + '\'' +
142
+ ", initiator='" + initiator + '\'' +
143
+ ", orgDisplayName='" + orgDisplayName + '\'' +
144
+ '}' ;
145
+ }
146
+ }
91
147
}
0 commit comments