1919import org .apache .commons .io .FileUtils ;
2020import org .apache .commons .io .IOUtils ;
2121import org .apache .commons .lang3 .StringUtils ;
22- import org .apache .logging .log4j .Logger ;
2322import org .apache .logging .log4j .LogManager ;
23+ import org .apache .logging .log4j .Logger ;
2424import org .jetbrains .annotations .Nullable ;
2525import org .junit .Assert ;
2626import org .junit .Test ;
@@ -243,11 +243,11 @@ public void deleteAnalysis(User user, Container container, Collection<Integer> r
243243 throw new IllegalArgumentException ("Unable to find sequenceanalysis user schema" );
244244 }
245245
246+ TableInfo analysesTable = us .getTable (SequenceAnalysisSchema .TABLE_ANALYSES , null );
246247 try (DbScope .Transaction transaction = s .getSchema ().getScope ().ensureTransaction ())
247248 {
248249 for (int rowId : rowIds )
249250 {
250-
251251 new SqlExecutor (s .getSchema ()).execute (new SQLFragment ("DELETE FROM " + SequenceAnalysisSchema .SCHEMA_NAME + "." + SequenceAnalysisSchema .TABLE_ALIGNMENT_SUMMARY_JUNCTION + " WHERE analysis_id = ?" , rowId ));
252252 new SqlExecutor (s .getSchema ()).execute (new SQLFragment ("DELETE FROM " + SequenceAnalysisSchema .SCHEMA_NAME + "." + SequenceAnalysisSchema .TABLE_ALIGNMENT_SUMMARY + " WHERE analysis_id = ?" , rowId ));
253253 cascadeDeleteWithQUS (us , SequenceAnalysisSchema .TABLE_OUTPUTFILES , new SimpleFilter (FieldKey .fromString ("analysis_id" ), rowId ), "rowid" );
@@ -258,11 +258,11 @@ public void deleteAnalysis(User user, Container container, Collection<Integer> r
258258 new SqlExecutor (s .getSchema ()).execute (new SQLFragment ("DELETE FROM " + SequenceAnalysisSchema .SCHEMA_NAME + "." + SequenceAnalysisSchema .TABLE_QUALITY_METRICS + " WHERE analysis_id = ?" , rowId ));
259259
260260 List <Map <String , Object >> keysToDelete = new ArrayList <>();
261- keysToDelete .add (new CaseInsensitiveHashMap <Object >(){{put ("rowId" , rowId );}});
261+ keysToDelete .add (new CaseInsensitiveHashMap <>(){{put ("rowId" , rowId );}});
262262
263263 Map <String , Object > scriptContext = new HashMap <>();
264264 scriptContext .put ("deleteFromServer" , true ); //a flag to make the trigger script accept this
265- us . getTable ( SequenceAnalysisSchema . TABLE_ANALYSES , null ) .getUpdateService ().deleteRows (user , container , keysToDelete , null , scriptContext );
265+ analysesTable .getUpdateService ().deleteRows (user , container , keysToDelete , null , scriptContext );
266266 }
267267 transaction .commit ();
268268 }
0 commit comments