Interface MetadataTemplateService
-
- All Superinterfaces:
CRUDService<java.lang.Long,MetadataTemplate>
- All Known Implementing Classes:
MetadataTemplateServiceImpl
public interface MetadataTemplateService extends CRUDService<java.lang.Long,MetadataTemplate>
Service for managingMetadataTemplate
s and relatedProject
s
-
-
Method Summary
-
Methods inherited from interface ca.corefacility.bioinformatics.irida.service.CRUDService
count, create, delete, exists, findAll, findRevisions, findRevisions, list, list, list, read, readMultiple, search, search, update, updateFields, updateMultiple
-
-
-
-
Method Detail
-
createMetadataTemplateInProject
MetadataTemplate createMetadataTemplateInProject(MetadataTemplate template, Project project)
Create a newMetadataTemplate
for aProject
- Parameters:
template
- theMetadataTemplate
to createproject
- theProject
to create the template in- Returns:
- a
MetadataTemplate
-
deleteMetadataTemplateFromProject
void deleteMetadataTemplateFromProject(Project project, java.lang.Long id)
Deleta aMetadataTemplate
from aProject
- Parameters:
project
- theProject
to template lives in.id
- theLong
identifier for aMetadataTemplate
-
updateMetadataTemplateInProject
MetadataTemplate updateMetadataTemplateInProject(MetadataTemplate metadataTemplate)
Update aMetadataTemplate
within aProject
- Parameters:
metadataTemplate
-MetadataTemplate
- Returns:
MetadataTemplate
-
getMetadataTemplatesForProject
java.util.List<MetadataTemplate> getMetadataTemplatesForProject(Project project)
Get a list ofMetadataTemplate
s for a givenProject
- Parameters:
project
- theProject
- Returns:
- a list of
MetadataTemplate
-
readMetadataField
MetadataTemplateField readMetadataField(java.lang.Long id)
Get aMetadataTemplateField
by itsLong
identifier- Parameters:
id
-Long
identifier for aMetadataTemplateField
- Returns:
MetadataTemplateField
-
readMetadataFieldByLabel
MetadataTemplateField readMetadataFieldByLabel(java.lang.String label)
Get aMetadataTemplateField
by itsString
label- Parameters:
label
- theString
label for theMetadataTemplateField
.- Returns:
MetadataTemplateField
-
readMetadataFieldByKey
MetadataTemplateField readMetadataFieldByKey(java.lang.String key)
Read aMetadataTemplateField
by its key- Parameters:
key
- key for the field- Returns:
- a
MetadataTemplateField
-
getStaticMetadataFields
java.util.List<StaticMetadataTemplateField> getStaticMetadataFields()
Get a list of allStaticMetadataTemplateField
s available- Returns:
- a list of
StaticMetadataTemplateField
-
saveMetadataField
MetadataTemplateField saveMetadataField(MetadataTemplateField field)
Save a new metadata fields- Parameters:
field
- theMetadataTemplateField
to save.- Returns:
- the saved
MetadataTemplateField
-
getAllMetadataFieldsByQueryString
java.util.List<MetadataTemplateField> getAllMetadataFieldsByQueryString(java.lang.String query)
Get a list of allMetadataTemplateField
s that contain the query- Parameters:
query
- theString
to search labels for.- Returns:
List
ofMetadataTemplateField
-
convertMetadataStringsToSet
java.util.Set<MetadataEntry> convertMetadataStringsToSet(java.util.Map<java.lang.String,MetadataEntry> metadataMap)
Get the appropriateMetadataTemplateField
s andMetadataEntry
s for a given map of Strings- Parameters:
metadataMap
- the strings to convert- Returns:
- a Set of
MetadataEntry
s
-
getMetadataFieldsForProject
@Deprecated java.util.List<MetadataTemplateField> getMetadataFieldsForProject(Project project)
Deprecated.Get all theMetadataTemplateField
s on a givenProject
- Parameters:
project
- the Project to get fields for- Returns:
- a list of fields
-
getMetadataRestrictionForFieldAndProject
MetadataRestriction getMetadataRestrictionForFieldAndProject(Project project, MetadataTemplateField field)
- Parameters:
project
- theProject
to get the restriction forfield
- theMetadataTemplateField
to get the restriction for- Returns:
- The found
MetadataRestriction
. If there is no restriction defined, this may be null
-
getMetadataRestrictionsForProject
java.util.List<MetadataRestriction> getMetadataRestrictionsForProject(Project project)
List all theMetadataRestriction
for the givenProject
- Parameters:
project
- theProject
the Project to get restrictions for- Returns:
- a List of all defined
MetadataRestriction
-
setMetadataRestriction
MetadataRestriction setMetadataRestriction(Project project, MetadataTemplateField field, ProjectMetadataRole role)
Adds or updates theMetadataRestriction
for a project and field- Parameters:
project
- theProject
to add a restriction forfield
- the field to set a restriction onrole
- the role level to set the restriction for- Returns:
- the created
MetadataRestriction
-
getPermittedFieldsForTemplate
java.util.List<MetadataTemplateField> getPermittedFieldsForTemplate(MetadataTemplate template)
Get allMetadataTemplateField
the current user is allowed to read for aMetadataTemplate
- Parameters:
template
- theMetadataTemplate
to get fields for- Returns:
- a list of
MetadataTemplateField
-
getPermittedFieldsForCurrentUser
java.util.List<MetadataTemplateField> getPermittedFieldsForCurrentUser(Project project, boolean includeTemplateFields)
Get allMetadataTemplateField
that the currently logged in user is allowed to read- Parameters:
project
- theProject
to request fields fromincludeTemplateFields
- whether to include fields from the project's associatedMetadataTemplate
s- Returns:
- a list of
MetadataTemplateField
collecting the allowedMetadataTemplateField
-
getDefaultTemplateForProject
MetadataTemplate getDefaultTemplateForProject(Project project)
Get the defaultMetadataTemplate
for the givenProject
(if one exists)- Parameters:
project
- theProject
to get the template for- Returns:
- the default
MetadataTemplate
if one is set
-
updateDefaultMetadataTemplateForProject
MetadataTemplate updateDefaultMetadataTemplateForProject(Project project, MetadataTemplate template)
Update whichMetadataTemplate
is the default for the givenProject
- Parameters:
project
- theProject
to set a template ontemplate
- theMetadataTemplate
to set- Returns:
- the new default
MetadataTemplate
-
removeDefaultMetadataTemplateForProject
void removeDefaultMetadataTemplateForProject(Project project)
Remove the defaultMetadataTemplate
from the project. It will now use all fields as default- Parameters:
project
- theProject
to remove the template from
-
-