Class FailingCvTermFetcher
- java.lang.Object
-
- psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher<T>
-
- psidev.psi.mi.jami.bridges.fetcher.mock.AbstractFailingFetcher<CvTerm>
-
- psidev.psi.mi.jami.bridges.fetcher.mock.FailingCvTermFetcher
-
- All Implemented Interfaces:
CvTermFetcher<CvTerm>
,MockFetcher<CvTerm>
public class FailingCvTermFetcher extends AbstractFailingFetcher<CvTerm> implements CvTermFetcher<CvTerm>
A mock fetcher for testing exceptions. It extends the functionality of the mock fetcher but can also throw exceptions. Upon initialisation, an integer is given which sets how many times a query is made before returning the result. If the current query matches the last query and the counter of the number of times is less than the maxQuery set at initialisation, then an exception will be thrown. Additionally, if the maxQuery is set to -1, the fetcher will always throw an exception.- Since:
- 01/07/13
- Author:
- Gabriel Aldam (galdam@ebi.ac.uk)
-
-
Field Summary
-
Fields inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher
localMap
-
-
Constructor Summary
Constructors Constructor Description FailingCvTermFetcher(int maxQuery)
Constructor for FailingCvTermFetcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CvTerm
fetchByIdentifier(String termIdentifier, String ontologyDatabaseName)
Uses the identifier and the name of the database to search for a complete form of the cvTerm.CvTerm
fetchByIdentifier(String termIdentifier, CvTerm ontologyDatabase)
fetchByIdentifier.Collection<CvTerm>
fetchByIdentifiers(Collection<String> termIdentifiers, String ontologyDatabaseName)
fetchByIdentifiers.Collection<CvTerm>
fetchByIdentifiers(Collection<String> termIdentifiers, CvTerm ontologyDatabase)
Uses the identifier and a cvTerm denoting the database to search to fetch a complete from of the term.Collection<CvTerm>
fetchByName(String searchName)
Uses the name of the term and the name of the database to search for a complete form of the term.CvTerm
fetchByName(String searchName, String ontologyDatabaseName)
Uses the name of the term and the name of the database to search for a complete form of the term.Collection<CvTerm>
fetchByNames(Collection<String> searchNames)
Finds the CvTerms which match the exact names provided.Collection<CvTerm>
fetchByNames(Collection<String> searchNames, String ontologyDatabaseName)
Uses the name of the term and the name of the database to search for a complete form of the term.-
Methods inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractFailingFetcher
getEntries, getEntry
-
Methods inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher
addEntry, clearEntries, removeEntry
-
-
-
-
Method Detail
-
fetchByIdentifier
public CvTerm fetchByIdentifier(String termIdentifier, String ontologyDatabaseName) throws BridgeFailedException
Uses the identifier and the name of the database to search for a complete form of the cvTerm.- Specified by:
fetchByIdentifier
in interfaceCvTermFetcher<CvTerm>
- Parameters:
termIdentifier
- The identifier for the CvTerm to fetch.ontologyDatabaseName
- The name of the ontology to search for. Eg, psi-mi, psi-mod, go. Must not be Null.- Returns:
- A full cvTerm which matches the search term or null if one cannot be found.
- Throws:
BridgeFailedException
- if any.
-
fetchByIdentifier
public CvTerm fetchByIdentifier(String termIdentifier, CvTerm ontologyDatabase) throws BridgeFailedException
fetchByIdentifier.
- Specified by:
fetchByIdentifier
in interfaceCvTermFetcher<CvTerm>
- Parameters:
termIdentifier
- aString
object.ontologyDatabase
- aCvTerm
object.- Returns:
- a
CvTerm
object. - Throws:
BridgeFailedException
- if any.
-
fetchByName
public CvTerm fetchByName(String searchName, String ontologyDatabaseName) throws BridgeFailedException
Uses the name of the term and the name of the database to search for a complete form of the term.- Specified by:
fetchByName
in interfaceCvTermFetcher<CvTerm>
- Parameters:
searchName
- A full or short name for the term to be searched for.ontologyDatabaseName
- The ontology to search for the term in.- Returns:
- A fully enriched cvTerm which matches the search term or null if one cannot be found.
- Throws:
BridgeFailedException
- if any.
-
fetchByName
public Collection<CvTerm> fetchByName(String searchName) throws BridgeFailedException
Uses the name of the term and the name of the database to search for a complete form of the term.If the term can not be resolved to a database, then this method may return null.
- Specified by:
fetchByName
in interfaceCvTermFetcher<CvTerm>
- Parameters:
searchName
- A full or short name for the term to be searched for.- Returns:
- A fully enriched cvTerm which matches the search term or null if one cannot be found.
- Throws:
BridgeFailedException
- if any.
-
fetchByIdentifiers
public Collection<CvTerm> fetchByIdentifiers(Collection<String> termIdentifiers, String ontologyDatabaseName) throws BridgeFailedException
fetchByIdentifiers.
- Specified by:
fetchByIdentifiers
in interfaceCvTermFetcher<CvTerm>
- Parameters:
termIdentifiers
- aCollection
object.ontologyDatabaseName
- aString
object.- Returns:
- a
Collection
object. - Throws:
BridgeFailedException
- if any.
-
fetchByIdentifiers
public Collection<CvTerm> fetchByIdentifiers(Collection<String> termIdentifiers, CvTerm ontologyDatabase) throws BridgeFailedException
Uses the identifier and a cvTerm denoting the database to search to fetch a complete from of the term.- Specified by:
fetchByIdentifiers
in interfaceCvTermFetcher<CvTerm>
- Parameters:
termIdentifiers
- The identifier for the CvTerms to fetch.ontologyDatabase
- The name of the ontology to search for the terms in.- Returns:
- A fully enriched cvTerm which matches the search term or null if one cannot be found.
- Throws:
BridgeFailedException
- if any.
-
fetchByNames
public Collection<CvTerm> fetchByNames(Collection<String> searchNames, String ontologyDatabaseName) throws BridgeFailedException
Uses the name of the term and the name of the database to search for a complete form of the term.- Specified by:
fetchByNames
in interfaceCvTermFetcher<CvTerm>
- Parameters:
searchNames
- A full or short name for the term to be searched for.ontologyDatabaseName
- The name of the database to search for the names in.- Returns:
- A fully enriched cvTerm which matches the search term or null if one cannot be found.
- Throws:
BridgeFailedException
- if any.
-
fetchByNames
public Collection<CvTerm> fetchByNames(Collection<String> searchNames) throws BridgeFailedException
Finds the CvTerms which match the exact names provided.If the a term found by the search can not be resolved to a database, this method may return null.
- Specified by:
fetchByNames
in interfaceCvTermFetcher<CvTerm>
- Parameters:
searchNames
- A collection full or short names for the term to be searched for.- Returns:
- A collection of cvTerms which matched a search term.
- Throws:
BridgeFailedException
- if any.
-
-