Class EpoImportMetadataSourceServiceImpl

All Implemented Interfaces:
MetadataSource, QuerySource

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

  • Constructor Details

    • EpoImportMetadataSourceServiceImpl

      public EpoImportMetadataSourceServiceImpl()
  • Method Details

    • init

      public void init() throws Exception
      Description copied from class: AbstractRemoteMetadataSource
      Attempts to init a session
      Specified by:
      init in class AbstractRemoteMetadataSource
      Throws:
      Exception - on generic exception
    • getImportSource

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

      public void setConsumerKey(String consumerKey)
      Set the customer epo key
      Parameters:
      consumerKey - the customer consumer key
    • getConsumerKey

      public String getConsumerKey()
    • setConsumerSecret

      public void setConsumerSecret(String consumerSecret)
      Set the customer epo secret
      Parameters:
      consumerSecret - the customer epo secret
    • getConsumerSecret

      public String getConsumerSecret()
    • setDateFiled

      public void setDateFiled(MetadataFieldConfig dateFiled)
    • getDateFiled

      public MetadataFieldConfig getDateFiled()
    • setApplicationNumber

      public void setApplicationNumber(MetadataFieldConfig applicationNumber)
    • getApplicationNumber

      public MetadataFieldConfig getApplicationNumber()
    • login

      protected String login() throws IOException, org.apache.http.HttpException
      Log to EPO, bearer is valid for 20 minutes
      Parameters:
      consumerKey - The consumer Key
      consumerSecretKey - The consumer secret key
      Returns:
      Throws:
      IOException
      org.apache.http.HttpException
    • getRecordsCount

      public int getRecordsCount(String query) throws MetadataSourceException
      Description copied from interface: QuerySource
      Gets the number of records matching a query
      Specified by:
      getRecordsCount in interface QuerySource
      Parameters:
      query - the query in string format
      Returns:
      the number of records matching the query
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • getRecordsCount

      public int getRecordsCount(Query query) throws MetadataSourceException
      Description copied from interface: QuerySource
      Gets the number of records matching a query
      Specified by:
      getRecordsCount in interface QuerySource
      Parameters:
      query - the query object
      Returns:
      the number of records matching the query
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • getRecords

      public Collection<ImportRecord> getRecords(String query, int start, int count) throws MetadataSourceException
      Description copied from interface: QuerySource
      Gets a set of records matching a query. Supports pagination
      Specified by:
      getRecords in interface QuerySource
      Parameters:
      query - the query. The query will generally be posted 'as is' to the source
      start - offset
      count - page size
      Returns:
      a collection of fully transformed id's
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • getRecords

      public Collection<ImportRecord> getRecords(Query query) throws MetadataSourceException
      Description copied from interface: QuerySource
      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.
    • getRecord

      public ImportRecord getRecord(String id) throws MetadataSourceException
      Description copied from interface: QuerySource
      Get a single record from the source. The first match will be returned
      Specified by:
      getRecord in interface QuerySource
      Parameters:
      id - identifier for the record
      Returns:
      a matching record
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • getRecord

      public ImportRecord getRecord(Query query) throws MetadataSourceException
      Description copied from interface: QuerySource
      Get a single record from the source. The first match will be returned
      Specified by:
      getRecord in interface QuerySource
      Parameters:
      query - a query matching a single record
      Returns:
      a matching record
      Throws:
      MetadataSourceException - if the underlying methods throw any exception.
    • 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.
    • 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.
    • setUrl

      public void setUrl(String url)
    • setAuthUrl

      public void setAuthUrl(String authUrl)
    • setSearchUrl

      public void setSearchUrl(String searchUrl)