use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.
the class PublicationServiceImpl method findPublicationById.
@Cacheable("publications-get-by-id")
public Publication findPublicationById(long id) {
// Basic fields
Publication publication = this.publicationDao.findPublicationById(id);
// add non-basic fields to object
loadAuthorsAndXrefs(publication);
return publication;
}
use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.
the class SolrIndexingServiceImpl method indexPublications.
@Override
public String indexPublications() {
long seconds = System.currentTimeMillis() / 1000;
StringBuilder info = new StringBuilder();
logAndCollect(info, "publications indexing...STARTING at " + new Date());
String serverUrl = getServerUrl(PublicationIndex.NAME);
logAndCollect(info, "Solr server: " + serverUrl);
logAndCollect(info, "clearing publication index");
SolrIndexer<Publication> indexer = new PublicationSolrindexer(serverUrl, publicationService);
List<Long> allpubids;
indexer.clearDatabase("");
logAndCollect(info, "getting publications");
allpubids = publicationService.findAllPublicationIds();
logAndCollect(info, "start indexing of " + allpubids.size() + " publications");
int pubcnt = 0;
for (Long id : allpubids) {
Publication currpub = publicationService.findPublicationById(id);
if (currpub.getPublicationType().equals(PublicationType.ARTICLE)) {
indexer.add(currpub);
pubcnt++;
}
if ((pubcnt % 5000) == 0)
logAndCollect(info, pubcnt + "/" + allpubids.size() + " publications done");
}
indexer.addRemaing();
logAndCollect(info, "comitting");
indexer.commit();
seconds = (System.currentTimeMillis() / 1000 - seconds);
logAndCollect(info, pubcnt + " publications indexed in " + seconds + " seconds ...END at " + new Date());
return info.toString();
}
use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.
the class ConsistencyServiceImpl method findMissingPublications.
@Override
public List<String> findMissingPublications() {
List<String> missingPublications = new ArrayList<>();
Arrays.asList(XrefDatabase.PUB_MED, XrefDatabase.DOI).forEach(referenceDB -> {
List<String> ids = statementDao.findAllDistinctValuesforFieldWhereFieldEqualsValues(StatementField.REFERENCE_ACCESSION, new StatementSimpleWhereClauseQueryDSL(StatementField.REFERENCE_DATABASE, referenceDB.getName()));
for (String id : ids) {
if (id != null) {
Publication pub = publicationService.findPublicationByDatabaseAndAccession(referenceDB.getName(), id);
if (pub == null) {
missingPublications.add(referenceDB + id);
}
}
}
;
});
return missingPublications;
}
use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.
the class PublicationServiceTest method verifyFindPublicationsByMasterUniqueName.
@Test
public void verifyFindPublicationsByMasterUniqueName() {
Publication publication = mock(Publication.class);
when(publication.getPublicationId()).thenReturn(1L);
when(masterIdentifierService.findIdByUniqueName("NX_P12345")).thenReturn(100L);
when(publicationDao.findSortedPublicationsByMasterId(100L)).thenReturn(Arrays.asList(publication));
publicationService.findPublicationsByEntryName("NX_P12345");
verify(masterIdentifierService).findIdByUniqueName("NX_P12345");
verify(publicationDao).findSortedPublicationsByMasterId(100L);
verify(dbXrefService).findDbXRefByPublicationIds(Arrays.asList(1L));
verify(authorService).findAuthorsByPublicationIds(Arrays.asList(1L));
}
use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.
the class PublicationServiceIntegrationTest method testPublicationByDOI.
@Test
public void testPublicationByDOI() {
Publication publication = publicationService.findPublicationByDatabaseAndAccession("DOI", "10.1111/j.1349-7006.2012.02267.x");
Assert.assertEquals("High levels of DJ-1 protein in nipple fluid of patients with breast cancer.", publication.getTitle());
}
Aggregations