private static void collectFiles(File file, List<File> uploadedFiles) { if (file.isDirectory()) { for (File child : file.listFiles()) { collectFiles(child, uploadedFiles); } } else uploadedFiles.add(file); }
private static UploadInfo getUploadInfo(models.Upload upload, File uploadsDir, User user) { List<File> uploadedFiles = new ArrayList<File>(); collectFiles(uploadsDir, uploadedFiles); List<Module> modules = new ArrayList<Module>(); List<Diagnostic> diagnostics = ModuleChecker.collectModulesAndDiagnostics( uploadedFiles, modules, uploadsDir, user, upload); return new UploadInfo(upload, modules, diagnostics); }
public static void view(Long id) throws IOException { models.Upload upload = getUpload(id); User user = getUser(); File uploadsDir = Util.getUploadDir(id); List<File> uploadedFiles = new ArrayList<File>(); collectFiles(uploadsDir, uploadedFiles); List<Module> modules = new ArrayList<Module>(); List<Diagnostic> diagnostics = ModuleChecker.collectModulesAndDiagnostics( uploadedFiles, modules, uploadsDir, user, upload); UploadInfo uploadInfo = new UploadInfo(upload, modules, diagnostics); String base = uploadsDir.getPath(); render("Uploads/view.html", upload, uploadInfo, uploadedFiles, base); }