Interface ChoiceAuthorityService
-
- All Known Implementing Classes:
ChoiceAuthorityServiceImpl
public interface ChoiceAuthorityServiceBroker for ChoiceAuthority plugins, and for other information configured about the choice aspect of authority control for a metadata field. Configuration keys, per metadata field (e.g. "dc.contributer.author")# names the ChoiceAuthority plugin called for this field choices.plugin.<FIELD> = name-of-plugin # mode of UI presentation desired in submission UI: # "select" is dropdown menu, "lookup" is popup with selector, "suggest" is autocomplete/suggest choices.presentation.<FIELD> = "select" | "suggest" # is value "closed" to the set of these choices or are non-authority values permitted? choices.closed.<FIELD> = true | false- Author:
- Larry Stone
- See Also:
ChoiceAuthority
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclearCache()This method has been created to have a way of clearing the cache kept inside the serviceChoicesgetBestMatch(String fieldKey, String query, Collection collection, String locale)Wrapper that calls getBestMatch method of the plugin corresponding to the metadata field defined by single field key.Set<String>getChoiceAuthoritiesNames()ChoiceAuthoritygetChoiceAuthorityByAuthorityName(String authorityName)Return the ChoiceAuthority instance identified by the specified nameStringgetChoiceAuthorityName(String schema, String element, String qualifier, Collection collection)ChoicesgetChoicesByParent(String authorityName, String parentId, int start, int limit, String locale)Wrapper that calls getChoicesByParent method of the plugin.StringgetLabel(String fieldKey, Collection collection, String authKey, String locale)Wrapper that calls getLabel method of the plugin corresponding to the metadata field defined by single field key.StringgetLabel(MetadataValue metadataValue, Collection collection, String locale)Wrapper that calls getLabel method of the plugin corresponding to the metadata field defined by schema,element,qualifier.ChoicesgetMatches(String schema, String element, String qualifier, String query, Collection collection, int start, int limit, String locale)Wrapper that calls getMatches method of the plugin corresponding to the metadata field defined by schema,element,qualifier.ChoicesgetMatches(String fieldKey, String query, Collection collection, int start, int limit, String locale)Wrapper calls getMatches method of the plugin corresponding to the metadata field defined by single field key.ChoicegetParentChoice(String authorityName, String vocabularyId, String locale)Return the direct parent of an entry identified by its id in an hierarchical authority.StringgetPresentation(String fieldKey)Get the presentation keyword (should be "lookup", "select" or "suggest", but this is an informal convention so it can be easily extended) for this field.ChoicesgetTopChoices(String authorityName, int start, int limit, String locale)Wrapper that calls getTopChoices method of the plugin.List<String>getVariants(MetadataValue metadataValue, Collection collection)Wrapper to call plugin's getVariants().DSpaceControlledVocabularyIndexgetVocabularyIndex(String nameVocab)booleanisChoicesConfigured(String fieldKey, Collection collection)Predicate, is there a Choices configuration of any kind for the given metadata field?booleanisClosed(String fieldKey)Get the configured "closed" value for this field.booleanstoreAuthority(String fieldKey, Collection collection)Should we store the authority key (if any) for such field key and collection?
-
-
-
Method Detail
-
getChoiceAuthoritiesNames
Set<String> getChoiceAuthoritiesNames()
- Returns:
- the names of all the defined choice authorities
-
getChoiceAuthorityName
String getChoiceAuthorityName(String schema, String element, String qualifier, Collection collection)
- Parameters:
schema- schema of metadata fieldelement- element of metadata fieldqualifier- qualifier of metadata field- Returns:
- the name of the choice authority associated with the specified metadata. Throw IllegalArgumentException if the supplied metadata is not associated with an authority choice
-
getMatches
Choices getMatches(String schema, String element, String qualifier, String query, Collection collection, int start, int limit, String locale)
Wrapper that calls getMatches method of the plugin corresponding to the metadata field defined by schema,element,qualifier.- Parameters:
schema- schema of metadata fieldelement- element of metadata fieldqualifier- qualifier of metadata fieldquery- user's value to matchcollection- database ID of Collection for context (owner of Item)start- choice at which to start, 0 is first.limit- maximum number of choices to return, 0 for no limit.locale- explicit localization key if available, or null- Returns:
- a Choices object (never null).
- See Also:
org.dspace.content.authority.ChoiceAuthority#getMatches(java.lang.String, java.lang.String, org.dspace .content.Collection, int, int, java.lang.String)
-
getMatches
Choices getMatches(String fieldKey, String query, Collection collection, int start, int limit, String locale)
Wrapper calls getMatches method of the plugin corresponding to the metadata field defined by single field key.- Parameters:
fieldKey- single string identifying metadata fieldquery- user's value to matchcollection- database ID of Collection for context (owner of Item)start- choice at which to start, 0 is first.limit- maximum number of choices to return, 0 for no limit.locale- explicit localization key if available, or null- Returns:
- a Choices object (never null).
- See Also:
org.dspace.content.authority.ChoiceAuthority#getMatches(java.lang.String, java.lang.String, org.dspace .content.Collection, int, int, java.lang.String)
-
getBestMatch
Choices getBestMatch(String fieldKey, String query, Collection collection, String locale)
Wrapper that calls getBestMatch method of the plugin corresponding to the metadata field defined by single field key.- Parameters:
fieldKey- single string identifying metadata fieldquery- user's value to matchcollection- database ID of Collection for context (owner of Item)locale- explicit localization key if available, or null- Returns:
- a Choices object (never null) with 1 or 0 values.
- See Also:
org.dspace.content.authority.ChoiceAuthority#getBestMatch(java.lang.String, java.lang.String, org.dspace .content.Collection, java.lang.String)
-
getLabel
String getLabel(MetadataValue metadataValue, Collection collection, String locale)
Wrapper that calls getLabel method of the plugin corresponding to the metadata field defined by schema,element,qualifier.- Parameters:
metadataValue- metadata valuecollection- Collection owner of Itemlocale- explicit localization key if available- Returns:
- label
-
getLabel
String getLabel(String fieldKey, Collection collection, String authKey, String locale)
Wrapper that calls getLabel method of the plugin corresponding to the metadata field defined by single field key.- Parameters:
fieldKey- single string identifying metadata fieldcollection- Collection owner of Itemlocale- explicit localization key if availableauthKey- authority key- Returns:
- label
-
isChoicesConfigured
boolean isChoicesConfigured(String fieldKey, Collection collection)
Predicate, is there a Choices configuration of any kind for the given metadata field?- Parameters:
fieldKey- single string identifying metadata fieldcollection- Collection owner of Item- Returns:
- true if choices are configured for this field.
-
getPresentation
String getPresentation(String fieldKey)
Get the presentation keyword (should be "lookup", "select" or "suggest", but this is an informal convention so it can be easily extended) for this field.- Parameters:
fieldKey- field key- Returns:
- configured presentation type for this field, or null if none found
-
isClosed
boolean isClosed(String fieldKey)
Get the configured "closed" value for this field.- Parameters:
fieldKey- single string identifying metadata field- Returns:
- true if choices are closed for this field.
-
getVariants
List<String> getVariants(MetadataValue metadataValue, Collection collection)
Wrapper to call plugin's getVariants().- Parameters:
metadataValue- metadata value- Returns:
- List of variants
-
getChoiceAuthorityByAuthorityName
ChoiceAuthority getChoiceAuthorityByAuthorityName(String authorityName)
Return the ChoiceAuthority instance identified by the specified name- Parameters:
authorityName- the ChoiceAuthority instance name- Returns:
- the ChoiceAuthority identified by the specified name
-
clearCache
void clearCache() throws SubmissionConfigReaderExceptionThis method has been created to have a way of clearing the cache kept inside the service- Throws:
SubmissionConfigReaderException
-
storeAuthority
boolean storeAuthority(String fieldKey, Collection collection)
Should we store the authority key (if any) for such field key and collection?- Parameters:
fieldKey- single string identifying metadata fieldcollection- Collection owner of Item or where the item is submitted to- Returns:
- true if the configuration allows to store the authority value
-
getChoicesByParent
Choices getChoicesByParent(String authorityName, String parentId, int start, int limit, String locale)
Wrapper that calls getChoicesByParent method of the plugin.- Parameters:
authorityName- authority nameparentId- parent Idstart- choice at which to start, 0 is first.limit- maximum number of choices to return, 0 for no limit.locale- explicit localization key if available, or null- Returns:
- a Choices object (never null).
- See Also:
org.dspace.content.authority.ChoiceAuthority#getChoicesByParent(java.lang.String, java.lang.String, int, int, java.lang.String)
-
getTopChoices
Choices getTopChoices(String authorityName, int start, int limit, String locale)
Wrapper that calls getTopChoices method of the plugin.- Parameters:
authorityName- authority namestart- choice at which to start, 0 is first.limit- maximum number of choices to return, 0 for no limit.locale- explicit localization key if available, or null- Returns:
- a Choices object (never null).
- See Also:
org.dspace.content.authority.ChoiceAuthority#getTopChoices(java.lang.String, int, int, java.lang.String)
-
getParentChoice
Choice getParentChoice(String authorityName, String vocabularyId, String locale)
Return the direct parent of an entry identified by its id in an hierarchical authority.- Parameters:
authorityName- authority namevocabularyId- child idlocale- explicit localization key if available, or null- Returns:
- the parent Choice object if any
-
getVocabularyIndex
DSpaceControlledVocabularyIndex getVocabularyIndex(String nameVocab)
-
-