use of org.springframework.dao.NonTransientDataAccessResourceException in project ORCID-Source by ORCID.
the class SolrDaoImpl method retrieveLastModified.
@Override
public Date retrieveLastModified(String orcid) {
SolrQuery query = new SolrQuery();
query.setQuery(ORCID + ":\"" + orcid + "\"");
query.setFields(PROFILE_LAST_MODIFIED_DATE);
try {
QueryResponse response = solrServer.query(query);
List<SolrDocument> results = response.getResults();
if (results.isEmpty()) {
return null;
} else {
return (Date) results.get(0).getFieldValue(PROFILE_LAST_MODIFIED_DATE);
}
} catch (SolrServerException e) {
throw new NonTransientDataAccessResourceException("Error retrieving last modified date from SOLR Server", e);
}
}
use of org.springframework.dao.NonTransientDataAccessResourceException in project ORCID-Source by ORCID.
the class FundingSubtypeSolrDaoImpl method getFundingTypes.
@Override
public List<OrgDefinedFundingTypeSolrDocument> getFundingTypes(String searchTerm, int firstResult, int maxResult) {
SolrQuery query = new SolrQuery();
query.setQuery("{!edismax qf='org-defined-funding-type^50.0 text^1.0' pf='org-defined-funding-type^50.0' mm=1 sort='score desc'}" + searchTerm + "*").setFields("*");
try {
QueryResponse queryResponse = solrServerReadOnly.query(query);
return queryResponse.getBeans(OrgDefinedFundingTypeSolrDocument.class);
} catch (SolrServerException se) {
String errorMessage = MessageFormat.format("Error when attempting to search for orgs, with search term {0}", new Object[] { searchTerm });
throw new NonTransientDataAccessResourceException(errorMessage, se);
}
}
use of org.springframework.dao.NonTransientDataAccessResourceException in project ORCID-Source by ORCID.
the class SolrIndexUpdater method persist.
public void persist(OrcidSolrDocument orcidSolrDocument) {
try {
solrServer.addBean(orcidSolrDocument);
solrServer.commit();
} catch (SolrServerException se) {
throw new NonTransientDataAccessResourceException("Error persisting to SOLR Server", se);
} catch (IOException ioe) {
throw new NonTransientDataAccessResourceException("IOException when persisting to SOLR", ioe);
}
}
use of org.springframework.dao.NonTransientDataAccessResourceException in project ORCID-Source by ORCID.
the class OrgDisambiguatedSolrDaoImpl method persist.
@Override
public void persist(OrgDisambiguatedSolrDocument orgDisambiguatedSolrDocument) {
try {
solrServer.addBean(orgDisambiguatedSolrDocument);
solrServer.commit();
} catch (SolrServerException se) {
throw new NonTransientDataAccessResourceException("Error persisting org to SOLR Server", se);
} catch (IOException ioe) {
throw new NonTransientDataAccessResourceException("IOException when persisting org to SOLR", ioe);
}
}
use of org.springframework.dao.NonTransientDataAccessResourceException in project ORCID-Source by ORCID.
the class SolrDaoImpl method removeOrcids.
@Override
public void removeOrcids(List<String> orcids) {
try {
solrServer.deleteById(orcids);
solrServer.commit();
} catch (SolrServerException se) {
throw new NonTransientDataAccessResourceException("Error deleting orcids from SOLR Server", se);
} catch (IOException ioe) {
throw new NonTransientDataAccessResourceException("Error deleting orcids from SOLR Server", ioe);
}
}
Aggregations