Package org.dspace.submit.listener
Class SimpleMetadataListener
java.lang.Object
org.dspace.submit.listener.SimpleMetadataListener
- All Implemented Interfaces:
MetadataListener
This is the basic implementation for the MetadataListener interface.
It got the a map of metadata and related External Data Provider that can be
used to retrieve further information using the updated metadata in the item
- Author:
- Andrea Bollini (andrea.bollini at 4science.it)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgenerateExternalId(Context context, ExternalDataProvider prov, Item item, Set<String> changedMetadata, String m) This is the simpler implementation, it assumes that the value of the metadata listened by the DataProvider can be used directly as identifier.getExternalDataObject(Context context, Item item, Set<String> changedMetadata) Retrieve an ExternalDataObject to enrich the current item using the current metadata and the information about which listened metadata are changedReturn the list of metadata that should be monitored as change to them could allow the service to retrieve an ExternalDataObject to enrich the current itemvoidsetExternalDataProvidersMap(Map<String, List<ExternalDataProvider>> externalDataProvidersMap)
-
Constructor Details
-
SimpleMetadataListener
public SimpleMetadataListener()
-
-
Method Details
-
getExternalDataProvidersMap
-
setExternalDataProvidersMap
public void setExternalDataProvidersMap(Map<String, List<ExternalDataProvider>> externalDataProvidersMap) -
getMetadataToListen
Description copied from interface:MetadataListenerReturn the list of metadata that should be monitored as change to them could allow the service to retrieve an ExternalDataObject to enrich the current item- Specified by:
getMetadataToListenin interfaceMetadataListener- Returns:
- the list of metadata to monitor
-
getExternalDataObject
public ExternalDataObject getExternalDataObject(Context context, Item item, Set<String> changedMetadata) Description copied from interface:MetadataListenerRetrieve an ExternalDataObject to enrich the current item using the current metadata and the information about which listened metadata are changed- Specified by:
getExternalDataObjectin interfaceMetadataListener- Parameters:
context- the DSpace Context Objectitem- the item in its current statuschangedMetadata- the list of listened metadata that are changed- Returns:
- an ExternalDataObject that can be used to enrich the current item
-
generateExternalId
protected String generateExternalId(Context context, ExternalDataProvider prov, Item item, Set<String> changedMetadata, String m) This is the simpler implementation, it assumes that the value of the metadata listened by the DataProvider can be used directly as identifier. Subclass may extend it to add support for identifier normalization or combine multiple information to build the identifier- Parameters:
context- the DSpace Context Objectprov- the ExternalDataProvider that need to received an Iditem- the itemchangedMetadata- the metadata that are recently changedm- the changed metadata that lead to the selected ExternalDataProvider- Returns:
- an Id if any that can be used to query the
ExternalDataProvider
-