@@ -428,81 +428,7 @@ public void addNavTrail(NavTree tree)
428
428
tree .addChild ("Analyze Alignments" );
429
429
}
430
430
}
431
-
432
- @ RequiresPermission (ReadPermission .class )
433
- @ IgnoresTermsOfUse
434
- public static class DownloadTempImageAction extends ExportAction <TempImageAction >
435
- {
436
- @ Override
437
- public void export (TempImageAction form , HttpServletResponse response , BindException errors ) throws Exception
438
- {
439
- File parentDir = form .getDirectory () == null ? FileUtil .getTempDirectory () : new File (FileUtil .getTempDirectory (), form .getDirectory ());
440
- File targetFile = new File (parentDir , form .getFileName ());
441
- targetFile = FileUtil .getAbsoluteCaseSensitiveFile (targetFile );
442
-
443
- if (!NetworkDrive .exists (targetFile ))
444
- {
445
- throw new FileNotFoundException ("Could not find file: " + targetFile .getPath ());
446
- }
447
-
448
- if (parentDir .listFiles () == null )
449
- {
450
- throw new FileNotFoundException ("Unable to list the contents of folder: " + parentDir .getPath ());
451
- }
452
-
453
- PageFlowUtil .streamFile (response , targetFile , false );
454
-
455
- //the file will be recreated, so delete upon running
456
- FileUtils .deleteQuietly (targetFile );
457
-
458
- //if the folder if empty, remove it too. other simultaneous requests might have deleted this folder before we get to it
459
- if (parentDir != null && parentDir .exists ())
460
- {
461
- File [] children = parentDir .listFiles ();
462
- if (children != null && children .length == 0 && !parentDir .equals (FileUtil .getTempDirectory ()))
463
- {
464
- FileUtils .deleteQuietly (parentDir ); //the Images folder
465
- File parent = parentDir .getParentFile ();
466
- FileUtils .deleteQuietly (parent ); //the file's folder
467
-
468
- if (parent != null && parent .getParentFile () != null )
469
- {
470
- File [] children2 = parent .getParentFile ().listFiles ();
471
- if (children2 != null && children2 .length == 0 )
472
- FileUtils .deleteQuietly (parent .getParentFile ()); //the file's folder
473
- }
474
- }
475
- }
476
- }
477
- }
478
-
479
- @ RequiresPermission (ReadPermission .class )
480
- @ IgnoresTermsOfUse
481
- public static class ConvertTextToFileAction extends ExportAction <ConvertTextToFileForm >
482
- {
483
- @ Override
484
- public void export (ConvertTextToFileForm form , HttpServletResponse response , BindException errors ) throws Exception
485
- {
486
- String text = form .getText ();
487
-
488
- if (text == null )
489
- {
490
- errors .reject (ERROR_MSG , "Need to provide text" );
491
- return ;
492
- }
493
- if (form .getFileName () == null )
494
- {
495
- errors .reject (ERROR_MSG , "Need to provide a filename" );
496
- return ;
497
- }
498
-
499
- Map <String , String > headers = new HashMap <>();
500
-
501
- PageFlowUtil .prepareResponseForFile (response , headers , form .getFileName (), true );
502
- response .getOutputStream ().print (text );
503
- }
504
- }
505
-
431
+
506
432
@ UtilityAction (label = "Find Orphan Files" , description = "This will start a pipeline job that will inspect all files in this folder to identify potential orphan or otherwise unnecessary files" )
507
433
@ RequiresPermission (ReadPermission .class )
508
434
public static class FindOrphanFilesAction extends ConfirmAction <Object >
@@ -5318,4 +5244,4 @@ public void setDataFileUrl(String dataFileUrl)
5318
5244
_dataFileUrl = dataFileUrl ;
5319
5245
}
5320
5246
}
5321
- }
5247
+ }
0 commit comments