result.put("file_type", resultFile.getType().toString()); result.put("filename", resultFile.getName()); result.put("repository_path", resultFile.getQualifiedPath());
result.put("file_type", jobFile.getType().toString()); result.put("filename", jobFile.getName()); result.put("repository_path", jobFile.getQualifiedPath());
result.put("file_type", configurationFile.getType().toString()); result.put("filename", configurationFile.getName()); result.put("repository_path", configurationFile.getQualifiedPath());
@RolesAllowed(SecurityRoles.JOB_EDITOR) @RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @ResponseBody public Map<String, String> uploadAnalysisJobToFolderJson(@PathVariable("tenant") final String tenant, @RequestParam("file") final MultipartFile file) { if (file == null) { throw new IllegalArgumentException( "No file upload provided. Please provide a multipart file using the 'file' HTTP parameter."); } final Action<OutputStream> writeCallback = out -> { final InputStream in = file.getInputStream(); try { FileHelper.copy(in, out); } finally { FileHelper.safeClose(in); } }; final TenantContext context = _contextFactory.getContext(tenant); final RepositoryFile jobFile; final RepositoryFolder jobsFolder = context.getJobFolder(); final String filename = file.getOriginalFilename(); jobFile = jobsFolder.createFile(filename, writeCallback); logger.info("Created new job from uploaded file: {}", filename); final Map<String, String> result = new HashMap<>(); result.put("status", STATUS_SUCCESS); result.put("file_type", jobFile.getType().toString()); result.put("filename", jobFile.getName()); result.put("repository_path", jobFile.getQualifiedPath()); return result; }