Class PubmedImportMetadataSourceServiceImpl
java.lang.Object
org.dspace.importer.external.service.components.AbstractRemoteMetadataSource
org.dspace.importer.external.service.AbstractImportMetadataSourceService<org.jdom2.Element>
org.dspace.importer.external.pubmed.service.PubmedImportMetadataSourceServiceImpl
- All Implemented Interfaces:
FileSource,MetadataSource,QuerySource
public class PubmedImportMetadataSourceServiceImpl
extends AbstractImportMetadataSourceService<org.jdom2.Element>
implements QuerySource, FileSource
Implements a data source for querying PubMed Central
- Author:
- Roeland Dillen (roeland at atmire dot com), Pasquale Cavallo (pasquale.cavallo at 4science dot it)
-
Field Summary
Fields inherited from class org.dspace.importer.external.service.components.AbstractRemoteMetadataSource
error, exceptionHandlersMap, interRequestTime, lastRequest, lock, maxRetry, operationId, retry, warning -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindMatchingRecords(Item item) Finds records based on an itemfindMatchingRecords(Query query) Finds records based on query object.The string that identifies this import implementation.getRecord(InputStream inputStream) Return an ImportRecord constructed from input file.Get a single record from the source.Get a single record from the source.getRecords(InputStream inputStream) Return a list of ImportRecord constructed from input file.getRecords(String query, int start, int count) Find the number of records matching a string query.getRecords(Query query) Find records based on a object query.intgetRecordsCount(String query) Find the number of records matching a query;intgetRecordsCount(Query query) Find the number of records matching a query;Get the file extensions (xml, csv, txt, ...) supported by the FileSourcevoidinit()Initialize the classvoidsetSupportedExtensions(List<String> supportedExtensions) Set the file extensions supported by this metadata servicevoidsetUrlFetch(String urlFetch) voidsetUrlSearch(String urlSearch) Methods inherited from class org.dspace.importer.external.service.AbstractImportMetadataSourceService
getGenerateQueryForItem, getMetadataFieldMapping, setGenerateQueryForItem, setMetadataFieldMapping, transformSourceRecordsMethods inherited from class org.dspace.importer.external.service.components.AbstractRemoteMetadataSource
getError, getExceptionHandler, getMaxRetry, getOperationId, getRetry, getWarning, handleException, initExceptionHandlers, retry, setError, setInterRequestTime, setMaxRetry, setWarning, throwSourceException, throwSourceExceptionHookMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.dspace.importer.external.service.components.FileSource
isValidSourceForFile
-
Constructor Details
-
PubmedImportMetadataSourceServiceImpl
public PubmedImportMetadataSourceServiceImpl()
-
-
Method Details
-
setSupportedExtensions
Set the file extensions supported by this metadata service- Parameters:
supportedExtensions- the file extensions (xml,txt,...) supported by this service
-
getSupportedExtensions
Description copied from interface:FileSourceGet the file extensions (xml, csv, txt, ...) supported by the FileSource- Specified by:
getSupportedExtensionsin interfaceFileSource
-
getRecordsCount
Find the number of records matching a query;- Specified by:
getRecordsCountin interfaceQuerySource- 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
Find the number of records matching a query;- Specified by:
getRecordsCountin interfaceQuerySource- 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:
getRecordsin interfaceQuerySource- Parameters:
query- a query string to base the search on.start- offset to start atcount- number of records to retrieve.- Returns:
- a set of records. Fully transformed.
- Throws:
MetadataSourceException- if the underlying methods throw any exception.
-
getRecords
Find records based on a object query.- Specified by:
getRecordsin interfaceQuerySource- 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
Get a single record from the source.- Specified by:
getRecordin interfaceQuerySource- Parameters:
id- identifier for the record- Returns:
- the first matching record
- Throws:
MetadataSourceException- if the underlying methods throw any exception.
-
getRecord
Get a single record from the source.- Specified by:
getRecordin interfaceQuerySource- Parameters:
query- a query matching a single record- Returns:
- the first matching record
- Throws:
MetadataSourceException- if the underlying methods throw any exception.
-
getImportSource
The string that identifies this import implementation. Preferable a URI- Specified by:
getImportSourcein interfaceMetadataSource- Returns:
- the identifying uri
-
findMatchingRecords
Finds records based on an item- Specified by:
findMatchingRecordsin interfaceQuerySource- 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
Finds records based on query object. Delegates to one or more MetadataSource implementations based on the uri. Results will be aggregated.- Specified by:
findMatchingRecordsin interfaceQuerySource- 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- if the underlying methods throw any exception.
-
init
Initialize the class- Specified by:
initin classAbstractRemoteMetadataSource- Throws:
Exception- on generic exception
-
getRecords
Description copied from interface:FileSourceReturn a list of ImportRecord constructed from input file.- Specified by:
getRecordsin interfaceFileSource- Parameters:
inputStream- The inputStream of the file- Returns:
- A list of
ImportRecord - Throws:
FileSourceException- if, for any reason, the file is not parsable
-
getRecord
public ImportRecord getRecord(InputStream inputStream) throws FileSourceException, FileMultipleOccurencesException Description copied from interface:FileSourceReturn an ImportRecord constructed from input file.- Specified by:
getRecordin interfaceFileSource- Parameters:
inputStream- The inputStream of the file- Returns:
- An
ImportRecordmatching the file content - Throws:
FileSourceException- if, for any reason, the file is not parsableFileMultipleOccurencesException- if the file contains more than one entry
-
getUrlFetch
-
setUrlFetch
-
getUrlSearch
-
setUrlSearch
-