Beispiel #1
0
 private static void collectFiles(File file, List<File> uploadedFiles) {
   if (file.isDirectory()) {
     for (File child : file.listFiles()) {
       collectFiles(child, uploadedFiles);
     }
   } else uploadedFiles.add(file);
 }
Beispiel #2
0
  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);
  }
Beispiel #3
0
  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);
  }