Class UIProjectReferenceFileService
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.ria.web.services.UIProjectReferenceFileService
-
@Component public class UIProjectReferenceFileService extends java.lang.Object
A utility class for formatting responses for the project reference files page UI.
-
-
Constructor Summary
Constructors Constructor Description UIProjectReferenceFileService(ProjectService projectService, ReferenceFileService referenceFileService, org.springframework.context.MessageSource messageSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<UIReferenceFile>
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.java.lang.String
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.java.util.List<UIReferenceFile>
getReferenceFilesForProject(java.lang.Long projectId, java.util.Locale locale)
Get the reference files for a project
-
-
-
Constructor Detail
-
UIProjectReferenceFileService
@Autowired public UIProjectReferenceFileService(ProjectService projectService, ReferenceFileService referenceFileService, org.springframework.context.MessageSource messageSource)
-
-
Method Detail
-
addReferenceFileToProject
public java.util.List<UIReferenceFile> addReferenceFileToProject(java.lang.Long projectId, java.util.List<org.springframework.web.multipart.MultipartFile> files, java.util.Locale locale) throws UnsupportedReferenceFileContentError, java.io.IOException
Add a new reference file to a project.- Parameters:
projectId
- The id of the project to add the file to.files
-List
ofMultipartFile
file being uploaded.locale
- locale of the logged in user- Returns:
- Return success message or error if file was successfully uploaded or not
- Throws:
UnsupportedReferenceFileContentError
- if content is invalidjava.io.IOException
- if there is an I/O error
-
deleteReferenceFile
public java.lang.String deleteReferenceFile(java.lang.Long fileId, java.lang.Long projectId, java.util.Locale locale) throws EntityNotFoundException
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.
- Throws:
EntityNotFoundException
- if project or reference file cannot be read
-
downloadReferenceFile
public void downloadReferenceFile(java.lang.Long fileId, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
Download a reference file based on the id passed.- Parameters:
fileId
- The id of the file to downloadresponse
-HttpServletResponse
to write to file to- Throws:
java.io.IOException
- if we fail to read the file from disk.
-
getReferenceFilesForProject
public java.util.List<UIReferenceFile> getReferenceFilesForProject(java.lang.Long projectId, java.util.Locale locale)
Get the reference files for a project- Parameters:
projectId
- the ID of the projectlocale
- locale of the logged in user- Returns:
- information about the reference files in the project
-
-