Search in sources :

Example 1 with Keyword

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

the class MemberV2ApiServiceDelegatorImpl method viewKeyword.

@Override
public Response viewKeyword(String orcid, Long putCode) {
    Keyword keyword = profileKeywordManagerReadOnly.getKeyword(orcid, putCode);
    orcidSecurityManager.checkAndFilter(orcid, keyword, ScopePathType.ORCID_BIO_READ_LIMITED);
    ElementUtils.setPathToKeyword(keyword, orcid);
    sourceUtils.setSourceName(keyword);
    return Response.ok(keyword).build();
}
Also used : Keyword(org.orcid.jaxb.model.record_v2.Keyword)

Example 2 with Keyword

use of org.orcid.jaxb.model.record_v2.Keyword 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 3 with Keyword

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

the class Api2_0_rc4_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(Keywords keywords) {
    if (keywords != null && keywords.getKeywords() != null && !keywords.getKeywords().isEmpty()) {
        LastModifiedDate latest = null;
        for (Keyword keyword : keywords.getKeywords()) {
            if (keyword.getLastModifiedDate() != null && keyword.getLastModifiedDate().after(latest)) {
                latest = keyword.getLastModifiedDate();
            }
        }
        keywords.setLastModifiedDate(latest);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_rc4.LastModifiedDate) Keyword(org.orcid.jaxb.model.record_rc4.Keyword)

Example 4 with Keyword

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

the class Api2_0_rc3_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(Keywords keywords) {
    if (keywords != null && keywords.getKeywords() != null && !keywords.getKeywords().isEmpty()) {
        LastModifiedDate latest = null;
        for (Keyword keyword : keywords.getKeywords()) {
            if (keyword.getLastModifiedDate() != null && keyword.getLastModifiedDate().after(latest)) {
                latest = keyword.getLastModifiedDate();
            }
        }
        keywords.setLastModifiedDate(latest);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_rc3.LastModifiedDate) Keyword(org.orcid.jaxb.model.record_rc3.Keyword)

Example 5 with Keyword

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

the class KeywordForm method toKeyword.

public Keyword toKeyword() {
    Keyword keyword = new Keyword();
    if (!PojoUtil.isEmpty(putCode)) {
        keyword.setPutCode(Long.valueOf(putCode));
    }
    if (!PojoUtil.isEmpty(content)) {
        keyword.setContent(content);
    }
    if (visibility != null && visibility.getVisibility() != null) {
        keyword.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(visibility.getVisibility().value()));
    } else {
        keyword.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.KEYWORD_DEFAULT.getVisibility().value()));
    }
    if (createdDate != null) {
        keyword.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(createdDate.toCalendar())));
    }
    if (lastModified != null) {
        keyword.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(lastModified.toCalendar())));
    }
    if (displayIndex != null) {
        keyword.setDisplayIndex(displayIndex);
    } else {
        keyword.setDisplayIndex(0L);
    }
    keyword.setSource(new Source(source));
    return keyword;
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) Keyword(org.orcid.jaxb.model.record_v2.Keyword) CreatedDate(org.orcid.jaxb.model.common_v2.CreatedDate) Source(org.orcid.jaxb.model.common_v2.Source)

Aggregations

Test (org.junit.Test)89 Keyword (org.orcid.jaxb.model.record_v2.Keyword)82 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)47 OtherName (org.orcid.jaxb.model.record_v2.OtherName)46 Address (org.orcid.jaxb.model.record_v2.Address)45 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)45 Keywords (org.orcid.jaxb.model.record_v2.Keywords)44 Email (org.orcid.jaxb.model.record_v2.Email)41 Biography (org.orcid.jaxb.model.record_v2.Biography)35 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)34 Addresses (org.orcid.jaxb.model.record_v2.Addresses)32 Emails (org.orcid.jaxb.model.record_v2.Emails)32 Name (org.orcid.jaxb.model.record_v2.Name)32 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)32 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)32 Person (org.orcid.jaxb.model.record_v2.Person)30 ClientResponse (com.sun.jersey.api.client.ClientResponse)22 DBUnitTest (org.orcid.test.DBUnitTest)20 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)19 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)19