55import com .park .utmstack .domain .chart_builder .types .query .FilterType ;
66import com .park .utmstack .domain .chart_builder .types .query .OperatorType ;
77import com .park .utmstack .domain .index_pattern .enums .SystemIndexPattern ;
8- import com .park .utmstack .domain .shared_types .alert .AlertType ;
8+ import com .park .utmstack .domain .shared_types .alert .UtmAlert ;
99import com .park .utmstack .security .SecurityUtils ;
1010import com .park .utmstack .service .UtmAlertLogService ;
1111import com .park .utmstack .service .elasticsearch .ElasticsearchService ;
@@ -87,14 +87,14 @@ public Object logManualAlertStatusChange(ProceedingJoinPoint joinPoint) throws T
8787 Integer status = (Integer ) args [1 ];
8888 String statusObservation = (String ) args [2 ];
8989
90- List <AlertType > alerts = getAlerts (alertIds );
90+ List <UtmAlert > alerts = getAlerts (alertIds );
9191
9292 joinPoint .proceed ();
9393
9494 if (CollectionUtils .isEmpty (alerts ))
9595 return null ;
9696
97- for (AlertType alert : alerts ) {
97+ for (UtmAlert alert : alerts ) {
9898 UtmAlertLog alertLog = new UtmAlertLog ();
9999 alertLog .setAlertId (alert .getId ());
100100 alertLog .setLogUser (SecurityUtils .getCurrentUserLogin ().orElse ("system" ));
@@ -146,19 +146,19 @@ public Object logAutomaticAlertStatusChange(ProceedingJoinPoint joinPoint) throw
146146 .size (Constants .LOG_ANALYZER_TOTAL_RESULTS )
147147 .query (query ));
148148
149- HitsMetadata <AlertType > response = elasticsearchService .search (sr , AlertType .class ).hits ();
149+ HitsMetadata <UtmAlert > response = elasticsearchService .search (sr , UtmAlert .class ).hits ();
150150
151151 joinPoint .proceed ();
152152
153153 if (response .total ().value () <= 0 )
154154 return null ;
155155
156- List <AlertType > alerts = response .hits ().stream ().map (Hit ::source ).collect (Collectors .toList ());
156+ List <UtmAlert > alerts = response .hits ().stream ().map (Hit ::source ).collect (Collectors .toList ());
157157
158158 if (CollectionUtils .isEmpty (alerts ))
159159 return null ;
160160
161- for (AlertType alert : alerts ) {
161+ for (UtmAlert alert : alerts ) {
162162 UtmAlertLog alertLog = new UtmAlertLog ();
163163 alertLog .setAlertId (alert .getId ());
164164 alertLog .setLogUser ("system" );
@@ -197,7 +197,7 @@ public Object logManualAlertTagsChange(ProceedingJoinPoint joinPoint) throws Thr
197197 List alertIds = (List ) args [0 ];
198198 List tags = (List ) args [1 ];
199199
200- List <AlertType > alerts = getAlerts (alertIds );
200+ List <UtmAlert > alerts = getAlerts (alertIds );
201201
202202 joinPoint .proceed ();
203203
@@ -206,7 +206,7 @@ public Object logManualAlertTagsChange(ProceedingJoinPoint joinPoint) throws Thr
206206
207207 String user = SecurityUtils .getCurrentUserLogin ().orElse ("system" );
208208
209- for (AlertType alert : alerts ) {
209+ for (UtmAlert alert : alerts ) {
210210 UtmAlertLog alertLog = new UtmAlertLog ();
211211 alertLog .setAlertId (alert .getId ());
212212 alertLog .setLogUser (user );
@@ -247,21 +247,21 @@ public Object logAutomaticAlertTagsChange(ProceedingJoinPoint joinPoint) throws
247247 SearchRequest request = SearchRequest .of (s -> s .query (query )
248248 .size (Constants .LOG_ANALYZER_TOTAL_RESULTS ).index (indexPattern ));
249249
250- HitsMetadata <AlertType > hits = elasticsearchService .search (request , AlertType .class ).hits ();
250+ HitsMetadata <UtmAlert > hits = elasticsearchService .search (request , UtmAlert .class ).hits ();
251251
252252 joinPoint .proceed ();
253253
254254 if (hits .total ().value () <= 0 )
255255 return null ;
256256
257- List <AlertType > alerts = hits .hits ().stream ().map (Hit ::source ).collect (Collectors .toList ());
257+ List <UtmAlert > alerts = hits .hits ().stream ().map (Hit ::source ).collect (Collectors .toList ());
258258
259259 if (CollectionUtils .isEmpty (alerts ))
260260 return null ;
261261
262262 String user = SecurityUtils .getCurrentUserLogin ().orElse ("system" );
263263
264- for (AlertType alert : alerts ) {
264+ for (UtmAlert alert : alerts ) {
265265 UtmAlertLog alertLog = new UtmAlertLog ();
266266 alertLog .setAlertId (alert .getId ());
267267 alertLog .setLogUser (user );
@@ -294,7 +294,7 @@ public Object logManualAlertNotesChange(ProceedingJoinPoint joinPoint) throws Th
294294 String alertId = (String ) args [0 ];
295295 String notes = (String ) args [1 ];
296296
297- List <AlertType > alerts = getAlerts (Collections .singletonList (alertId ));
297+ List <UtmAlert > alerts = getAlerts (Collections .singletonList (alertId ));
298298
299299 joinPoint .proceed ();
300300
@@ -303,7 +303,7 @@ public Object logManualAlertNotesChange(ProceedingJoinPoint joinPoint) throws Th
303303
304304 String user = SecurityUtils .getCurrentUserLogin ().orElse ("system" );
305305
306- for (AlertType alert : alerts ) {
306+ for (UtmAlert alert : alerts ) {
307307 UtmAlertLog alertLog = new UtmAlertLog ();
308308 alertLog .setAlertId (alert .getId ());
309309 alertLog .setLogUser (user );
@@ -347,19 +347,19 @@ public Object logConvertToIncident(ProceedingJoinPoint joinPoint) throws Throwab
347347 SearchRequest request = SearchRequest .of (s -> s .size (Constants .LOG_ANALYZER_TOTAL_RESULTS )
348348 .query (query ).index (indexPattern ));
349349
350- HitsMetadata <AlertType > hits = elasticsearchService .search (request , AlertType .class ).hits ();
350+ HitsMetadata <UtmAlert > hits = elasticsearchService .search (request , UtmAlert .class ).hits ();
351351
352352 joinPoint .proceed ();
353353
354354 if (hits .total ().value () <= 0 )
355355 return null ;
356356
357- List <AlertType > alerts = hits .hits ().stream ().map (Hit ::source ).collect (Collectors .toList ());
357+ List <UtmAlert > alerts = hits .hits ().stream ().map (Hit ::source ).collect (Collectors .toList ());
358358
359359 if (CollectionUtils .isEmpty (alerts ))
360360 return null ;
361361
362- for (AlertType alert : alerts ) {
362+ for (UtmAlert alert : alerts ) {
363363 UtmAlertLog alertLog = new UtmAlertLog ();
364364 alertLog .setAlertId (alert .getId ());
365365 alertLog .setLogUser (incidentCreatedBy );
@@ -393,14 +393,14 @@ public Object logConvertToIncident(ProceedingJoinPoint joinPoint) throws Throwab
393393 * @return
394394 * @throws Exception
395395 */
396- private List <AlertType > getAlerts (List <?> ids ) throws Exception {
396+ private List <UtmAlert > getAlerts (List <?> ids ) throws Exception {
397397 final String ctx = CLASS_NAME + ".getAlerts" ;
398398 try {
399399 List <FilterType > filters = new ArrayList <>();
400400 filters .add (new FilterType (Constants .alertIdKeyword , OperatorType .IS_ONE_OF_TERMS , ids ));
401401 SearchRequest request = SearchRequest .of (s -> s .query (SearchUtil .toQuery (filters ))
402402 .index (Constants .SYS_INDEX_PATTERN .get (SystemIndexPattern .ALERTS )));
403- HitsMetadata <AlertType > hits = elasticsearchService .search (request , AlertType .class ).hits ();
403+ HitsMetadata <UtmAlert > hits = elasticsearchService .search (request , UtmAlert .class ).hits ();
404404 if (hits .total ().value () <= 0 )
405405 return Collections .emptyList ();
406406 return hits .hits ().stream ().map (Hit ::source ).collect (Collectors .toList ());
0 commit comments