Class UIMetadataService
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.ria.web.services.UIMetadataService
-
@Component public class UIMetadataService extends java.lang.Object
Service for Metadata Templates in the user interface
-
-
Constructor Summary
Constructors Constructor Description UIMetadataService(ProjectService projectService, MetadataTemplateService templateService, org.springframework.context.MessageSource messageSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProjectMetadataTemplate
createMetadataTemplate(MetadataTemplate template, java.lang.Long projectId)
Create a newMetadataTemplate
within aProject
java.lang.String
deleteMetadataTemplate(java.lang.Long templateId, java.lang.Long projectId, java.util.Locale locale)
Remove aMetadataTemplate
from aProject
java.util.List<SelectOption>
getMetadataFieldRestrictions(java.util.Locale locale)
Get the list of all metadata restrictions that belong to the current project.java.util.List<ProjectMetadataField>
getMetadataFieldsForProject(java.lang.Long projectId)
Get allMetadataTemplateField
s belonging to aProject
java.util.List<ProjectMetadataField>
getMetadataFieldsForProjects(java.util.List<java.lang.Long> projectIds)
Get allMetadataTemplateField
s belonging to a list ofProject
sjava.util.List<Role>
getProjectMetadataRoles(java.util.Locale locale)
Get a list of all metadata rolesjava.util.List<ProjectMetadataTemplate>
getProjectMetadataTemplates(java.lang.Long projectId)
Get a list ofMetadataTemplate
for a specificProject
java.lang.String
setDefaultMetadataTemplate(java.lang.Long templateId, java.lang.Long projectId, java.util.Locale locale)
Set the defaultMetadataTemplate
for aProject
java.lang.String
updateMetadataProjectField(java.lang.Long projectId, java.lang.Long fieldId, ProjectMetadataRole newRole, java.util.Locale locale)
Update a restriction level on a metadata field for a projectjava.lang.String
updateMetadataTemplate(MetadataTemplate template, java.util.Locale locale)
Update details within aMetadataTemplate
-
-
-
Constructor Detail
-
UIMetadataService
@Autowired public UIMetadataService(ProjectService projectService, MetadataTemplateService templateService, org.springframework.context.MessageSource messageSource)
-
-
Method Detail
-
getProjectMetadataTemplates
public java.util.List<ProjectMetadataTemplate> getProjectMetadataTemplates(java.lang.Long projectId)
Get a list ofMetadataTemplate
for a specificProject
- Parameters:
projectId
- Identifier for aProject
- Returns:
List
ofMetadataTemplate
-
createMetadataTemplate
public ProjectMetadataTemplate createMetadataTemplate(MetadataTemplate template, java.lang.Long projectId)
Create a newMetadataTemplate
within aProject
- Parameters:
template
- Details about theMetadataTemplate
to createprojectId
- Identifier for theProject
to add them template to- Returns:
MetadataTemplate
-
updateMetadataTemplate
public java.lang.String updateMetadataTemplate(MetadataTemplate template, java.util.Locale locale) throws java.lang.Exception
Update details within aMetadataTemplate
- Parameters:
template
- UpdatedMetadataTemplate
to savelocale
- Current usersLocale
- Returns:
- text to display to the user about the result of the update
- Throws:
java.lang.Exception
- if there is an error updating the template
-
deleteMetadataTemplate
public java.lang.String deleteMetadataTemplate(java.lang.Long templateId, java.lang.Long projectId, java.util.Locale locale) throws java.lang.Exception
Remove aMetadataTemplate
from aProject
- Parameters:
templateId
- Identifier for aMetadataTemplate
to removeprojectId
- Identifier for aProject
locale
- Current usersLocale
- Returns:
- text to display to the user about the result of removing the template
- Throws:
java.lang.Exception
- if there is an error deleting the template
-
getMetadataFieldsForProject
public java.util.List<ProjectMetadataField> getMetadataFieldsForProject(java.lang.Long projectId)
Get allMetadataTemplateField
s belonging to aProject
- Parameters:
projectId
- Identifier for aProject
- Returns:
- List of
ProjectMetadataField
-
getMetadataFieldsForProjects
public java.util.List<ProjectMetadataField> getMetadataFieldsForProjects(java.util.List<java.lang.Long> projectIds)
Get allMetadataTemplateField
s belonging to a list ofProject
s- Parameters:
projectIds
- Identifiers for aProject
s- Returns:
- List of
ProjectMetadataField
-
getMetadataFieldRestrictions
public java.util.List<SelectOption> getMetadataFieldRestrictions(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
-
updateMetadataProjectField
public java.lang.String updateMetadataProjectField(java.lang.Long projectId, java.lang.Long fieldId, ProjectMetadataRole newRole, 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 fieldnewRole
- New project role to set the field tolocale
- Current usersLocale
- Returns:
- Message to user on the status of the update
-
setDefaultMetadataTemplate
public java.lang.String setDefaultMetadataTemplate(java.lang.Long templateId, java.lang.Long projectId, java.util.Locale locale) throws java.lang.Exception
Set the defaultMetadataTemplate
for aProject
- Parameters:
templateId
- Identifier for aMetadataTemplate
projectId
- Identifier for aProject
locale
- Current usersLocale
- Returns:
- text to display to user about the result of updating the default metadata template
- Throws:
java.lang.Exception
- if there is an error updating the default metadata template for a project
-
getProjectMetadataRoles
public java.util.List<Role> getProjectMetadataRoles(java.util.Locale locale)
Get a list of all metadata roles- Parameters:
locale
- current usersLocale
- Returns:
- List of metadata roles that are available to the suer
-
-