ApplicationService.class);
CrisSearchService searchService = dspace.getServiceManager()
.getServiceByName(CrisSearchService.class.getName(),
CrisSearchService.class);
PMCPersistenceService pmcService = dspace.getServiceManager()
.getServiceByName(PMCPersistenceService.class.getName(),
PMCPersistenceService.class);
List<ResearcherPage> rs = applicationService
.getList(ResearcherPage.class);
for (ResearcherPage rp : rs)
{
boolean updated = false;
int itemsCited = 0;
int citations = 0;
SolrQuery query = new SolrQuery();
query.setQuery("dc.identifier.pmid:[* TO *]");
query.addFilterQuery("{!field f=author_authority}"
+ ResearcherPageUtils.getPersistentIdentifier(rp),"NOT(withdrawn:true)");
query.setFields("dc.identifier.pmid");
query.setRows(Integer.MAX_VALUE);
QueryResponse response = searchService.search(query);
SolrDocumentList results = response.getResults();
for (SolrDocument doc : results)
{
Integer pmid = null;
try
{
pmid = Integer.valueOf((String) doc
.getFirstValue("dc.identifier.pmid"));
}
catch (NumberFormatException e)
{
log.warn("Found invalid pmid: "
+ doc.getFieldValue("dc.identifier.pmid")
+ " for rp: "
+ ResearcherPageUtils.getPersistentIdentifier(rp));
}
if (pmid != null)
{
PMCCitation pmccitation = pmcService.get(PMCCitation.class,
pmid);
if (pmccitation != null && pmccitation.getNumCitations() > 0)
{
itemsCited++;
citations += pmccitation.getNumCitations();