org.dspace.content.authority
Class ChoiceAuthorityManager

java.lang.Object
  extended by org.dspace.content.authority.ChoiceAuthorityManager

public class ChoiceAuthorityManager
extends Object

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. = 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. = "select" | "suggest" # is value "closed" to the set of these choices or are non-authority values permitted? choices.closed. = true | false

Author:
Larry Stone
See Also:
ChoiceAuthority

Method Summary
 Choices getBestMatch(String fieldKey, String query, int collection, String locale)
          Wrapper that calls getBestMatch method of the plugin corresponding to the metadata field defined by single field key.
 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.
 String getLabel(String schema, String element, String qualifier, String authKey, String locale)
          Wrapper that calls getLabel method of the plugin corresponding to the metadata field defined by schema,element,qualifier.
static ChoiceAuthorityManager getManager()
          Factory method
 Choices getMatches(String fieldKey, String query, int collection, int start, int limit, String locale)
          Wrapper calls getMatches method of the plugin corresponding to the metadata field defined by single field key.
 Choices getMatches(String schema, String element, String qualifier, String query, int 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.
 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.
 List<String> getVariants(String schema, String element, String qualifier, String authorityKey, String language)
          Wrapper to call plugin's getVariants().
 boolean isChoicesConfigured(String fieldKey)
          Predicate, is there a Choices configuration of any kind for the given metadata field?
 boolean isClosed(String fieldKey)
          Get the configured "closed" value for this field.
static String makeFieldKey(String dotty)
          Construct a single key from the "dot" notation e.g.
static String makeFieldKey(String schema, String element, String qualifier)
          Construct a single key from the tuple of schema/element/qualifier that describes a metadata field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getManager

public static ChoiceAuthorityManager getManager()
Factory method


getMatches

public Choices getMatches(String schema,
                          String element,
                          String qualifier,
                          String query,
                          int 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
text - 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

getMatches

public Choices getMatches(String fieldKey,
                          String query,
                          int 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 field
text - 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

getBestMatch

public Choices getBestMatch(String fieldKey,
                            String query,
                            int 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 field
text - user's value to match
collection - 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:
ChoiceAuthority.getBestMatch

getLabel

public String getLabel(String schema,
                       String element,
                       String qualifier,
                       String authKey,
                       String locale)
Wrapper that calls getLabel method of the plugin corresponding to the metadata field defined by schema,element,qualifier.


getLabel

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


isChoicesConfigured

public boolean isChoicesConfigured(String fieldKey)
Predicate, is there a Choices configuration of any kind for the given metadata field?

Returns:
true if choices are configured for this field.

getPresentation

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

Returns:
configured presentation type for this field, or null if none found

isClosed

public boolean isClosed(String fieldKey)
Get the configured "closed" value for this field.

Returns:
true if choices are closed for this field.

makeFieldKey

public static String makeFieldKey(String schema,
                                  String element,
                                  String qualifier)
Construct a single key from the tuple of schema/element/qualifier that describes a metadata field. Punt to the function we use for submission UI input forms, for now.


makeFieldKey

public static String makeFieldKey(String dotty)
Construct a single key from the "dot" notation e.g. "dc.rights"


getVariants

public List<String> getVariants(String schema,
                                String element,
                                String qualifier,
                                String authorityKey,
                                String language)
Wrapper to call plugin's getVariants().



Copyright © 2010 DuraSpace. All Rights Reserved.