Class OpenAireImportMetadataSourceServiceImpl

All Implemented Interfaces:
MetadataSource, QuerySource

public class OpenAireImportMetadataSourceServiceImpl extends AbstractImportMetadataSourceService<org.jdom2.Element> implements QuerySource
Implements a data source for querying OpenAIRE
Author:
Pasquale Cavallo (pasquale.cavallo at 4science dot it)
  • Field Details

  • Constructor Details

    • OpenAireImportMetadataSourceServiceImpl

      public OpenAireImportMetadataSourceServiceImpl()
  • Method Details

    • getImportSource

      public String getImportSource()
      Description copied from interface: MetadataSource
      The string that identifies this import implementation. Preferable a URI
      Specified by:
      getImportSource in interface MetadataSource
      Returns:
      the identifying uri
    • getRecord

      public ImportRecord getRecord(String id) throws MetadataSourceException
      The string that identifies this import implementation. Preferable a URI
      Specified by:
      getRecord in interface QuerySource
      Parameters:
      id - identifier for the record
      Returns:
      the identifying uri
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • getRecord

      public ImportRecord getRecord(Query query) throws MetadataSourceException
      The string that identifies this import implementation. Preferable a URI
      Specified by:
      getRecord in interface QuerySource
      Parameters:
      query - a query matching a single record
      Returns:
      the identifying uri
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • getRecordsCount

      public int getRecordsCount(String query) throws MetadataSourceException
      Find the number of records matching a query;
      Specified by:
      getRecordsCount in interface QuerySource
      Parameters:
      query - a query string to base the search on.
      Returns:
      the sum of the matching records over this import source
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • getRecordsCount

      public int getRecordsCount(Query query) throws MetadataSourceException
      Find the number of records matching a query;
      Specified by:
      getRecordsCount in interface QuerySource
      Parameters:
      query - a query object to base the search on.
      Returns:
      the sum of the matching records over this import source
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • getRecords

      public Collection<ImportRecord> getRecords(String query, int start, int count) throws MetadataSourceException
      Find the number of records matching a string query. Supports pagination
      Specified by:
      getRecords in interface QuerySource
      Parameters:
      query - a query string to base the search on.
      start - offset to start at
      count - number of records to retrieve.
      Returns:
      a set of records. Fully transformed.
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • getRecords

      public Collection<ImportRecord> getRecords(Query query) throws MetadataSourceException
      Find records based on a object query.
      Specified by:
      getRecords in interface QuerySource
      Parameters:
      query - a query object to base the search on.
      Returns:
      a set of records. Fully transformed.
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • findMatchingRecords

      public Collection<ImportRecord> findMatchingRecords(Query query) throws MetadataSourceException
      Description copied from interface: QuerySource
      Finds records based on query object. Delegates to one or more MetadataSource implementations based on the uri. Results will be aggregated.
      Specified by:
      findMatchingRecords in interface QuerySource
      Parameters:
      query - a query object to base the search on.
      Returns:
      a collection of import records. Only the identifier of the found records may be put in the record.
      Throws:
      MetadataSourceException - passed through.
    • findMatchingRecords

      public Collection<ImportRecord> findMatchingRecords(Item item) throws MetadataSourceException
      Description copied from interface: QuerySource
      Finds records based on an item Delegates to one or more MetadataSource implementations based on the uri. Results will be aggregated.
      Specified by:
      findMatchingRecords in interface QuerySource
      Parameters:
      item - an item to base the search on
      Returns:
      a collection of import records. Only the identifier of the found records may be put in the record.
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • setBaseAddress

      public void setBaseAddress(String baseAddress)
      Set the baseAddress to this object
      Parameters:
      baseAddress - The String object that represents the baseAddress of this object
    • getBaseAddress

      public String getBaseAddress()
      Return the baseAddress set to this object
      Returns:
      The String object that represents the baseAddress of this object
    • setQueryParam

      public void setQueryParam(String queryParam)
      Set the name of the query param, this correspond to the index used (title, author)
      Parameters:
      queryParam - on which index make the query
    • getQueryParam

      public String getQueryParam()
      Get the name of the query param for the rest call
      Returns:
      the name of the query param, i.e. the index (title, author) to use
    • init

      public void init() throws Exception
      Initialize the class
      Specified by:
      init in class AbstractRemoteMetadataSource
      Throws:
      Exception - on generic exception