Search in sources :

Example 11 with ResearcherUrls

use of org.orcid.jaxb.model.message.ResearcherUrls in project ORCID-Source by ORCID.

the class OrcidProfileManagerBaseTest method createFullOrcidProfile.

protected OrcidProfile createFullOrcidProfile() {
    OrcidProfile profile2 = new OrcidProfile();
    profile2.setPassword("password");
    profile2.setVerificationCode("1234");
    profile2.setOrcidIdentifier(TEST_ORCID);
    OrcidBio bio = new OrcidBio();
    ContactDetails contactDetails = new ContactDetails();
    contactDetails.addOrReplacePrimaryEmail(new Email("will@orcid.org"));
    bio.setContactDetails(contactDetails);
    profile2.setOrcidBio(bio);
    PersonalDetails personalDetails = new PersonalDetails();
    personalDetails.setGivenNames(new GivenNames("William"));
    personalDetails.setFamilyName(new FamilyName("Simpson"));
    personalDetails.setCreditName(new CreditName("W. J. R. Simpson"));
    bio.setPersonalDetails(personalDetails);
    ResearcherUrls researcherUrls = new ResearcherUrls();
    researcherUrls.getResearcherUrl().add(new ResearcherUrl(new Url("http://www.wjrs.co.uk"), null));
    bio.setResearcherUrls(researcherUrls);
    Keywords keywords = new Keywords();
    bio.setKeywords(keywords);
    keywords.getKeyword().add(new Keyword("Java", null));
    bio.setBiography(new Biography("Will is a software developer at Semantico"));
    return profile2;
}
Also used : Email(org.orcid.jaxb.model.message.Email) Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) Keyword(org.orcid.jaxb.model.message.Keyword) FamilyName(org.orcid.jaxb.model.message.FamilyName) CreditName(org.orcid.jaxb.model.message.CreditName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.jaxb.model.message.GivenNames) Biography(org.orcid.jaxb.model.message.Biography) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl)

Example 12 with ResearcherUrls

use of org.orcid.jaxb.model.message.ResearcherUrls in project ORCID-Source by ORCID.

the class JpaJaxbEntityAdapterToOrcidProfileTest method checkOrcidProfile.

private void checkOrcidProfile(OrcidBio orcidBio) {
    checkPersonalDetails(orcidBio.getPersonalDetails());
    assertNotNull(orcidBio.getContactDetails());
    checkContactDetails(orcidBio.getContactDetails());
    assertNotNull(orcidBio.getExternalIdentifiers());
    checkExternalIdentifiers(orcidBio.getExternalIdentifiers());
    assertNotNull(orcidBio.getDelegation());
    checkDelegation(orcidBio.getDelegation());
    assertNull(orcidBio.getScope());
    // Applications are not linked with OrcidProfile object anymore.
    // assertNotNull(orcidBio.getApplications());
    // checkApplications(orcidBio.getApplications());
    ResearcherUrls researcherUrls = orcidBio.getResearcherUrls();
    List<ResearcherUrl> urls = researcherUrls.getResearcherUrl();
    Collections.sort(urls);
    assertEquals(6, urls.size());
    Url url1 = urls.get(0).getUrl();
    String url1Name = urls.get(0).getUrlName().getContent();
    assertEquals(url1Name, "443_1");
    assertEquals("http://www.researcherurl2.com?id=1", url1.getValue());
    Url url2 = urls.get(1).getUrl();
    String url2Name = urls.get(1).getUrlName().getContent();
    assertEquals(url2Name, "443_2");
    assertEquals("http://www.researcherurl2.com?id=2", url2.getValue());
    Url url3 = urls.get(2).getUrl();
    String url3Name = urls.get(2).getUrlName().getContent();
    assertEquals(url3Name, "443_3");
    assertEquals("http://www.researcherurl2.com?id=5", url3.getValue());
    Url url4 = urls.get(3).getUrl();
    String url4Name = urls.get(3).getUrlName().getContent();
    assertEquals(url4Name, "443_4");
    assertEquals("http://www.researcherurl2.com?id=6", url4.getValue());
    Url url5 = urls.get(4).getUrl();
    String url5Name = urls.get(4).getUrlName().getContent();
    assertEquals(url5Name, "443_5");
    assertEquals("http://www.researcherurl2.com?id=7", url5.getValue());
    Url url6 = urls.get(5).getUrl();
    String url6Name = urls.get(5).getUrlName().getContent();
    assertEquals(url6Name, "443_6");
    assertEquals("http://www.researcherurl2.com?id=8", url6.getValue());
    checkKeywords(orcidBio.getKeywords());
}
Also used : ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl)

Example 13 with ResearcherUrls

use of org.orcid.jaxb.model.message.ResearcherUrls in project ORCID-Source by ORCID.

the class T2OrcidApiServiceDelegatorTest method testDefaultPrivacyOnBio.

@Test
public void testDefaultPrivacyOnBio() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4499", ScopePathType.ORCID_BIO_UPDATE);
    OrcidMessage orcidMessage = new OrcidMessage();
    orcidMessage.setMessageVersion("1.2_rc6");
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier(new OrcidIdentifier("4444-4444-4444-4499"));
    orcidMessage.setOrcidProfile(orcidProfile);
    OrcidBio orcidBio = new OrcidBio();
    orcidProfile.setOrcidBio(orcidBio);
    PersonalDetails personalDetails = new PersonalDetails();
    orcidBio.setPersonalDetails(personalDetails);
    GivenNames givenNames = new GivenNames("Test given names");
    personalDetails.setGivenNames(givenNames);
    CreditName creditName = new CreditName("Credit Name");
    personalDetails.setCreditName(creditName);
    ExternalIdentifier id = new ExternalIdentifier();
    id.setExternalIdCommonName(new ExternalIdCommonName("cn1"));
    id.setExternalIdReference(new ExternalIdReference("value1"));
    orcidBio.setExternalIdentifiers(new ExternalIdentifiers());
    orcidBio.getExternalIdentifiers().getExternalIdentifier().add(id);
    personalDetails.setOtherNames(new OtherNames());
    personalDetails.getOtherNames().addOtherName("on1", null);
    orcidBio.setKeywords(new Keywords());
    orcidBio.getKeywords().getKeyword().add(new Keyword("kw1", null));
    orcidBio.setResearcherUrls(new ResearcherUrls());
    orcidBio.getResearcherUrls().getResearcherUrl().add(new ResearcherUrl(new Url("http://rurl2.com"), null));
    t2OrcidApiServiceDelegator.updateBioDetails(mockedUriInfo, "4444-4444-4444-4499", orcidMessage);
    OrcidProfile p = orcidProfileManager.retrieveOrcidProfile("4444-4444-4444-4499");
    assertEquals("cn1", p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
    assertEquals(Visibility.PUBLIC, p.getOrcidBio().getExternalIdentifiers().getVisibility());
    assertEquals("on1", p.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().get(0).getContent());
    assertEquals(Visibility.PUBLIC, p.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility());
    assertEquals("kw1", p.getOrcidBio().getKeywords().getKeyword().get(0).getContent());
    assertEquals(Visibility.PUBLIC, p.getOrcidBio().getKeywords().getVisibility());
    assertEquals(new Url("http://rurl2.com"), p.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrl());
    assertEquals(Visibility.PUBLIC, p.getOrcidBio().getResearcherUrls().getVisibility());
// now test what happens if we add a new one.
}
Also used : Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ExternalIdReference(org.orcid.jaxb.model.message.ExternalIdReference) Keyword(org.orcid.jaxb.model.message.Keyword) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) FundingExternalIdentifier(org.orcid.jaxb.model.message.FundingExternalIdentifier) OtherNames(org.orcid.jaxb.model.message.OtherNames) CreditName(org.orcid.jaxb.model.message.CreditName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ExternalIdCommonName(org.orcid.jaxb.model.message.ExternalIdCommonName) OrcidIdentifier(org.orcid.jaxb.model.message.OrcidIdentifier) GivenNames(org.orcid.jaxb.model.message.GivenNames) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) FundingExternalIdentifiers(org.orcid.jaxb.model.message.FundingExternalIdentifiers) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

ResearcherUrls (org.orcid.jaxb.model.message.ResearcherUrls)13 ResearcherUrl (org.orcid.jaxb.model.message.ResearcherUrl)11 Url (org.orcid.jaxb.model.message.Url)10 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)9 Keywords (org.orcid.jaxb.model.message.Keywords)8 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)7 Keyword (org.orcid.jaxb.model.message.Keyword)7 OtherNames (org.orcid.jaxb.model.message.OtherNames)7 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)7 ExternalIdentifier (org.orcid.jaxb.model.message.ExternalIdentifier)6 GivenNames (org.orcid.jaxb.model.message.GivenNames)6 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)6 Biography (org.orcid.jaxb.model.message.Biography)5 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)5 Email (org.orcid.jaxb.model.message.Email)5 ExternalIdCommonName (org.orcid.jaxb.model.message.ExternalIdCommonName)5 ExternalIdReference (org.orcid.jaxb.model.message.ExternalIdReference)5 FamilyName (org.orcid.jaxb.model.message.FamilyName)5 Test (org.junit.Test)4 CreditName (org.orcid.jaxb.model.message.CreditName)4