Class BibliographicReferenceServiceImpl
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, BaseImmutableService<BibliographicReference>, BaseReadOnlyService<BibliographicReference>, BaseService<BibliographicReference>, BaseVoEnabledService<BibliographicReference, BibliographicReferenceValueObject>, BibliographicReferenceService
BibliographicReferenceService.
As of the Phase 3 strangler-fig decomposition, the read cluster (browse,
findByExternalId variants, findVOByExternalId, count*, getRelatedExperiments,
listAll, search, thaw) lives on BibliographicReferenceReadService; this
facade delegates to that read service. Write-side methods (refresh + the inherited
BaseService mutators) stay here.
Note: This is only in Core because it uses SearchService (via the read service), but it could be refactored.
- Author:
- keshav
- See Also:
-
Field Summary
Fields inherited from class AbstractService
log -
Constructor Summary
ConstructorsConstructorDescriptionBibliographicReferenceServiceImpl(BibliographicReferenceDao bibliographicReferenceDao) -
Method Summary
Modifier and TypeMethodDescriptionvoidbrowse(int start, int limit) longlongGet a reference by the unqualified external id.findByExternalId(String id, String databaseName) Retrieve a reference by identifier, qualified by the database name (such as 'pubmed').findByExternalId(DatabaseEntry accession) Find an existing BibliographicReference by its pubAccession, or create a new one.findOrCreateByDoi(String doi) Resolve a DOI to a persistentBibliographicReference, fetching it when necessary.findOrCreateByPubMedId(String pubMedId) Resolve a PubMed id to a persistentBibliographicReference, fetching it from PubMed and persisting it when it is not already in the system.Get a reference by the unqualified external id.getRelatedExperiments(int offset, int limit) Return all the BibRefs that are linked to ExpressionExperiments.listAll()Loads value objects representing all the entities of specific type.thaw(Collection<BibliographicReference> bibliographicReferences) thaw(BibliographicReference bibliographicReference) Methods inherited from class AbstractVoEnabledService
loadValueObjectById, loadValueObjects, loadValueObjectsByIdsMethods inherited from class AbstractService
countAll, create, create, ensureInSession, ensureInSession, find, findOrFail, getElementClass, load, load, loadAll, loadOrFail, loadOrFail, loadOrFail, loadOrFail, loadOrFail, loadOrFail, remove, remove, save, save, streamAll, streamAll, update, updateMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BaseReadOnlyService
countAll, findOrFail, getElementClass, load, load, loadAll, loadOrFail, loadOrFail, loadOrFail, loadOrFail, loadOrFail, loadOrFail, streamAll, streamAllMethods inherited from interface BaseVoEnabledService
loadValueObjectById, loadValueObjects, loadValueObjectsByIds
-
Constructor Details
-
BibliographicReferenceServiceImpl
@Autowired public BibliographicReferenceServiceImpl(BibliographicReferenceDao bibliographicReferenceDao)
-
-
Method Details
-
afterPropertiesSet
-
findOrCreate
Find an existing BibliographicReference by its pubAccession, or create a new one. The embeddedExternalDatabaseon the pubAccession is resolved (find-or-create by name) before delegating toBaseDao.findOrCreate(T)so the caller can pass a transient XDB instance without violating thecascade="none"onDatabaseEntry.externalDatabase.Phase 3 persister-retirement: replaces
persisterHelper.persist(BibRef)(which routed throughCommonPersister.persistBibliographicReference).- Specified by:
findOrCreatein interfaceBaseImmutableService<BibliographicReference>- Specified by:
findOrCreatein interfaceBibliographicReferenceService- Overrides:
findOrCreatein classAbstractService<BibliographicReference>- See Also:
-
findOrCreateByPubMedId
Description copied from interface:BibliographicReferenceServiceResolve a PubMed id to a persistentBibliographicReference, fetching it from PubMed and persisting it when it is not already in the system.Encapsulates the find-or-fetch dance that
UpdatePubMedCliand the retired gemma-webExpressionExperimentController.updatePubMedboth open-coded: look up by external id first, otherwise retrieve the record over the wire andBibliographicReferenceService.findOrCreate(BibliographicReference)it.- Specified by:
findOrCreateByPubMedIdin interfaceBibliographicReferenceService- Parameters:
pubMedId- a PubMed id (must be non-blank).- Returns:
- the persistent reference for
pubMedId.
-
findOrCreateByDoi
Description copied from interface:BibliographicReferenceServiceResolve a DOI to a persistentBibliographicReference, fetching it when necessary.Resolution order: (1) an existing DOI-keyed reference already in Gemma; (2) PubMed-by-DOI (covers DOIs NCBI indexes — yields the richer PubMed record); (3) CrossRef by DOI (covers the rest, notably bioRxiv / medRxiv preprints PubMed does not carry). This is what lets a preprint be attached to an experiment instead of being noted in a free-text comment.
- Specified by:
findOrCreateByDoiin interfaceBibliographicReferenceService- Parameters:
doi- a DOI in any common form (10.x/…,https://doi.org/…,doi:…); normalized internally.- Returns:
- the persistent reference for
doi.
-
loadValueObject
@Transactional(readOnly=true) public BibliographicReferenceValueObject loadValueObject(BibliographicReference entity) - Specified by:
loadValueObjectin interfaceBaseVoEnabledService<BibliographicReference, BibliographicReferenceValueObject>- Overrides:
loadValueObjectin classAbstractVoEnabledService<BibliographicReference, BibliographicReferenceValueObject>- See Also:
-
loadAllValueObjects
Description copied from interface:BaseVoEnabledServiceLoads value objects representing all the entities of specific type.- Specified by:
loadAllValueObjectsin interfaceBaseVoEnabledService<BibliographicReference, BibliographicReferenceValueObject>- Overrides:
loadAllValueObjectsin classAbstractVoEnabledService<BibliographicReference, BibliographicReferenceValueObject>- Returns:
- a collection of value objects
-
browse
- Specified by:
browsein interfaceBibliographicReferenceService
-
browse
public List<BibliographicReference> browse(int start, int limit, String orderField, boolean descending) - Specified by:
browsein interfaceBibliographicReferenceService
-
findByExternalId
- Specified by:
findByExternalIdin interfaceBibliographicReferenceService
-
findByExternalId
Description copied from interface:BibliographicReferenceServiceGet a reference by the unqualified external id.- Specified by:
findByExternalIdin interfaceBibliographicReferenceService- Parameters:
id- id- Returns:
- reference
-
findByExternalId
Description copied from interface:BibliographicReferenceServiceRetrieve a reference by identifier, qualified by the database name (such as 'pubmed').- Specified by:
findByExternalIdin interfaceBibliographicReferenceService- Parameters:
id- iddatabaseName- db name- Returns:
- reference
-
findVOByExternalId
Description copied from interface:BibliographicReferenceServiceGet a reference by the unqualified external id. Searches for pubmed by default
- Specified by:
findVOByExternalIdin interfaceBibliographicReferenceService- Parameters:
id- id- Returns:
- reference VO
-
countDistinctWithRelatedExperiments
public long countDistinctWithRelatedExperiments()- Specified by:
countDistinctWithRelatedExperimentsin interfaceBibliographicReferenceService
-
countWithRelatedExperiments
public long countWithRelatedExperiments()- Specified by:
countWithRelatedExperimentsin interfaceBibliographicReferenceService
-
getRelatedExperiments
public Map<BibliographicReference, Set<ExpressionExperimentIdAndShortName>> getRelatedExperiments(int offset, int limit) Description copied from interface:BibliographicReferenceServiceReturn all the BibRefs that are linked to ExpressionExperiments.- Specified by:
getRelatedExperimentsin interfaceBibliographicReferenceService- Returns:
- all references with EEs
-
getRelatedExperiments
public Map<BibliographicReference, Collection<ExpressionExperiment>> getRelatedExperiments(Collection<BibliographicReference> records) - Specified by:
getRelatedExperimentsin interfaceBibliographicReferenceService
-
listAll
- Specified by:
listAllin interfaceBibliographicReferenceService- Returns:
- all the IDs of bibliographic references in the system.
-
refresh
- Specified by:
refreshin interfaceBibliographicReferenceService
-
search
public List<BibliographicReferenceValueObject> search(String query, boolean searchExperiments, boolean searchBibrefs) throws SearchException - Specified by:
searchin interfaceBibliographicReferenceService- Throws:
SearchException
-
search
- Specified by:
searchin interfaceBibliographicReferenceService- Throws:
SearchException
-
thaw
- Specified by:
thawin interfaceBibliographicReferenceService
-
thaw
public Collection<BibliographicReference> thaw(Collection<BibliographicReference> bibliographicReferences) - Specified by:
thawin interfaceBibliographicReferenceService
-