55
66public class GetAnalysisRequest {
77 private GetAnalysisKey key ;
8+ private AnalysisContext analysisContext ;
89 private Integer severity ;
910 private boolean prioritized ;
1011 private boolean legacy ;
1112
1213 /**
1314 * @param bundleHash
14- * @param limitToFiles list of filePath
15+ * @param limitToFiles list of filePath
1516 * @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
1720 * @param prioritized
1821 * @param legacy
1922 */
@@ -22,17 +25,27 @@ public GetAnalysisRequest(
2225 List <String > limitToFiles ,
2326 Integer severity ,
2427 String shard ,
28+ String ideProductName ,
29+ String orgDisplayName ,
2530 boolean prioritized ,
2631 boolean legacy
2732 ) {
2833 this .key = new GetAnalysisKey (bundleHash , limitToFiles , shard );
34+ this .analysisContext = new AnalysisContext (ideProductName , orgDisplayName );
2935 this .severity = severity ;
3036 this .prioritized = prioritized ;
3137 this .legacy = legacy ;
3238 }
3339
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 );
3649 }
3750
3851 private static class GetAnalysisKey {
@@ -65,27 +78,72 @@ public boolean equals(Object o) {
6578 if (o == null || getClass () != o .getClass ()) return false ;
6679 GetAnalysisKey that = (GetAnalysisKey ) o ;
6780 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 );
7083 }
7184
7285 @ Override
7386 public String toString () {
7487 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+ + '}' ;
8497 }
8598
8699 @ Override
87100 public int hashCode () {
88101 return Objects .hash (type , hash , limitToFiles );
89102 }
90103 }
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+ }
91149}
0 commit comments