Package org.dspace.content.authority
Class ChoiceAuthorityServiceImpl
java.lang.Object
org.dspace.content.authority.ChoiceAuthorityServiceImpl
- All Implemented Interfaces:
ChoiceAuthorityService
Broker 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.contributor.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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConfigurationServiceprotected Map<String,ChoiceAuthority> protected Map<String,Map<String, ChoiceAuthority>> protected PluginServiceprotected Map<String,DSpaceControlledVocabularyIndex> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method has been created to have a way of clearing the cache kept inside the serviceprotected Stringconfig2fkey(String field) 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.getChoiceAuthorityByAuthorityName(String authorityName) Return the ChoiceAuthority instance identified by the specified namegetChoiceAuthorityName(String schema, String element, String qualifier, Collection collection) getChoicesByParent(String authorityName, String parentId, int start, int limit, String locale) Wrapper that calls getChoicesByParent method of the plugin.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.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.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.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.getParentChoice(String authorityName, String vocabularyId, String locale) Return the direct parent of an entry identified by its id in an hierarchical authority.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.getTopChoices(String authorityName, int start, int limit, String locale) Wrapper that calls getTopChoices method of the plugin.getVariants(MetadataValue metadataValue, Collection collection) Wrapper to call plugin's getVariants().getVocabularyIndex(String nameVocab) booleanisChoicesConfigured(String fieldKey, Collection collection) Predicate, is there a Choices configuration of any kind for the given metadata field?booleanGet the configured "closed" value for this field.protected StringmakeFieldKey(String schema, String element, String qualifier) booleanstoreAuthority(String fieldKey, Collection collection) Should we store the authority key (if any) for such field key and collection?
-
Field Details
-
controller
-
controllerFormDefinitions
-
presentation
-
closed
-
authorities
-
authoritiesFormDefinitions
-
vocabularyIndexMap
-
configurationService
-
pluginService
-
-
Constructor Details
-
ChoiceAuthorityServiceImpl
protected ChoiceAuthorityServiceImpl()
-
-
Method Details
-
config2fkey
-
getChoiceAuthoritiesNames
- Specified by:
getChoiceAuthoritiesNamesin interfaceChoiceAuthorityService- Returns:
- the names of all the defined choice authorities
-
getMatches
public Choices getMatches(String schema, String element, String qualifier, String query, Collection collection, int start, int limit, String locale) Description copied from interface:ChoiceAuthorityServiceWrapper that calls getMatches method of the plugin corresponding to the metadata field defined by schema,element,qualifier.- Specified by:
getMatchesin interfaceChoiceAuthorityService- 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
public Choices getMatches(String fieldKey, String query, Collection collection, int start, int limit, String locale) Description copied from interface:ChoiceAuthorityServiceWrapper calls getMatches method of the plugin corresponding to the metadata field defined by single field key.- Specified by:
getMatchesin interfaceChoiceAuthorityService- 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
Description copied from interface:ChoiceAuthorityServiceWrapper that calls getBestMatch method of the plugin corresponding to the metadata field defined by single field key.- Specified by:
getBestMatchin interfaceChoiceAuthorityService- 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
Description copied from interface:ChoiceAuthorityServiceWrapper that calls getLabel method of the plugin corresponding to the metadata field defined by schema,element,qualifier.- Specified by:
getLabelin interfaceChoiceAuthorityService- Parameters:
metadataValue- metadata valuecollection- Collection owner of Itemlocale- explicit localization key if available- Returns:
- label
-
getLabel
Description copied from interface:ChoiceAuthorityServiceWrapper that calls getLabel method of the plugin corresponding to the metadata field defined by single field key.- Specified by:
getLabelin interfaceChoiceAuthorityService- Parameters:
fieldKey- single string identifying metadata fieldcollection- Collection owner of ItemauthKey- authority keylocale- explicit localization key if available- Returns:
- label
-
isChoicesConfigured
Description copied from interface:ChoiceAuthorityServicePredicate, is there a Choices configuration of any kind for the given metadata field?- Specified by:
isChoicesConfiguredin interfaceChoiceAuthorityService- Parameters:
fieldKey- single string identifying metadata fieldcollection- Collection owner of Item- Returns:
- true if choices are configured for this field.
-
getPresentation
Description copied from interface:ChoiceAuthorityServiceGet the presentation keyword (should be "lookup", "select" or "suggest", but this is an informal convention so it can be easily extended) for this field.- Specified by:
getPresentationin interfaceChoiceAuthorityService- Parameters:
fieldKey- field key- Returns:
- configured presentation type for this field, or null if none found
-
isClosed
Description copied from interface:ChoiceAuthorityServiceGet the configured "closed" value for this field.- Specified by:
isClosedin interfaceChoiceAuthorityService- Parameters:
fieldKey- single string identifying metadata field- Returns:
- true if choices are closed for this field.
-
getVariants
Description copied from interface:ChoiceAuthorityServiceWrapper to call plugin's getVariants().- Specified by:
getVariantsin interfaceChoiceAuthorityService- Parameters:
metadataValue- metadata value- Returns:
- List of variants
-
getChoiceAuthorityName
public String getChoiceAuthorityName(String schema, String element, String qualifier, Collection collection) - Specified by:
getChoiceAuthorityNamein interfaceChoiceAuthorityService- 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
-
makeFieldKey
-
clearCache
Description copied from interface:ChoiceAuthorityServiceThis method has been created to have a way of clearing the cache kept inside the service- Specified by:
clearCachein interfaceChoiceAuthorityService- Throws:
SubmissionConfigReaderException
-
getChoiceAuthorityByAuthorityName
Description copied from interface:ChoiceAuthorityServiceReturn the ChoiceAuthority instance identified by the specified name- Specified by:
getChoiceAuthorityByAuthorityNamein interfaceChoiceAuthorityService- Parameters:
authorityName- the ChoiceAuthority instance name- Returns:
- the ChoiceAuthority identified by the specified name
-
storeAuthority
Description copied from interface:ChoiceAuthorityServiceShould we store the authority key (if any) for such field key and collection?- Specified by:
storeAuthorityin interfaceChoiceAuthorityService- 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
public Choices getChoicesByParent(String authorityName, String parentId, int start, int limit, String locale) Wrapper that calls getChoicesByParent method of the plugin.- Specified by:
getChoicesByParentin interfaceChoiceAuthorityService- 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
Wrapper that calls getTopChoices method of the plugin.- Specified by:
getTopChoicesin interfaceChoiceAuthorityService- 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
Description copied from interface:ChoiceAuthorityServiceReturn the direct parent of an entry identified by its id in an hierarchical authority.- Specified by:
getParentChoicein interfaceChoiceAuthorityService- Parameters:
authorityName- authority namevocabularyId- child idlocale- explicit localization key if available, or null- Returns:
- the parent Choice object if any
-
getVocabularyIndex
- Specified by:
getVocabularyIndexin interfaceChoiceAuthorityService
-