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,27 @@ public GetAnalysisRequest(
22
25
List <String > limitToFiles ,
23
26
Integer severity ,
24
27
String shard ,
28
+ String ideProductName ,
29
+ String orgDisplayName ,
25
30
boolean prioritized ,
26
31
boolean legacy
27
32
) {
28
33
this .key = new GetAnalysisKey (bundleHash , limitToFiles , shard );
34
+ this .analysisContext = new AnalysisContext (ideProductName , orgDisplayName );
29
35
this .severity = severity ;
30
36
this .prioritized = prioritized ;
31
37
this .legacy = legacy ;
32
38
}
33
39
34
- public GetAnalysisRequest (String bundleHash , List <String > limitToFiles , Integer severity , String shard ) {
35
- this (bundleHash , limitToFiles , severity , shard , false , true );
40
+ public GetAnalysisRequest (
41
+ String bundleHash ,
42
+ List <String > limitToFiles ,
43
+ Integer severity ,
44
+ String shard ,
45
+ String ideProductName ,
46
+ String orgDisplayName
47
+ ) {
48
+ this (bundleHash , limitToFiles , severity , shard , ideProductName , orgDisplayName , false , true );
36
49
}
37
50
38
51
private static class GetAnalysisKey {
@@ -65,27 +78,72 @@ public boolean equals(Object o) {
65
78
if (o == null || getClass () != o .getClass ()) return false ;
66
79
GetAnalysisKey that = (GetAnalysisKey ) o ;
67
80
return type .equals (that .type )
68
- && hash .equals (that .hash )
69
- && Objects .equals (limitToFiles , that .limitToFiles );
81
+ && hash .equals (that .hash )
82
+ && Objects .equals (limitToFiles , that .limitToFiles );
70
83
}
71
84
72
85
@ Override
73
86
public String toString () {
74
87
return "GetAnalysisKey{"
75
- + "type='"
76
- + type
77
- + '\''
78
- + ", hash='"
79
- + hash
80
- + '\''
81
- + ", limitToFiles="
82
- + limitToFiles
83
- + '}' ;
88
+ + "type='"
89
+ + type
90
+ + '\''
91
+ + ", hash='"
92
+ + hash
93
+ + '\''
94
+ + ", limitToFiles="
95
+ + limitToFiles
96
+ + '}' ;
84
97
}
85
98
86
99
@ Override
87
100
public int hashCode () {
88
101
return Objects .hash (type , hash , limitToFiles );
89
102
}
90
103
}
104
+
105
+ private static class AnalysisContext {
106
+ private final String flow ;
107
+ private final String initiator = "IDE" ;
108
+ private final String orgDisplayName ;
109
+
110
+ public AnalysisContext (String flow , String orgDisplayName ) {
111
+ this .flow = flow ;
112
+ this .orgDisplayName = orgDisplayName ;
113
+ }
114
+
115
+ public String getFlow () {
116
+ return flow ;
117
+ }
118
+
119
+ public String getOrgDisplayName () {
120
+ return orgDisplayName ;
121
+ }
122
+
123
+ public String getInitiator () {
124
+ return initiator ;
125
+ }
126
+
127
+ @ Override
128
+ public boolean equals (Object o ) {
129
+ if (this == o ) return true ;
130
+ if (o == null || getClass () != o .getClass ()) return false ;
131
+ AnalysisContext that = (AnalysisContext ) o ;
132
+ return Objects .equals (flow , that .flow ) && Objects .equals (orgDisplayName , that .orgDisplayName );
133
+ }
134
+
135
+ @ Override
136
+ public int hashCode () {
137
+ return Objects .hash (flow , orgDisplayName );
138
+ }
139
+
140
+ @ Override
141
+ public String toString () {
142
+ return "AnalysisContext{" +
143
+ "flow='" + flow + '\'' +
144
+ ", initiator='" + initiator + '\'' +
145
+ ", orgDisplayName='" + orgDisplayName + '\'' +
146
+ '}' ;
147
+ }
148
+ }
91
149
}
0 commit comments