@RequestMapping(value = "/upload", method = RequestMethod.POST) public String uploadOneFile(@RequestParam("ibofile") MultipartFile iboFile) { try { String filename = iboFile.getOriginalFilename(); filename = filename.split("\\.")[0]; Record record = recordService.search(filename, "name").get(0); multipartFileIBOHandling(iboFile, record); } catch (Exception e) { e.printStackTrace(); } return "i2b2ibo"; }
private void handleManyFile(String path) throws IOException { ClassLoader classLoader = getClass().getClassLoader(); File folder = new File(classLoader.getResource(path).getFile()); logger.info(folder.getName()); File[] files = folder.listFiles(); for (File file : files) { String filename = file.getName(); filename = filename.split("\\.")[0]; Record record = recordService.search(filename, "name").get(0); if (record != null) { fileIBOHandling(file, record); } } }