Class ProjectsController


  • @Controller
    @Scope("session")
    public class ProjectsController
    extends java.lang.Object
    Controller for project related views
    • 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 CSV
      java.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 given Project
      java.lang.String getProjectSamplesMetadataUploadPage​(org.springframework.ui.Model model, java.lang.Long projectId, java.security.Principal principal)
      Handle the page request to upload Sample metadata
      java.lang.String getProjectSamplesPage​(org.springframework.ui.Model model, java.security.Principal principal, long projectId)
      Get the samples for a given project
      java.lang.String getProjectSettingsPage​(java.lang.Long projectId, java.security.Principal principal, org.springframework.ui.Model model)
      Get the project settings page
      java.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 endpoint
      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.
      java.lang.String getProjectsSharePage​(java.lang.Long projectId, org.springframework.ui.Model model, java.security.Principal principal)
      Get the page to share samples between projects
      java.lang.String getSynchronizeProjectPage()
      Get the page to synchronize remote projects
      org.springframework.http.ResponseEntity<java.lang.String> roleChangeErrorHandler​(java.lang.Exception ex)
      java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> searchTaxonomy​(java.lang.String searchTerm)
      Search for taxonomy terms.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 view
        principal - The user reading the project
        projectId - 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 model
        principal - Currently logged in user
        projectId - 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 project
        model - Spring model for template variables
        principal - 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 given Project
        Parameters:
        projectId - the ID of the Project
        principal - the logged in user
        model - 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 the Project currently being viewed
        principal - - Currently logged in used
        model - 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 administrator
        response - HttpServletResponse
        principal - Principal
        locale - Locale
        Throws:
        java.io.IOException - thrown if cannot open the HttpServletResponse 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 upload Sample metadata
        Parameters:
        model - Model
        projectId - Long identifier for the current Project
        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 a ProjectWithoutOwnerException error. Returns a forbidden error
        Parameters:
        ex - the exception to handle.
        Returns:
        response entity with FORBIDDEN error