Interface ChoiceAuthorityService

  • All Known Implementing Classes:
    ChoiceAuthorityServiceImpl

    public interface 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.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 Detail

      • getChoiceAuthoritiesNames

        Set<String> getChoiceAuthoritiesNames()
        Returns:
        the names of all the defined choice authorities
      • getChoiceAuthorityName

        String getChoiceAuthorityName​(String schema,
                                      String element,
                                      String qualifier)
        Parameters:
        schema - schema of metadata field
        element - element of metadata field
        qualifier - qualifier of metadata field
        Returns:
        the name of the choice authority associated with the specified metadata. Throw IllegalArgumentException if the supplied metadat 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 field
        element - element of metadata field
        qualifier - qualifier of metadata field
        query - user's value to match
        collection - 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:
        ChoiceAuthority.getMatches(java.lang.String, java.lang.String, org.dspace .content.Collection, int, int, java.lang.String)
      • getLabel

        String getLabel​(MetadataValue metadataValue,
                        String locale)
        Wrapper that calls getLabel method of the plugin corresponding to the metadata field defined by schema,element,qualifier.
        Parameters:
        metadataValue - metadata value
        locale - explicit localization key if available
        Returns:
        label
      • getLabel

        String getLabel​(String fieldKey,
                        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 field
        locale - explicit localization key if available
        authKey - authority key
        Returns:
        label
      • isChoicesConfigured

        boolean isChoicesConfigured​(String fieldKey)
        Predicate, is there a Choices configuration of any kind for the given metadata field?
        Parameters:
        fieldKey - single string identifying metadata field
        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)
        Wrapper to call plugin's getVariants().
        Parameters:
        metadataValue - metadata value
        Returns:
        List of variants
      • getChoiceMetadatabyAuthorityName

        String getChoiceMetadatabyAuthorityName​(String name)
      • getChoiceAuthorityByAuthorityName

        ChoiceAuthority getChoiceAuthorityByAuthorityName​(String authorityName)
      • clearCache

        void clearCache()
        This method has been created to have a way of clearing the cache kept inside the service