Search in sources :

Example 1 with OtherNames

use of org.orcid.jaxb.model.record_rc4.OtherNames in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl method viewOtherNames.

@Override
public Response viewOtherNames(String orcid) {
    OtherNames otherNames = otherNameManagerReadOnly.getOtherNames(orcid, getLastModifiedTime(orcid));
    // Lets copy the list so we don't modify the cached collection
    if (otherNames.getOtherNames() != null) {
        List<OtherName> filteredList = new ArrayList<OtherName>(otherNames.getOtherNames());
        otherNames = new OtherNames();
        otherNames.setOtherNames(filteredList);
    }
    orcidSecurityManager.checkAndFilter(orcid, otherNames.getOtherNames(), ScopePathType.ORCID_BIO_READ_LIMITED);
    ElementUtils.setPathToOtherNames(otherNames, orcid);
    Api2_0_LastModifiedDatesHelper.calculateLastModified(otherNames);
    sourceUtils.setSourceName(otherNames);
    return Response.ok(otherNames).build();
}
Also used : OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) ArrayList(java.util.ArrayList) OtherName(org.orcid.jaxb.model.record_v2.OtherName)

Example 2 with OtherNames

use of org.orcid.jaxb.model.record_rc4.OtherNames in project ORCID-Source by ORCID.

the class PersonalDetailsManagerReadOnlyImpl method getPublicPersonalDetails.

@Override
public PersonalDetails getPublicPersonalDetails(String orcid) {
    Date lastModified = getLastModifiedDate(orcid);
    long lastModifiedTime = (lastModified == null) ? 0 : lastModified.getTime();
    PersonalDetails personalDetails = new PersonalDetails();
    Biography bio = biographyManager.getPublicBiography(orcid, lastModifiedTime);
    if (bio != null) {
        personalDetails.setBiography(bio);
    }
    Name name = recordNameManager.getRecordName(orcid, lastModifiedTime);
    if (name != null && !Visibility.PUBLIC.equals(name.getVisibility())) {
        personalDetails.setName(null);
    } else {
        personalDetails.setName(name);
    }
    OtherNames otherNames = otherNameManager.getPublicOtherNames(orcid, lastModifiedTime);
    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) ArrayList(java.util.ArrayList) OtherName(org.orcid.jaxb.model.record_v2.OtherName) 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)

Example 3 with OtherNames

use of org.orcid.jaxb.model.record_rc4.OtherNames in project ORCID-Source by ORCID.

the class PersonDetailsManagerReadOnlyImpl method getPersonDetails.

@Override
public Person getPersonDetails(String orcid) {
    long lastModifiedTime = getLastModified(orcid);
    Person person = new Person();
    person.setName(recordNameManager.getRecordName(orcid, lastModifiedTime));
    person.setBiography(biographyManager.getBiography(orcid, lastModifiedTime));
    Addresses addresses = addressManager.getAddresses(orcid, lastModifiedTime);
    if (addresses.getAddress() != null) {
        Addresses filteredAddresses = new Addresses();
        filteredAddresses.setAddress(new ArrayList<Address>(addresses.getAddress()));
        person.setAddresses(filteredAddresses);
    }
    PersonExternalIdentifiers extIds = externalIdentifierManager.getExternalIdentifiers(orcid, lastModifiedTime);
    if (extIds.getExternalIdentifiers() != null) {
        PersonExternalIdentifiers filteredExtIds = new PersonExternalIdentifiers();
        filteredExtIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers()));
        person.setExternalIdentifiers(filteredExtIds);
    }
    Keywords keywords = profileKeywordManager.getKeywords(orcid, lastModifiedTime);
    if (keywords.getKeywords() != null) {
        Keywords filteredKeywords = new Keywords();
        filteredKeywords.setKeywords(new ArrayList<Keyword>(keywords.getKeywords()));
        person.setKeywords(filteredKeywords);
    }
    OtherNames otherNames = otherNameManager.getOtherNames(orcid, lastModifiedTime);
    if (otherNames.getOtherNames() != null) {
        OtherNames filteredOtherNames = new OtherNames();
        filteredOtherNames.setOtherNames(new ArrayList<OtherName>(otherNames.getOtherNames()));
        person.setOtherNames(filteredOtherNames);
    }
    ResearcherUrls rUrls = researcherUrlManager.getResearcherUrls(orcid, lastModifiedTime);
    if (rUrls.getResearcherUrls() != null) {
        ResearcherUrls filteredRUrls = new ResearcherUrls();
        filteredRUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(rUrls.getResearcherUrls()));
        person.setResearcherUrls(filteredRUrls);
    }
    Emails emails = emailManager.getEmails(orcid, lastModifiedTime);
    if (emails.getEmails() != null) {
        Emails filteredEmails = new Emails();
        filteredEmails.setEmails(new ArrayList<Email>(emails.getEmails()));
        person.setEmails(filteredEmails);
    }
    return person;
}
Also used : Keywords(org.orcid.jaxb.model.record_v2.Keywords) Email(org.orcid.jaxb.model.record_v2.Email) Address(org.orcid.jaxb.model.record_v2.Address) Keyword(org.orcid.jaxb.model.record_v2.Keyword) OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) OtherName(org.orcid.jaxb.model.record_v2.OtherName) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Addresses(org.orcid.jaxb.model.record_v2.Addresses) PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Emails(org.orcid.jaxb.model.record_v2.Emails) Person(org.orcid.jaxb.model.record_v2.Person)

Example 4 with OtherNames

use of org.orcid.jaxb.model.record_rc4.OtherNames in project ORCID-Source by ORCID.

the class Api2_0_rc4_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(OtherNames otherNames) {
    if (otherNames != null && otherNames.getOtherNames() != null && !otherNames.getOtherNames().isEmpty()) {
        LastModifiedDate latest = null;
        for (OtherName otherName : otherNames.getOtherNames()) {
            if (otherName.getLastModifiedDate() != null && otherName.getLastModifiedDate().after(latest)) {
                latest = otherName.getLastModifiedDate();
            }
        }
        otherNames.setLastModifiedDate(latest);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_rc4.LastModifiedDate) OtherName(org.orcid.jaxb.model.record_rc4.OtherName)

Example 5 with OtherNames

use of org.orcid.jaxb.model.record_rc4.OtherNames in project ORCID-Source by ORCID.

the class OtherNamesForm method toOtherNames.

public OtherNames toOtherNames() {
    OtherNames otherNames = new OtherNames();
    List<OtherName> onList = new ArrayList<OtherName>();
    if (this.otherNames != null && !this.otherNames.isEmpty()) {
        for (OtherNameForm otherNameForm : this.otherNames) {
            onList.add(otherNameForm.toOtherName());
        }
    }
    otherNames.setOtherNames(onList);
    return otherNames;
}
Also used : OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) ArrayList(java.util.ArrayList) OtherName(org.orcid.jaxb.model.record_v2.OtherName)

Aggregations

OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)70 Test (org.junit.Test)61 OtherName (org.orcid.jaxb.model.record_v2.OtherName)55 Biography (org.orcid.jaxb.model.record_v2.Biography)47 Name (org.orcid.jaxb.model.record_v2.Name)40 Addresses (org.orcid.jaxb.model.record_v2.Addresses)35 Keywords (org.orcid.jaxb.model.record_v2.Keywords)35 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)35 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)35 Address (org.orcid.jaxb.model.record_v2.Address)34 Email (org.orcid.jaxb.model.record_v2.Email)33 Emails (org.orcid.jaxb.model.record_v2.Emails)33 Keyword (org.orcid.jaxb.model.record_v2.Keyword)33 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)33 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)33 Person (org.orcid.jaxb.model.record_v2.Person)25 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)15 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)15 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)15 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)15