Search in sources :

Example 46 with Keywords

use of org.orcid.jaxb.model.record_rc2.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)

Example 47 with Keywords

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

the class ProfileKeywordManagerTest method getPublicTest.

@Test
public void getPublicTest() {
    String orcid = "0000-0000-0000-0003";
    Keywords elements = profileKeywordManager.getPublicKeywords(orcid, System.currentTimeMillis());
    assertNotNull(elements);
    assertNotNull(elements.getKeywords());
    assertEquals(1, elements.getKeywords().size());
    assertEquals(Long.valueOf(9), elements.getKeywords().get(0).getPutCode());
}
Also used : Keywords(org.orcid.jaxb.model.record_v2.Keywords) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 48 with Keywords

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

the class MemberV2ApiServiceDelegatorImpl method viewKeywords.

@Override
public Response viewKeywords(String orcid) {
    Keywords keywords = profileKeywordManagerReadOnly.getKeywords(orcid, getLastModifiedTime(orcid));
    // Lets copy the list so we don't modify the cached collection
    if (keywords.getKeywords() != null) {
        List<Keyword> filteredList = new ArrayList<Keyword>(keywords.getKeywords());
        keywords = new Keywords();
        keywords.setKeywords(filteredList);
    }
    orcidSecurityManager.checkAndFilter(orcid, keywords.getKeywords(), ScopePathType.ORCID_BIO_READ_LIMITED);
    ElementUtils.setPathToKeywords(keywords, orcid);
    Api2_0_LastModifiedDatesHelper.calculateLastModified(keywords);
    sourceUtils.setSourceName(keywords);
    return Response.ok(keywords).build();
}
Also used : Keywords(org.orcid.jaxb.model.record_v2.Keywords) Keyword(org.orcid.jaxb.model.record_v2.Keyword) ArrayList(java.util.ArrayList)

Example 49 with Keywords

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

the class KeywordsForm method toKeywords.

public Keywords toKeywords() {
    Keywords keywords = new Keywords();
    List<Keyword> kList = new ArrayList<Keyword>();
    for (KeywordForm form : this.keywords) {
        kList.add(form.toKeyword());
    }
    keywords.setKeywords(kList);
    return keywords;
}
Also used : Keywords(org.orcid.jaxb.model.record_v2.Keywords) Keyword(org.orcid.jaxb.model.record_v2.Keyword) ArrayList(java.util.ArrayList)

Example 50 with Keywords

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

the class ValidateV2_1SamplesTest method testMarshallKeyword.

@Test
public void testMarshallKeyword() throws JAXBException, SAXException, URISyntaxException {
    Keywords object = (Keywords) unmarshallFromPath("/record_2.1/samples/read_samples/keywords-2.1.xml", Keywords.class);
    marshall(object, "/record_2.1/keyword-2.1.xsd");
}
Also used : Keywords(org.orcid.jaxb.model.record_v2.Keywords) Test(org.junit.Test)

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