Search in sources :

Example 46 with PersonalDetails

use of org.orcid.jaxb.model.record_v2.PersonalDetails in project ORCID-Source by ORCID.

the class PersonalDetailsManagerReadOnlyImpl method getPersonalDetails.

@Override
public PersonalDetails getPersonalDetails(String orcid) {
    Date lastModified = getLastModifiedDate(orcid);
    long lastModifiedTime = lastModified.getTime();
    PersonalDetails personalDetails = new PersonalDetails();
    Name name = recordNameManager.getRecordName(orcid);
    if (name != null) {
        personalDetails.setName(name);
    }
    Biography bio = biographyManager.getBiography(orcid);
    if (bio != null) {
        personalDetails.setBiography(bio);
    }
    OtherNames otherNames = otherNameManager.getOtherNames(orcid);
    OtherNames filteredOtherNames = new OtherNames();
    personalDetails.setOtherNames(filteredOtherNames);
    if (otherNames != null && otherNames.getOtherNames() != null && !otherNames.getOtherNames().isEmpty()) {
        // Lets copy the list so we don't modify the cached collection
        List<OtherName> filteredList = new ArrayList<OtherName>(otherNames.getOtherNames());
        filteredOtherNames.setOtherNames(filteredList);
    }
    if (personalDetails.getLastModifiedDate() == null || personalDetails.getLastModifiedDate().getValue() == null) {
        personalDetails.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(lastModified)));
    }
    return personalDetails;
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) Biography(org.orcid.jaxb.model.record_v2.Biography) OtherName(org.orcid.jaxb.model.record_v2.OtherName) ArrayList(java.util.ArrayList) PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails) Date(java.util.Date) LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name)

Aggregations

Test (org.junit.Test)34 PersonalDetails (org.orcid.jaxb.model.record_v2.PersonalDetails)34 OtherName (org.orcid.jaxb.model.record_v2.OtherName)21 Biography (org.orcid.jaxb.model.record_v2.Biography)16 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)16 Name (org.orcid.jaxb.model.record_v2.Name)14 IOException (java.io.IOException)6 BaseTest (org.orcid.core.BaseTest)6 InputStreamReader (java.io.InputStreamReader)5 Reader (java.io.Reader)5 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)5 Response (javax.ws.rs.core.Response)4 Funding (org.orcid.jaxb.model.record_v2.Funding)4 DBUnitTest (org.orcid.test.DBUnitTest)4 ArrayList (java.util.ArrayList)3 Address (org.orcid.jaxb.model.record_v2.Address)3 Education (org.orcid.jaxb.model.record_v2.Education)3 Work (org.orcid.jaxb.model.record_v2.Work)3 Date (java.util.Date)2 LastModifiedDate (org.orcid.jaxb.model.common_v2.LastModifiedDate)2