Class UIMetadataImportService
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.ria.web.services.UIMetadataImportService
-
@Component public class UIMetadataImportService extends java.lang.Object
UI service to handle importing metadata files, so they can be saved to the session.
-
-
Constructor Summary
Constructors Constructor Description UIMetadataImportService(org.springframework.context.MessageSource messageSource, ProjectService projectService, SampleService sampleService, MetadataTemplateService metadataTemplateService, UIMetadataFileImportService metadataFileImportService)
-
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.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.SampleMetadataStorage
getProjectSampleMetadata(javax.servlet.http.HttpSession session, java.lang.Long projectId)
Get the currently stored metadata.java.lang.String
saveProjectSampleMetadata(java.util.Locale locale, javax.servlet.http.HttpSession session, java.lang.Long projectId, java.util.List<java.lang.String> sampleNames)
Save uploaded metadatajava.lang.String
setProjectSampleMetadataSampleId(javax.servlet.http.HttpSession session, java.lang.Long projectId, java.lang.String sampleNameColumn)
-
-
-
Constructor Detail
-
UIMetadataImportService
@Autowired public UIMetadataImportService(org.springframework.context.MessageSource messageSource, ProjectService projectService, SampleService sampleService, MetadataTemplateService metadataTemplateService, UIMetadataFileImportService metadataFileImportService)
-
-
Method Detail
-
createProjectSampleMetadata
public SampleMetadataStorage createProjectSampleMetadata(javax.servlet.http.HttpSession session, java.lang.Long projectId, 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:
Map
of headers and rows from the csv or excel file for the user to select the header corresponding theSample
identifier.- Throws:
java.lang.Exception
- if there is an error reading the file
-
setProjectSampleMetadataSampleId
public java.lang.String setProjectSampleMetadataSampleId(javax.servlet.http.HttpSession session, java.lang.Long projectId, java.lang.String sampleNameColumn)
-
saveProjectSampleMetadata
public java.lang.String saveProjectSampleMetadata(java.util.Locale locale, javax.servlet.http.HttpSession session, java.lang.Long projectId, java.util.List<java.lang.String> sampleNames) throws SavedMetadataException
Save uploaded metadata- Parameters:
locale
-Locale
of the current user.session
-HttpSession
projectId
-Long
identifier for the current projectsampleNames
-List
ofString
sample names- Returns:
String
that returns a message and potential errors.- Throws:
SavedMetadataException
- if there is an error saving the metadata
-
clearProjectSampleMetadata
public void clearProjectSampleMetadata(javax.servlet.http.HttpSession session, 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
public SampleMetadataStorage getProjectSampleMetadata(javax.servlet.http.HttpSession session, java.lang.Long projectId)
Get the currently stored metadata.- Parameters:
session
-HttpSession
projectId
-Long
identifier for the currentProject
- Returns:
- the currently stored
SampleMetadataStorage
-
-