Class ProjectSamplesMetadataTemplateController


  • @Controller
    @RequestMapping("/projects/{projectId}/metadata-templates")
    public class ProjectSamplesMetadataTemplateController
    extends java.lang.Object
    Handles requests for MetadataTemplates in a Project
    • Method Detail

      • getMetadataTemplateListPage

        @RequestMapping("/new")
        public java.lang.String getMetadataTemplateListPage​(@PathVariable
                                                            java.lang.Long projectId,
                                                            org.springframework.ui.Model model,
                                                            java.security.Principal principal)
        Get the page to create a new MetadataTemplate
        Parameters:
        projectId - Long identifier for a Project
        model - Model spring page model
        principal - Principal currently logged in user
        Returns:
        String path to the new template page
      • getMetadataTemplatePage

        @RequestMapping("/{templateId}")
        public java.lang.String getMetadataTemplatePage​(@PathVariable
                                                        java.lang.Long projectId,
                                                        @PathVariable
                                                        java.lang.Long templateId,
                                                        java.security.Principal principal,
                                                        org.springframework.ui.Model model)
        Get a the page for a specific MetadataTemplate
        Parameters:
        projectId - Long identifier for a Project
        templateId - Long identifier for a MetadataTemplate
        principal - Principal currently logged in user
        model - Model spring page model
        Returns:
        String path to template page
      • saveMetadataTemplate

        @RequestMapping(value="/save",
                        method=POST)
        public java.lang.String saveMetadataTemplate​(@PathVariable
                                                     java.lang.Long projectId,
                                                     @RequestParam
                                                     java.lang.Long id,
                                                     @RequestParam
                                                     java.lang.String name,
                                                     @RequestParam
                                                     java.util.List<java.lang.String> fields)
        Save or update a MetadataTemplate within a Project
        Parameters:
        projectId - Long identifier for a project
        id - Long identifier for a template
        name - String name for the template
        fields - List of fields names
        Returns:
        String result
      • deleteMetadataTemplate

        @RequestMapping(value="/delete/{templateId}",
                        method=POST)
        public java.lang.String deleteMetadataTemplate​(@PathVariable
                                                       java.lang.Long projectId,
                                                       @PathVariable
                                                       java.lang.Long templateId)
        Delete a MetadataTemplate within a Project
        Parameters:
        projectId - Long identifier for a Project
        templateId - Long identifier for a MetadataTemplate
        Returns:
        String redirects to project - settings - metadata templates
      • downloadTemplate

        @RequestMapping("/{templateId}/excel")
        public void downloadTemplate​(@PathVariable
                                     java.lang.Long templateId,
                                     javax.servlet.http.HttpServletResponse response)
                              throws java.io.IOException
        Download a MetadataTemplate as an Excel file.
        Parameters:
        templateId - Long identifier for a MetadataTemplate
        response - HttpServletResponse
        Throws:
        java.io.IOException - thrown if output stream cannot be used.
      • getMetadataKeysForProject

        @RequestMapping("/fields")
        @ResponseBody
        public java.util.List<java.lang.String> getMetadataKeysForProject​(@RequestParam("q")
                                                                          java.lang.String query)
        Search all Metadata keys available for adding to a template.
        Parameters:
        query - the query to search for
        Returns:
        a list of keys matching the query