Class OpenAIREFundingDataProvider
- java.lang.Object
-
- org.dspace.external.provider.AbstractExternalDataProvider
-
- org.dspace.external.provider.impl.OpenAIREFundingDataProvider
-
- All Implemented Interfaces:
ExternalDataProvider
public class OpenAIREFundingDataProvider extends AbstractExternalDataProvider
This class is the implementation of the ExternalDataProvider interface that will deal with the OpenAIRE External Data lookup- Author:
- paulo-graca
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classOpenAIREFundingDataProvider.ExternalDataObjectBuilderOpenAIRE Funding External Data Builder Class
-
Field Summary
Fields Modifier and Type Field Description protected OpenAIRERestConnectorconnectorConnector to handle token and requestsprotected static intLIMIT_DEFAULTrows default limitprotected Map<String,MetadataFieldConfig>metadataFieldsprotected static StringPREFIXGrantAgreement prefixprotected StringsourceIdentifierSource identifier (defined in beans)
-
Constructor Summary
Constructors Constructor Description OpenAIREFundingDataProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OpenAIRERestConnectorgetConnector()Optional<ExternalDataObject>getExternalDataObject(String id)This method will take a String id as a parameter and it'll call the ExternalDataProvider's endpoint or data source to retrieve and build the ExternalDataObjectMap<String,MetadataFieldConfig>getMetadataFields()intgetNumberOfResults(String query)Returns the total amount of results that this source can return for the given queryStringgetSourceIdentifier()This method will return the SourceIdentifier for the ExternalDataProvider that implements the interfacevoidinit()eu.openaire.jaxb.model.ResponsesearchByProjectURI(String projectURI)List<ExternalDataObject>searchExternalDataObjects(String query, int start, int limit)This method will query the ExternalDataProvider's endpoint or data source to retrieve and build a list of ExternalDataObjects through a search with the given parametersvoidsetConnector(OpenAIRERestConnector connector)Generic setter for OpenAIRERestConnectorvoidsetMetadataFields(Map<String,MetadataFieldConfig> metadataFields)voidsetSourceIdentifier(String sourceIdentifier)Generic setter for the sourceIdentifierbooleansupports(String source)This method will return a boolean indicating whether this ExternalDataProvider can deal with the given source or not-
Methods inherited from class org.dspace.external.provider.AbstractExternalDataProvider
getSupportedEntityTypes, setSupportedEntityTypes, supportsEntityType
-
-
-
-
Field Detail
-
PREFIX
protected static final String PREFIX
GrantAgreement prefix- See Also:
- Constant Field Values
-
LIMIT_DEFAULT
protected static final int LIMIT_DEFAULT
rows default limit- See Also:
- Constant Field Values
-
sourceIdentifier
protected String sourceIdentifier
Source identifier (defined in beans)
-
connector
protected OpenAIRERestConnector connector
Connector to handle token and requests
-
metadataFields
protected Map<String,MetadataFieldConfig> metadataFields
-
-
Method Detail
-
init
public void init() throws IOException- Throws:
IOException
-
getSourceIdentifier
public String getSourceIdentifier()
Description copied from interface:ExternalDataProviderThis method will return the SourceIdentifier for the ExternalDataProvider that implements the interface- Returns:
- The source identifier as a String
-
getExternalDataObject
public Optional<ExternalDataObject> getExternalDataObject(String id)
Description copied from interface:ExternalDataProviderThis method will take a String id as a parameter and it'll call the ExternalDataProvider's endpoint or data source to retrieve and build the ExternalDataObject- Parameters:
id- The id on which will be searched- Returns:
- An Optional object of ExternalDataObject. This is to indicate that this object may be null. This ExternalDataObject will return all the data returned by the ExternalDataProvider
-
searchExternalDataObjects
public List<ExternalDataObject> searchExternalDataObjects(String query, int start, int limit)
Description copied from interface:ExternalDataProviderThis method will query the ExternalDataProvider's endpoint or data source to retrieve and build a list of ExternalDataObjects through a search with the given parameters- Parameters:
query- The query for the searchstart- The start of the searchlimit- The max amount of records to be returned by the search- Returns:
- A list of ExternalDataObjects that were retrieved and built by this search
-
supports
public boolean supports(String source)
Description copied from interface:ExternalDataProviderThis method will return a boolean indicating whether this ExternalDataProvider can deal with the given source or not- Parameters:
source- The source on which the check needs to be done- Returns:
- A boolean indicating whether this ExternalDataProvider can deal with this source or not
-
getNumberOfResults
public int getNumberOfResults(String query)
Description copied from interface:ExternalDataProviderReturns the total amount of results that this source can return for the given query- Parameters:
query- The query to be search on and give the total amount of results- Returns:
- The total amount of results that the source can return for the given query
-
setSourceIdentifier
@Autowired(required=true) public void setSourceIdentifier(String sourceIdentifier)
Generic setter for the sourceIdentifier- Parameters:
sourceIdentifier- The sourceIdentifier to be set on this OpenAIREFunderDataProvider
-
getConnector
public OpenAIRERestConnector getConnector()
-
setConnector
@Autowired(required=true) public void setConnector(OpenAIRERestConnector connector)
Generic setter for OpenAIRERestConnector- Parameters:
connector-
-
searchByProjectURI
public eu.openaire.jaxb.model.Response searchByProjectURI(String projectURI)
- Parameters:
projectURI- from type info:eu-repo/grantAgreement/FCT/3599-PPCDT/82130/PT- Returns:
- Response
-
getMetadataFields
public Map<String,MetadataFieldConfig> getMetadataFields()
-
setMetadataFields
public void setMetadataFields(Map<String,MetadataFieldConfig> metadataFields)
-
-