Class ProjectsController
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.ria.web.projects.ProjectsController
-
@Controller @Scope("session") public class ProjectsController extends java.lang.Object
Controller for project related views
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LIST_PROJECTS_PAGE
static java.lang.String
PROJECTS_DIR
static java.lang.String
SYNC_NEW_PROJECT_PAGE
-
Constructor Summary
Constructors Constructor Description ProjectsController(ProjectService projectService, SampleService sampleService, UserService userService, ProjectControllerUtils projectControllerUtils, TaxonomyService taxonomyService, org.springframework.context.MessageSource messageSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
exportProjectsToFile(java.lang.String type, java.lang.Boolean isAdmin, javax.servlet.http.HttpServletResponse response, java.security.Principal principal, java.util.Locale locale)
Export Projects table as either an excel file or CSVjava.lang.String
getAllProjectsPage(org.springframework.ui.Model model)
Get the admin projects page.java.lang.String
getProjectActivityPage(java.lang.Long projectId, org.springframework.ui.Model model, java.security.Principal principal)
Request for a specific project details page.java.lang.String
getProjectAnalysisList(java.lang.Long projectId, java.security.Principal principal, org.springframework.ui.Model model)
Get the page for analyses shared with a givenProject
java.lang.String
getProjectSamplesMetadataUploadPage(org.springframework.ui.Model model, java.lang.Long projectId, java.security.Principal principal)
Handle the page request to uploadSample
metadatajava.lang.String
getProjectSamplesPage(org.springframework.ui.Model model, java.security.Principal principal, long projectId)
Get the samples for a given projectjava.lang.String
getProjectSettingsPage(java.lang.Long projectId, java.security.Principal principal, org.springframework.ui.Model model)
Get the project settings pagejava.lang.String
getProjectSPA(org.springframework.ui.Model model, java.security.Principal principal, long projectId)
Default page handler for all UI routes loaded through the project SPA endpointjava.lang.String
getProjectsPage(org.springframework.ui.Model model)
Request for the page to display a list of all projects available to the currently logged in user.java.lang.String
getProjectsSharePage(java.lang.Long projectId, org.springframework.ui.Model model, java.security.Principal principal)
Get the page to share samples between projectsjava.lang.String
getSynchronizeProjectPage()
Get the page to synchronize remote projectsorg.springframework.http.ResponseEntity<java.lang.String>
roleChangeErrorHandler(java.lang.Exception ex)
Handle aProjectWithoutOwnerException
error.java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
searchTaxonomy(java.lang.String searchTerm)
Search for taxonomy terms.
-
-
-
Field Detail
-
PROJECTS_DIR
public static final java.lang.String PROJECTS_DIR
- See Also:
- Constant Field Values
-
LIST_PROJECTS_PAGE
public static final java.lang.String LIST_PROJECTS_PAGE
- See Also:
- Constant Field Values
-
SYNC_NEW_PROJECT_PAGE
public static final java.lang.String SYNC_NEW_PROJECT_PAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ProjectsController
@Autowired public ProjectsController(ProjectService projectService, SampleService sampleService, UserService userService, ProjectControllerUtils projectControllerUtils, TaxonomyService taxonomyService, org.springframework.context.MessageSource messageSource)
-
-
Method Detail
-
getProjectsPage
@RequestMapping("/projects") public java.lang.String getProjectsPage(org.springframework.ui.Model model)
Request for the page to display a list of all projects available to the currently logged in user.- Parameters:
model
- The model to add attributes to for the template.- Returns:
- The name of the page.
-
getAllProjectsPage
@RequestMapping("/projects/all") @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\')") public java.lang.String getAllProjectsPage(org.springframework.ui.Model model)
Get the admin projects page.- Parameters:
model
-Model
- Returns:
- The name of the page
-
getProjectSamplesPage
@RequestMapping({"/projects/{projectId}","/projects/{projectId}/samples"}) public java.lang.String getProjectSamplesPage(org.springframework.ui.Model model, java.security.Principal principal, @PathVariable long projectId)
Get the samples for a given project- Parameters:
model
- A model for the sample list viewprincipal
- The user reading the projectprojectId
- The ID of the project- Returns:
- Name of the project samples list view
-
getProjectSPA
@RequestMapping({"/projects/{projectId}/ncbi","/projects/{projectId}/export","/projects/{projectId}/export/**"}) public java.lang.String getProjectSPA(org.springframework.ui.Model model, java.security.Principal principal, @PathVariable long projectId)
Default page handler for all UI routes loaded through the project SPA endpoint- Parameters:
model
- Default spring modelprincipal
- Currently logged in userprojectId
- Current project id- Returns:
- page that contains the base code for the project SPA
-
getProjectActivityPage
@RequestMapping("/projects/{projectId}/activity") public java.lang.String getProjectActivityPage(@PathVariable java.lang.Long projectId, org.springframework.ui.Model model, java.security.Principal principal)
Request for a specific project details page.- Parameters:
projectId
- The id for the project to show details for.model
- Spring model to populate the html page.principal
- a reference to the logged in user.- Returns:
- The name of the project details page.
-
getSynchronizeProjectPage
@RequestMapping(value="/projects/synchronize", method=GET) public java.lang.String getSynchronizeProjectPage()
Get the page to synchronize remote projects- Returns:
- Name of the project sync page
-
getProjectsSharePage
@RequestMapping("/projects/{projectId}/share") public java.lang.String getProjectsSharePage(@PathVariable java.lang.Long projectId, org.springframework.ui.Model model, java.security.Principal principal)
Get the page to share samples between projects- Parameters:
projectId
- Identifier for the current projectmodel
- Spring model for template variablesprincipal
- Currently logged in user- Returns:
- Path to the template for sharing samples
-
getProjectAnalysisList
@RequestMapping("/projects/{projectId}/analyses/**") public java.lang.String getProjectAnalysisList(@PathVariable java.lang.Long projectId, java.security.Principal principal, org.springframework.ui.Model model)
Get the page for analyses shared with a givenProject
- Parameters:
projectId
- the ID of theProject
principal
- the logged in usermodel
- model for view variables- Returns:
- name of the analysis view page
-
getProjectSettingsPage
@GetMapping("/projects/{projectId}/settings/**") public java.lang.String getProjectSettingsPage(@PathVariable java.lang.Long projectId, java.security.Principal principal, org.springframework.ui.Model model)
Get the project settings page- Parameters:
projectId
- - identifier for theProject
currently being viewedprincipal
- - Currently logged in usedmodel
- Spring UI model- Returns:
- path to the html settings page
-
searchTaxonomy
@RequestMapping("/projects/ajax/taxonomy/search") @ResponseBody public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> searchTaxonomy(@RequestParam java.lang.String searchTerm)
Search for taxonomy terms. This method will return a map of found taxonomy terms and their child nodes.Note: If the search term was not included in the results, it will be added as an option
- Parameters:
searchTerm
- The term to find taxa for- Returns:
- A
List<Map<String,Object>>
which will contain a taxonomic tree of matching terms
-
exportProjectsToFile
@RequestMapping("/projects/ajax/export") public void exportProjectsToFile(@RequestParam("dtf") java.lang.String type, @RequestParam(required=false,defaultValue="false",value="admin") java.lang.Boolean isAdmin, javax.servlet.http.HttpServletResponse response, java.security.Principal principal, java.util.Locale locale) throws java.io.IOException
Export Projects table as either an excel file or CSV- Parameters:
type
- of file to export (csv or excel)isAdmin
- if the currently logged in user is an administratorresponse
-HttpServletResponse
principal
-Principal
locale
-Locale
- Throws:
java.io.IOException
- thrown if cannot open theHttpServletResponse
OutputStream
-
getProjectSamplesMetadataUploadPage
@GetMapping("/projects/{projectId}/sample-metadata/upload/*") public java.lang.String getProjectSamplesMetadataUploadPage(org.springframework.ui.Model model, @PathVariable java.lang.Long projectId, java.security.Principal principal)
Handle the page request to uploadSample
metadata- Parameters:
model
-Model
projectId
-Long
identifier for the currentProject
principal
-Principal
currently logged in use- Returns:
String
the path to the metadata import page
-
roleChangeErrorHandler
@ExceptionHandler(ProjectWithoutOwnerException.class) @ResponseBody public org.springframework.http.ResponseEntity<java.lang.String> roleChangeErrorHandler(java.lang.Exception ex)
Handle aProjectWithoutOwnerException
error. Returns a forbidden error- Parameters:
ex
- the exception to handle.- Returns:
- response entity with FORBIDDEN error
-
-