Class MetadataAjaxController


  • @RestController
    @RequestMapping("/ajax/metadata")
    public class MetadataAjaxController
    extends java.lang.Object
    Ajax controller for project metadata templates.
    • Constructor Detail

      • MetadataAjaxController

        @Autowired
        public MetadataAjaxController​(UIMetadataService service)
    • Method Detail

      • getProjectMetadataTemplates

        @GetMapping("/templates")
        public org.springframework.http.ResponseEntity<java.util.List<ProjectMetadataTemplate>> getProjectMetadataTemplates​(@RequestParam
                                                                                                                            java.lang.Long projectId)
        Get a list of metadata templates for a specific project
        Parameters:
        projectId - Identifier for the project to get templates for.
        Returns:
        List of metadata templates with associated details.
      • createNewMetadataTemplate

        @PostMapping("/templates")
        public org.springframework.http.ResponseEntity<ProjectMetadataTemplate> createNewMetadataTemplate​(@RequestBody
                                                                                                          MetadataTemplate template,
                                                                                                          @RequestParam
                                                                                                          java.lang.Long projectId)
        Create a new metadata template within a project
        Parameters:
        template - details about the template to create
        projectId - identifier for a project
        Returns:
        the newly created MetadataTemplate
      • updateMetadataTemplate

        @PutMapping("/templates/{templateId}")
        public org.springframework.http.ResponseEntity<AjaxResponse> updateMetadataTemplate​(@RequestBody
                                                                                            MetadataTemplate template,
                                                                                            java.util.Locale locale)
        Updated the fields in a MetadataTemplate
        Parameters:
        template - the updated template to save
        locale - Current users Locale
        Returns:
        Message for UI to display about the result of the update.
      • deleteMetadataTemplate

        @DeleteMapping("/templates/{templateId}")
        public org.springframework.http.ResponseEntity<AjaxResponse> deleteMetadataTemplate​(@PathVariable
                                                                                            java.lang.Long templateId,
                                                                                            @RequestParam
                                                                                            java.lang.Long projectId,
                                                                                            java.util.Locale locale)
        Delete a metadata template from the project
        Parameters:
        templateId - Identifier for a MetadataTemplate
        projectId - Identifier for the current project
        locale - Current users Locale
        Returns:
        Message for UI about the result
      • getMetadataFieldsForProject

        @GetMapping("/fields")
        public java.util.List<ProjectMetadataField> getMetadataFieldsForProject​(@RequestParam
                                                                                java.lang.Long projectId)
        Get all the metadata fields in a project
        Parameters:
        projectId - Identifier for a project
        Returns:
        list of MetadataTemplateFields
      • getMetadataFieldsForProjects

        @GetMapping("/fields/projects")
        public java.util.List<ProjectMetadataField> getMetadataFieldsForProjects​(@RequestParam(name="projectIds")
                                                                                 java.util.List<java.lang.Long> projectIds)
        Get all the metadata fields for a list of projects
        Parameters:
        projectIds - Identifier for a projects
        Returns:
        list of MetadataTemplateFields
      • setDefaultMetadataTemplate

        @PostMapping("/templates/{templateId}/set-project-default")
        public org.springframework.http.ResponseEntity<AjaxResponse> setDefaultMetadataTemplate​(@PathVariable
                                                                                                java.lang.Long templateId,
                                                                                                @RequestParam
                                                                                                java.lang.Long projectId,
                                                                                                java.util.Locale locale)
        Set a default metadata template for a project
        Parameters:
        templateId - Identifier for the metadata template to set as default.
        projectId - Identifier for the project to set the metadata template as default for.
        locale - Current users Locale
        Returns:
        AjaxSuccessResponse with the success message
      • getMetadataRestrictions

        @GetMapping("/fields/restrictions")
        public java.util.List<SelectOption> getMetadataRestrictions​(java.util.Locale locale)
        Get the list of all metadata restrictions that belong to the current project.
        Parameters:
        locale - Current users Locale
        Returns:
        List of metadata fields restrictions
      • updateProjectMetadataFieldRestriction

        @PatchMapping("/fields/restrictions")
        public org.springframework.http.ResponseEntity<AjaxResponse> updateProjectMetadataFieldRestriction​(@RequestParam
                                                                                                           java.lang.Long projectId,
                                                                                                           @RequestParam
                                                                                                           java.lang.Long fieldId,
                                                                                                           @RequestParam
                                                                                                           ProjectMetadataRole projectRole,
                                                                                                           java.util.Locale locale)
        Update a restriction level on a metadata field for a project
        Parameters:
        projectId - Identifier for the project
        fieldId - Identifier for the metadata field
        projectRole - New project role to set the field to
        locale - Current users Locale
        Returns:
        Message to user on the status of the update
      • getProjectMetadataRoles

        @RequestMapping("/roles")
        public org.springframework.http.ResponseEntity<java.util.List<Role>> getProjectMetadataRoles​(java.util.Locale locale)
        Get a list of all metadata roles
        Parameters:
        locale - Locale of the current user
        Returns:
        list of metadata roles and their internationalizes text values