Search in sources :

Example 1 with SearchOrcidSolrCriteria

use of org.orcid.frontend.web.controllers.helper.SearchOrcidSolrCriteria in project ORCID-Source by ORCID.

the class RegistrationController method findPotentialDuplicatesByFirstNameLastName.

private List<OrcidProfile> findPotentialDuplicatesByFirstNameLastName(String firstName, String lastName) {
    LOGGER.debug("About to search for potential duplicates during registration for first name={}, last name={}", firstName, lastName);
    List<OrcidProfile> orcidProfiles = new ArrayList<OrcidProfile>();
    SearchOrcidSolrCriteria queryForm = new SearchOrcidSolrCriteria();
    queryForm.setGivenName(firstName);
    queryForm.setFamilyName(lastName);
    String query = queryForm.deriveQueryString();
    OrcidMessage visibleProfiles = orcidSearchManager.findOrcidsByQuery(query, DUP_SEARCH_START, DUP_SEARCH_ROWS);
    if (visibleProfiles.getOrcidSearchResults() != null) {
        for (OrcidSearchResult searchResult : visibleProfiles.getOrcidSearchResults().getOrcidSearchResult()) {
            orcidProfiles.add(searchResult.getOrcidProfile());
        }
    }
    LOGGER.debug("Found {} potential duplicates during registration for first name={}, last name={}", new Object[] { orcidProfiles.size(), firstName, lastName });
    return orcidProfiles;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSearchResult(org.orcid.jaxb.model.message.OrcidSearchResult) SearchOrcidSolrCriteria(org.orcid.frontend.web.controllers.helper.SearchOrcidSolrCriteria) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 SearchOrcidSolrCriteria (org.orcid.frontend.web.controllers.helper.SearchOrcidSolrCriteria)1 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)1 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)1 OrcidSearchResult (org.orcid.jaxb.model.message.OrcidSearchResult)1