Search in sources :

Example 36 with Keywords

use of org.orcid.jaxb.model.record_rc2.Keywords in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegator_KeywordsTest method testViewKeywordsReadPublic.

@Test
public void testViewKeywordsReadPublic() {
    SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
    Response r = serviceDelegator.viewKeywords(ORCID);
    Keywords element = (Keywords) r.getEntity();
    assertNotNull(element);
    assertEquals("/0000-0000-0000-0003/keywords", element.getPath());
    Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
Also used : Response(javax.ws.rs.core.Response) Keywords(org.orcid.jaxb.model.record_v2.Keywords) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 37 with Keywords

use of org.orcid.jaxb.model.record_rc2.Keywords in project ORCID-Source by ORCID.

the class JpaJaxbKeywordAdapterImpl method toKeywords.

@Override
public Keywords toKeywords(Collection<ProfileKeywordEntity> entities) {
    if (entities == null) {
        return null;
    }
    List<Keyword> keywordList = mapperFacade.mapAsList(entities, Keyword.class);
    Keywords keywords = new Keywords();
    keywords.setKeywords(keywordList);
    return keywords;
}
Also used : Keywords(org.orcid.jaxb.model.record_v2.Keywords) Keyword(org.orcid.jaxb.model.record_v2.Keyword)

Example 38 with Keywords

use of org.orcid.jaxb.model.record_rc2.Keywords in project ORCID-Source by ORCID.

the class SourceUtils method setSourceName.

public void setSourceName(Person person) {
    if (person == null) {
        return;
    }
    if (person.getAddresses() != null) {
        Addresses addresses = person.getAddresses();
        setSourceName(addresses);
    }
    if (person.getEmails() != null) {
        Emails emails = person.getEmails();
        setSourceName(emails);
    }
    if (person.getExternalIdentifiers() != null) {
        PersonExternalIdentifiers extIds = person.getExternalIdentifiers();
        setSourceName(extIds);
    }
    if (person.getKeywords() != null) {
        Keywords keywords = person.getKeywords();
        setSourceName(keywords);
    }
    if (person.getOtherNames() != null) {
        OtherNames otherNames = person.getOtherNames();
        setSourceName(otherNames);
    }
    if (person.getResearcherUrls() != null) {
        ResearcherUrls researcherUrls = person.getResearcherUrls();
        setSourceName(researcherUrls);
    }
}
Also used : Addresses(org.orcid.jaxb.model.record_v2.Addresses) Keywords(org.orcid.jaxb.model.record_v2.Keywords) PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) Emails(org.orcid.jaxb.model.record_v2.Emails)

Example 39 with Keywords

use of org.orcid.jaxb.model.record_rc2.Keywords in project ORCID-Source by ORCID.

the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.

public static Date calculateLatest(Keywords keywords) {
    Date latestAct = null;
    if (keywords != null && keywords.getKeywords() != null && !keywords.getKeywords().isEmpty()) {
        XMLGregorianCalendar latest = keywords.getKeywords().get(0).getLastModifiedDate().getValue();
        for (Keyword keyword : keywords.getKeywords()) {
            if (latest.compare(keyword.getLastModifiedDate().getValue()) == -1) {
                latest = keyword.getLastModifiedDate().getValue();
            }
        }
        latestAct = latest.toGregorianCalendar().getTime();
        keywords.setLastModifiedDate(new LastModifiedDate(latest));
    }
    return latestAct;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Keyword(org.orcid.jaxb.model.record_rc2.Keyword) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Date(java.util.Date)

Example 40 with Keywords

use of org.orcid.jaxb.model.record_rc2.Keywords in project ORCID-Source by ORCID.

the class ProfileKeywordManagerTest method getAllTest.

@Test
public void getAllTest() {
    String orcid = "0000-0000-0000-0003";
    Keywords elements = profileKeywordManager.getKeywords(orcid, System.currentTimeMillis());
    assertNotNull(elements);
    assertNotNull(elements.getKeywords());
    assertEquals(5, elements.getKeywords().size());
    boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
    for (Keyword element : elements.getKeywords()) {
        if (9 == element.getPutCode()) {
            found1 = true;
        } else if (10 == element.getPutCode()) {
            found2 = true;
        } else if (11 == element.getPutCode()) {
            found3 = true;
        } else if (12 == element.getPutCode()) {
            found4 = true;
        } else if (13 == element.getPutCode()) {
            found5 = true;
        } else {
            fail("Invalid put code found: " + element.getPutCode());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    assertTrue(found5);
}
Also used : Keywords(org.orcid.jaxb.model.record_v2.Keywords) Keyword(org.orcid.jaxb.model.record_v2.Keyword) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

Test (org.junit.Test)54 Keywords (org.orcid.jaxb.model.record_v2.Keywords)54 Keyword (org.orcid.jaxb.model.record_v2.Keyword)41 Addresses (org.orcid.jaxb.model.record_v2.Addresses)35 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)35 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)35 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)35 Biography (org.orcid.jaxb.model.record_v2.Biography)33 Emails (org.orcid.jaxb.model.record_v2.Emails)33 Address (org.orcid.jaxb.model.record_v2.Address)32 OtherName (org.orcid.jaxb.model.record_v2.OtherName)32 Email (org.orcid.jaxb.model.record_v2.Email)31 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)31 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)31 Name (org.orcid.jaxb.model.record_v2.Name)28 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