Class ReferenceFileAjaxController


  • @RestController
    @RequestMapping("/ajax/reference-files")
    public class ReferenceFileAjaxController
    extends java.lang.Object
    Controller for ajax actions for reference files
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.http.ResponseEntity<AjaxResponse> addReferenceFileToProject​(java.lang.Long projectId, java.util.List<org.springframework.web.multipart.MultipartFile> files, java.util.Locale locale)
      Add a new reference file to a project.
      org.springframework.http.ResponseEntity<AjaxResponse> deleteReferenceFile​(java.lang.Long fileId, java.lang.Long projectId, java.util.Locale locale)
      Delete a reference file.
      void downloadReferenceFile​(java.lang.Long fileId, javax.servlet.http.HttpServletResponse response)
      Download a reference file based on the id passed.
      org.springframework.http.ResponseEntity<java.util.List<UIReferenceFile>> getReferenceFilesForProject​(java.lang.Long projectId, java.util.Locale locale)
      Get the reference files for a project
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • addReferenceFileToProject

        @PostMapping("")
        public org.springframework.http.ResponseEntity<AjaxResponse> addReferenceFileToProject​(@RequestParam(required=false)
                                                                                               java.lang.Long projectId,
                                                                                               @RequestParam("file")
                                                                                               java.util.List<org.springframework.web.multipart.MultipartFile> files,
                                                                                               java.util.Locale locale)
        Add a new reference file to a project.
        Parameters:
        projectId - The id of the project to add the file to.
        files - List of MultipartFile file being uploaded.
        locale - locale of the logged in user
        Returns:
        Success message if file was successfully uploaded
      • deleteReferenceFile

        @DeleteMapping("")
        public org.springframework.http.ResponseEntity<AjaxResponse> deleteReferenceFile​(@RequestParam("fileId")
                                                                                         java.lang.Long fileId,
                                                                                         @RequestParam("projectId")
                                                                                         java.lang.Long projectId,
                                                                                         java.util.Locale locale)
        Delete a reference file. This will remove it from the project.
        Parameters:
        fileId - The id of the file to remove.
        projectId - the project to delete the reference file for.
        locale - the locale specified by the browser.
        Returns:
        Success or error based on the result of deleting the file.
      • downloadReferenceFile

        @RequestMapping("/download/{fileId}")
        public void downloadReferenceFile​(@PathVariable
                                          java.lang.Long fileId,
                                          javax.servlet.http.HttpServletResponse response)
        Download a reference file based on the id passed.
        Parameters:
        fileId - The id of the file to download
        response - HttpServletResponse to write to file to
      • getReferenceFilesForProject

        @GetMapping("/{projectId}")
        public org.springframework.http.ResponseEntity<java.util.List<UIReferenceFile>> getReferenceFilesForProject​(@PathVariable
                                                                                                                    java.lang.Long projectId,
                                                                                                                    java.util.Locale locale)
        Get the reference files for a project
        Parameters:
        projectId - the ID of the project
        locale - locale of the logged in user
        Returns:
        information about the reference files in the project