Class ProjectSampleMetadataAjaxController


  • @Controller
    @RequestMapping("/ajax/projects/sample-metadata/upload")
    public class ProjectSampleMetadataAjaxController
    extends java.lang.Object
    This class is designed to be used for bulk actions on MetadataEntry within a Project.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearProjectSampleMetadata​(javax.servlet.http.HttpSession session, java.lang.Long projectId)
      Clear any uploaded sample metadata stored into the session.
      org.springframework.http.ResponseEntity<SampleMetadataStorage> createProjectSampleMetadata​(javax.servlet.http.HttpSession session, java.lang.Long projectId, org.springframework.web.multipart.MultipartFile file)
      Upload CSV or Excel file containing sample metadata and extract the headers.
      org.springframework.http.ResponseEntity<SampleMetadataStorage> getProjectSampleMetadata​(javax.servlet.http.HttpSession session, java.lang.Long projectId)
      Get the currently stored metadata.
      org.springframework.http.ResponseEntity<AjaxResponse> saveProjectSampleMetadata​(java.util.Locale locale, javax.servlet.http.HttpSession session, java.lang.Long projectId, java.util.List<java.lang.String> sampleNames)
      Save uploaded metadata from the session into IRIDA.
      org.springframework.http.ResponseEntity<AjaxResponse> setProjectSampleMetadataSampleId​(javax.servlet.http.HttpSession session, java.lang.Long projectId, java.lang.String sampleNameColumn)
      Add the metadata to specific Sample based on the selected column to correspond to the Sample id.
      • Methods inherited from class java.lang.Object

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

      • ProjectSampleMetadataAjaxController

        @Autowired
        public ProjectSampleMetadataAjaxController​(UIMetadataImportService metadataImportService)
    • Method Detail

      • createProjectSampleMetadata

        @PostMapping("/file")
        @ResponseBody
        public org.springframework.http.ResponseEntity<SampleMetadataStorage> createProjectSampleMetadata​(javax.servlet.http.HttpSession session,
                                                                                                          @RequestParam
                                                                                                          java.lang.Long projectId,
                                                                                                          @RequestParam("file")
                                                                                                          org.springframework.web.multipart.MultipartFile file)
                                                                                                   throws java.lang.Exception
        Upload CSV or Excel file containing sample metadata and extract the headers. The file is stored in the session until the column that corresponds to a Sample identifier has been sent.
        Parameters:
        session - HttpSession
        projectId - Long identifier for the current Project
        file - MultipartFile The csv or excel file containing the metadata.
        Returns:
        SampleMetadataStorage which includes a List of headers and rows from the csv or excel file.
        Throws:
        java.lang.Exception - if there is an error reading the file
      • setProjectSampleMetadataSampleId

        @PutMapping("/setSampleColumn")
        @ResponseBody
        public org.springframework.http.ResponseEntity<AjaxResponse> setProjectSampleMetadataSampleId​(javax.servlet.http.HttpSession session,
                                                                                                      @RequestParam
                                                                                                      java.lang.Long projectId,
                                                                                                      @RequestParam
                                                                                                      java.lang.String sampleNameColumn)
        Add the metadata to specific Sample based on the selected column to correspond to the Sample id.
        Parameters:
        session - HttpSession.
        projectId - Long identifier for the current Project.
        sampleNameColumn - String the header to used to represent the Sample identifier.
        Returns:
        a complete message.
      • saveProjectSampleMetadata

        @PostMapping("/save")
        @ResponseBody
        public org.springframework.http.ResponseEntity<AjaxResponse> saveProjectSampleMetadata​(java.util.Locale locale,
                                                                                               javax.servlet.http.HttpSession session,
                                                                                               @RequestParam
                                                                                               java.lang.Long projectId,
                                                                                               @RequestParam
                                                                                               java.util.List<java.lang.String> sampleNames)
        Save uploaded metadata from the session into IRIDA.
        Parameters:
        locale - Locale of the current user.
        session - HttpSession
        projectId - Long identifier for the current project
        sampleNames - List of String sample names
        Returns:
        String message of how many samples were created and/or updated.
      • clearProjectSampleMetadata

        @DeleteMapping("/clear")
        public void clearProjectSampleMetadata​(javax.servlet.http.HttpSession session,
                                               @RequestParam
                                               java.lang.Long projectId)
        Clear any uploaded sample metadata stored into the session.
        Parameters:
        session - HttpSession
        projectId - identifier for the Project currently uploaded metadata to.
      • getProjectSampleMetadata

        @GetMapping("/getMetadata")
        @ResponseBody
        public org.springframework.http.ResponseEntity<SampleMetadataStorage> getProjectSampleMetadata​(javax.servlet.http.HttpSession session,
                                                                                                       @RequestParam
                                                                                                       java.lang.Long projectId)
        Get the currently stored metadata.
        Parameters:
        session - HttpSession
        projectId - Long identifier for the current Project
        Returns:
        the currently stored SampleMetadataStorage