Class ProjectSampleMetadataAjaxController
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.ria.web.projects.metadata.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 onMetadataEntry
within aProject
.
-
-
Constructor Summary
Constructors Constructor Description ProjectSampleMetadataAjaxController(UIMetadataImportService metadataImportService)
-
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)
-
-
-
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 aSample
identifier has been sent.- Parameters:
session
-HttpSession
projectId
-Long
identifier for the currentProject
file
-MultipartFile
The csv or excel file containing the metadata.- Returns:
SampleMetadataStorage
which includes aList
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)
-
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 projectsampleNames
-List
ofString
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 theProject
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 currentProject
- Returns:
- the currently stored
SampleMetadataStorage
-
-