Class SimpleMetadataListener

  • All Implemented Interfaces:
    MetadataListener

    public class SimpleMetadataListener
    extends Object
    implements 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 Detail

      • SimpleMetadataListener

        public SimpleMetadataListener()
    • Method Detail

      • getMetadataToListen

        public Set<String> getMetadataToListen()
        Description copied from interface: MetadataListener
        Return 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:
        getMetadataToListen in interface MetadataListener
        Returns:
        the list of metadata to monitor
      • getExternalDataObject

        public ExternalDataObject getExternalDataObject​(Context context,
                                                        Item item,
                                                        Set<String> changedMetadata)
        Description copied from interface: MetadataListener
        Retrieve an ExternalDataObject to enrich the current item using the current metadata and the information about which listened metadata are changed
        Specified by:
        getExternalDataObject in interface MetadataListener
        Parameters:
        context - the DSpace Context Object
        item - the item in its current status
        changedMetadata - 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 Object
        prov - the ExternalDataProvider that need to received an Id
        item - the item
        changedMetadata - the metadata that are recently changed
        m - the changed metadata that lead to the selected ExternalDataProvider
        Returns:
        an Id if any that can be used to query the ExternalDataProvider