Search in sources :

Example 1 with DupicateResearcher

use of org.orcid.pojo.DupicateResearcher in project ORCID-Source by ORCID.

the class RegistrationController method getDupicateResearcher.

@RequestMapping(value = "/dupicateResearcher.json", method = RequestMethod.GET)
@ResponseBody
public List<DupicateResearcher> getDupicateResearcher(@RequestParam("givenNames") String givenNames, @RequestParam("familyNames") String familyNames) {
    List<DupicateResearcher> drList = new ArrayList<DupicateResearcher>();
    List<OrcidProfile> potentialDuplicates = findPotentialDuplicatesByFirstNameLastName(givenNames, familyNames);
    for (OrcidProfile op : potentialDuplicates) {
        DupicateResearcher dr = new DupicateResearcher();
        if (op.getOrcidBio() != null) {
            if (op.getOrcidBio().getContactDetails() != null) {
                if (op.getOrcidBio().getContactDetails().retrievePrimaryEmail() != null) {
                    dr.setEmail(op.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue());
                }
            }
            FamilyName familyName = op.getOrcidBio().getPersonalDetails().getFamilyName();
            if (familyName != null) {
                dr.setFamilyNames(familyName.getContent());
            }
            dr.setGivenNames(op.getOrcidBio().getPersonalDetails().getGivenNames().getContent());
            dr.setInstitution(null);
        }
        OrcidIdentifier orcidIdentifier = op.getOrcidIdentifier();
        // check for null just in case.
        if (orcidIdentifier != null) {
            dr.setOrcid(orcidIdentifier.getPath());
        }
        drList.add(dr);
    }
    return drList;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) DupicateResearcher(org.orcid.pojo.DupicateResearcher) FamilyName(org.orcid.jaxb.model.message.FamilyName) OrcidIdentifier(org.orcid.jaxb.model.message.OrcidIdentifier) ArrayList(java.util.ArrayList) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ArrayList (java.util.ArrayList)1 FamilyName (org.orcid.jaxb.model.message.FamilyName)1 OrcidIdentifier (org.orcid.jaxb.model.message.OrcidIdentifier)1 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)1 DupicateResearcher (org.orcid.pojo.DupicateResearcher)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1