Class EnhancedSimpleMetadataContributor

java.lang.Object
org.dspace.importer.external.metadatamapping.contributor.SimpleMetadataContributor
org.dspace.importer.external.metadatamapping.contributor.EnhancedSimpleMetadataContributor
All Implemented Interfaces:
MetadataContributor<PlainMetadataSourceDto>

public class EnhancedSimpleMetadataContributor extends SimpleMetadataContributor
This class implements functionalities to handle common situation regarding plain metadata. In some scenario, like csv or tsv, the format don't allow lists. We can use this MetadataContribut to parse a given plain metadata and split it into related list, based on the delimiter. No escape character is present. Default values are comma (,) for delimiter, and double quote (") for escape character
Author:
Pasquale Cavallo (pasquale.cavallo at 4science dot it)
  • Constructor Details

    • EnhancedSimpleMetadataContributor

      public EnhancedSimpleMetadataContributor()
  • Method Details

    • setDelimiter

      public void setDelimiter(char delimiter)
      This method could be used to set the delimiter used during parse If no delimiter is set, comma will be used
    • getDelimiter

      public char getDelimiter()
      This method could be used to get the delimiter used in this class
    • getQuote

      public char getQuote()
      This method could be used to get the quote char used in this class
    • setQuote

      public void setQuote(char quote)
      This method could be used to set the quote char used during parse If no quote char is set, " will be used
    • setEscape

      public void setEscape(char escape)
      Method to inject the escape character, usually the ". This must be the ASCII integer related to the char. In example, 9 for tab, 44 for comma If no escape is set, double quote will be used
    • getEscape

      public char getEscape()
      Method to get the escape character.
    • contributeMetadata

      public Collection<MetadatumDTO> contributeMetadata(PlainMetadataSourceDto t)
      Description copied from class: SimpleMetadataContributor
      Retrieve the metadata associated with the given object. It match the key found in PlainMetadataSourceDto instance with the key passed to constructor. In case of success, new metadatum is constructor (using field elements and PlainMetadataSourceDto value) and added to the list.
      Specified by:
      contributeMetadata in interface MetadataContributor<PlainMetadataSourceDto>
      Overrides:
      contributeMetadata in class SimpleMetadataContributor
      Parameters:
      t - A class to retrieve metadata and key to match from. t and contained list "metadata" MUST be not null.
      Returns:
      a collection of import records. Only the identifier of the found records may be put in the record.