Class MultipleMetadataContributor<T>

java.lang.Object
org.dspace.importer.external.metadatamapping.contributor.MultipleMetadataContributor<T>
Type Parameters:
T - The type of record being processed.
All Implemented Interfaces:
MetadataContributor<T>

public class MultipleMetadataContributor<T> extends Object implements MetadataContributor<T>
This Contributor is helpful to avoid the limit of the Live Import Framework. In Live Import, one dc schema/element/qualifier could be associate with one and only one MetadataContributor, because the map they're saved in use dc entity as key. In fact, in this implementation we use the MetadataFieldConfig present in this MultipleMetadataContributor contributor, but the data (values of the dc metadatum) will be loaded using any of the contributor defined in the List metadatumContributors, by iterating over them. If the ensureUniqueValues flag is set to true, duplicate values will be filtered out from the final metadata collection.
Author:
Pasquale Cavallo (pasquale.cavallo at 4science dot it)
See Also:
  • org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping<RecordType>
  • Constructor Details

    • MultipleMetadataContributor

      public MultipleMetadataContributor()
      Empty constructor
    • MultipleMetadataContributor

      public MultipleMetadataContributor(MetadataFieldConfig field, List<MetadataContributor> metadatumContributors)
      Parameters:
      field - MetadataFieldConfig used in mapping
      metadatumContributors - A list of MetadataContributor
    • MultipleMetadataContributor

      public MultipleMetadataContributor(MetadataFieldConfig field, List<MetadataContributor> metadatumContributors, boolean ensureUniqueValues)
      Parameters:
      field - MetadataFieldConfig used in mapping
      metadatumContributors - A list of MetadataContributor
      ensureUniqueValues - If true, ensures that duplicate values are filtered out
  • Method Details

    • setMetadataFieldMapping

      public void setMetadataFieldMapping(MetadataFieldMapping<T,MetadataContributor<T>> metadataFieldMapping)
      Set the metadatafieldMapping used in the transforming of a record to actual metadata
      Specified by:
      setMetadataFieldMapping in interface MetadataContributor<T>
      Parameters:
      metadataFieldMapping - the new mapping.
    • contributeMetadata

      public Collection<MetadatumDTO> contributeMetadata(T t)
      a separate Metadatum object is created for each index of Metadatum returned from the calls to MetadatumContributor.contributeMetadata(t) for each MetadatumContributor in the metadatumContributors list. All of them have as dc schema/element/qualifier the values defined in MetadataFieldConfig. If ensureUniqueValues is enabled, duplicate metadata values will be removed, ensuring uniqueness.
      Specified by:
      contributeMetadata in interface MetadataContributor<T>
      Parameters:
      t - the object we are trying to translate
      Returns:
      a collection of metadata got from each MetadataContributor
    • getField

      public MetadataFieldConfig getField()
      Return the MetadataFieldConfig used while retrieving MetadatumDTO
      Returns:
      MetadataFieldConfig
    • setField

      public void setField(MetadataFieldConfig field)
      Setting the MetadataFieldConfig
      Parameters:
      field - MetadataFieldConfig used while retrieving MetadatumDTO
    • getMetadatumContributors

      public List<MetadataContributor> getMetadatumContributors()
      Return the List of MetadataContributor objects set to this class
      Returns:
      metadatumContributors, list of MetadataContributor
    • setMetadatumContributors

      public void setMetadatumContributors(List<MetadataContributor> metadatumContributors)
      Set the List of MetadataContributor objects set to this class
      Parameters:
      metadatumContributors - A list of MetadatumContributor classes
    • isEnsureUniqueValues

      public boolean isEnsureUniqueValues()
      Returns whether duplicate metadata values should be removed.
      Returns:
      true if duplicate values should be filtered out, false otherwise.
    • setEnsureUniqueValues

      public void setEnsureUniqueValues(boolean ensureUniqueValues)
      Sets whether duplicate metadata values should be removed.
      Parameters:
      ensureUniqueValues - if true, ensures that duplicate values are filtered out.