Search in sources :

Example 21 with Keywords

use of org.geotoolkit.sml.xml.v101.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 22 with Keywords

use of org.geotoolkit.sml.xml.v101.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 23 with Keywords

use of org.geotoolkit.sml.xml.v101.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 24 with Keywords

use of org.geotoolkit.sml.xml.v101.Keywords in project ORCID-Source by ORCID.

the class ValidateV2_1SamplesTest method testUnmarshallKeyword.

@Test
public void testUnmarshallKeyword() throws SAXException, URISyntaxException {
    Keywords keywords = (Keywords) unmarshallFromPath("/record_2.1/samples/read_samples/keywords-2.1.xml", Keywords.class, "/record_2.1/keyword-2.1.xsd");
    assertNotNull(keywords);
    assertNotNull(keywords.getKeywords());
    assertEquals(2, keywords.getKeywords().size());
    for (Keyword keyword : keywords.getKeywords()) {
        assertThat(keyword.getContent(), anyOf(is("keyword1"), is("keyword2")));
        assertThat(keyword.getPutCode(), anyOf(is(Long.valueOf(1)), is(Long.valueOf(2))));
        assertEquals(Visibility.PUBLIC.value(), keyword.getVisibility().value());
        assertNotNull(keyword.getCreatedDate());
        assertNotNull(keyword.getLastModifiedDate());
        assertNotNull(keyword.getSource());
        validateSourceInHttps(keyword.getSource());
        assertEquals("8888-8888-8888-8880", keyword.getSource().retrieveSourcePath());
    }
    Keyword keyword = (Keyword) unmarshallFromPath("/record_2.1/samples/read_samples/keyword-2.1.xml", Keyword.class);
    assertNotNull(keyword);
    assertEquals("keyword1", keyword.getContent());
    assertEquals(Long.valueOf(1), keyword.getPutCode());
    assertEquals(Visibility.PUBLIC.value(), keyword.getVisibility().value());
    assertNotNull(keyword.getCreatedDate());
    assertNotNull(keyword.getLastModifiedDate());
    assertNotNull(keyword.getSource());
    validateSourceInHttps(keyword.getSource());
    assertEquals("8888-8888-8888-8880", keyword.getSource().retrieveSourcePath());
}
Also used : Keywords(org.orcid.jaxb.model.record_v2.Keywords) Keyword(org.orcid.jaxb.model.record_v2.Keyword) Test(org.junit.Test)

Example 25 with Keywords

use of org.geotoolkit.sml.xml.v101.Keywords in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorTest method testViewKeywords.

@Test
public void testViewKeywords() {
    Response response = serviceDelegator.viewKeywords(ORCID);
    assertNotNull(response);
    Keywords keywords = (Keywords) response.getEntity();
    assertNotNull(keywords);
    assertNotNull(keywords.getLastModifiedDate());
    assertNotNull(keywords.getLastModifiedDate().getValue());
    assertEquals("/0000-0000-0000-0003/keywords", keywords.getPath());
    assertEquals(1, keywords.getKeywords().size());
    Keyword keyword = keywords.getKeywords().get(0);
    assertNotNull(keyword);
    assertNotNull(keyword.getLastModifiedDate());
    assertNotNull(keyword.getLastModifiedDate().getValue());
    assertEquals(Long.valueOf(9), keyword.getPutCode());
    assertEquals("PUBLIC", keyword.getContent());
    assertEquals(Visibility.PUBLIC.value(), keyword.getVisibility().value());
    assertEquals("/0000-0000-0000-0003/keywords/9", keyword.getPath());
    assertEquals("APP-5555555555555555", keyword.getSource().retrieveSourcePath());
}
Also used : Response(javax.ws.rs.core.Response) Keywords(org.orcid.jaxb.model.record_v2.Keywords) Keyword(org.orcid.jaxb.model.record_v2.Keyword) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)54 Keywords (org.orcid.jaxb.model.record_v2.Keywords)51 Keyword (org.orcid.jaxb.model.record_v2.Keyword)40 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