Class MetadataAjaxController
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.ria.web.ajax.metadata.MetadataAjaxController
-
@RestController @RequestMapping("/ajax/metadata") public class MetadataAjaxController extends java.lang.Object
Ajax controller for project metadata templates.
-
-
Constructor Summary
Constructors Constructor Description MetadataAjaxController(UIMetadataService service)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<ProjectMetadataTemplate>
createNewMetadataTemplate(MetadataTemplate template, java.lang.Long projectId)
Create a new metadata template within a projectorg.springframework.http.ResponseEntity<AjaxResponse>
deleteMetadataTemplate(java.lang.Long templateId, java.lang.Long projectId, java.util.Locale locale)
Delete a metadata template from the projectjava.util.List<ProjectMetadataField>
getMetadataFieldsForProject(java.lang.Long projectId)
Get all the metadata fields in a projectjava.util.List<ProjectMetadataField>
getMetadataFieldsForProjects(java.util.List<java.lang.Long> projectIds)
Get all the metadata fields for a list of projectsjava.util.List<SelectOption>
getMetadataRestrictions(java.util.Locale locale)
Get the list of all metadata restrictions that belong to the current project.org.springframework.http.ResponseEntity<java.util.List<Role>>
getProjectMetadataRoles(java.util.Locale locale)
Get a list of all metadata rolesorg.springframework.http.ResponseEntity<java.util.List<ProjectMetadataTemplate>>
getProjectMetadataTemplates(java.lang.Long projectId)
Get a list of metadata templates for a specific projectorg.springframework.http.ResponseEntity<AjaxResponse>
setDefaultMetadataTemplate(java.lang.Long templateId, java.lang.Long projectId, java.util.Locale locale)
Set a default metadata template for a projectorg.springframework.http.ResponseEntity<AjaxResponse>
updateMetadataTemplate(MetadataTemplate template, java.util.Locale locale)
Updated the fields in aMetadataTemplate
org.springframework.http.ResponseEntity<AjaxResponse>
updateProjectMetadataFieldRestriction(java.lang.Long projectId, java.lang.Long fieldId, ProjectMetadataRole projectRole, java.util.Locale locale)
Update a restriction level on a metadata field for a project
-
-
-
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 createprojectId
- 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 aMetadataTemplate
- Parameters:
template
- the updated template to savelocale
- Current usersLocale
- 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 aMetadataTemplate
projectId
- Identifier for the current projectlocale
- Current usersLocale
- 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
MetadataTemplateField
s
-
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
MetadataTemplateField
s
-
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 usersLocale
- 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 usersLocale
- 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 projectfieldId
- Identifier for the metadata fieldprojectRole
- New project role to set the field tolocale
- Current usersLocale
- 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
-
-