Search in sources :

Example 1 with CreditName

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

the class T2OrcidApiServiceDelegatorTest method createStubOrcidMessage.

private OrcidMessage createStubOrcidMessage() {
    OrcidMessage orcidMessage = new OrcidMessage();
    orcidMessage.setMessageVersion("1.2_rc6");
    OrcidProfile orcidProfile = new OrcidProfile();
    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("Test credit name");
    personalDetails.setCreditName(creditName);
    creditName.setVisibility(Visibility.LIMITED);
    ContactDetails contactDetails = new ContactDetails();
    orcidBio.setContactDetails(contactDetails);
    return orcidMessage;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.jaxb.model.message.GivenNames) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) CreditName(org.orcid.jaxb.model.message.CreditName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails)

Example 2 with CreditName

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

the class JpaJaxbEntityAdapterToOrcidProfileTest method checkPersonalDetails.

private void checkPersonalDetails(PersonalDetails personalDetails) {
    assertNotNull(personalDetails);
    FamilyName familyName = personalDetails.getFamilyName();
    assertNotNull(familyName);
    assertEquals("Sellers", familyName.getContent());
    GivenNames givenNames = personalDetails.getGivenNames();
    assertNotNull(givenNames);
    assertEquals("Peter", givenNames.getContent());
    CreditName creditName = personalDetails.getCreditName();
    assertNotNull(creditName);
    assertEquals("P. Sellers III", creditName.getContent());
    assertEquals("LIMITED", creditName.getVisibility().name());
    OtherNames otherNames = personalDetails.getOtherNames();
    assertNotNull(otherNames);
    List<String> otherNameList = otherNames.getOtherNamesAsStrings();
    Collections.sort(otherNameList);
    assertEquals(2, otherNameList.size());
    assertEquals("Flibberdy Flabinah", otherNameList.get(0));
    assertEquals("Slibberdy Slabinah", otherNameList.get(1));
}
Also used : FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) GivenNames(org.orcid.jaxb.model.message.GivenNames) CreditName(org.orcid.jaxb.model.message.CreditName)

Example 3 with CreditName

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

the class OrcidSearchManagerImplTest method getOrcidProfileAllIndexFieldsPopulated.

private OrcidProfile getOrcidProfileAllIndexFieldsPopulated() {
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier("5678");
    OrcidBio orcidBio = new OrcidBio();
    PersonalDetails personalDetails = new PersonalDetails();
    personalDetails.setFamilyName(new FamilyName("Logan"));
    personalDetails.setGivenNames(new GivenNames("Donald Edward"));
    personalDetails.setCreditName(new CreditName("Stanley Higgins"));
    OtherNames otherNames = new OtherNames();
    otherNames.getOtherName().add(new OtherName("Edward Bass", null));
    otherNames.getOtherName().add(new OtherName("Gareth Dove", null));
    personalDetails.setOtherNames(otherNames);
    orcidBio.setPersonalDetails(personalDetails);
    orcidProfile.setOrcidBio(orcidBio);
    OrcidActivities orcidActivities = new OrcidActivities();
    orcidProfile.setOrcidActivities(orcidActivities);
    Affiliations affiliations = new Affiliations();
    orcidActivities.setAffiliations(affiliations);
    OrcidWorks orcidWorks = new OrcidWorks();
    orcidProfile.setOrcidWorks(orcidWorks);
    OrcidWork orcidWork1 = new OrcidWork();
    OrcidWork orcidWork2 = new OrcidWork();
    assignWorkIdentifers(orcidWork1, orcidWork2);
    orcidWorks.getOrcidWork().add(orcidWork1);
    orcidWorks.getOrcidWork().add(orcidWork2);
    orcidProfile.setOrcidWorks(orcidWorks);
    FundingList orcidFundings = new FundingList();
    orcidProfile.setFundings(orcidFundings);
    Funding funding1 = new Funding();
    funding1.setVisibility(Visibility.PUBLIC);
    FundingTitle title = new FundingTitle();
    title.setTitle(new Title("grant1"));
    funding1.setTitle(title);
    funding1.setDescription("Grant 1 - a short description");
    funding1.setPutCode("grant 1 - put-code");
    Funding funding2 = new Funding();
    funding2.setVisibility(Visibility.PUBLIC);
    FundingTitle title2 = new FundingTitle();
    title2.setTitle(new Title("grant2"));
    funding2.setTitle(title2);
    funding2.setDescription("Grant 2 - a short description");
    funding2.setPutCode("grant 2 - put-code");
    orcidFundings.getFundings().add(funding1);
    orcidFundings.getFundings().add(funding2);
    return orcidProfile;
}
Also used : OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) Funding(org.orcid.jaxb.model.message.Funding) CreditName(org.orcid.jaxb.model.message.CreditName) OtherName(org.orcid.jaxb.model.message.OtherName) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) Title(org.orcid.jaxb.model.message.Title) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) FundingList(org.orcid.jaxb.model.message.FundingList) Affiliations(org.orcid.jaxb.model.message.Affiliations) GivenNames(org.orcid.jaxb.model.message.GivenNames) FundingTitle(org.orcid.jaxb.model.message.FundingTitle)

Example 4 with CreditName

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

the class OrcidProfileManagerImplTest method setBio.

private void setBio(OrcidProfile profile, Visibility defaultVisibility) {
    OrcidBio bio = new OrcidBio();
    Biography biography = new Biography("This is my biography");
    if (defaultVisibility != null) {
        biography.setVisibility(defaultVisibility);
    }
    bio.setBiography(biography);
    ContactDetails contactDetails = new ContactDetails();
    Address address = new Address();
    address.setCountry(new Country(Iso3166Country.US));
    if (defaultVisibility != null) {
        address.getCountry().setVisibility(defaultVisibility);
    }
    contactDetails.setAddress(address);
    List<Email> emails = new ArrayList<Email>();
    Email email = new Email();
    email.setPrimary(true);
    email.setValue(System.currentTimeMillis() + "@test.orcid.org");
    emails.add(email);
    contactDetails.setEmail(emails);
    bio.setContactDetails(contactDetails);
    ExternalIdentifiers extIds = new ExternalIdentifiers();
    ExternalIdentifier extId = new ExternalIdentifier();
    extId.setExternalIdCommonName(new ExternalIdCommonName("common-name"));
    extId.setExternalIdReference(new ExternalIdReference("ext-id-reference"));
    extId.setExternalIdUrl(new ExternalIdUrl("http://orcid.org/ext-id"));
    extIds.getExternalIdentifier().add(extId);
    if (defaultVisibility != null) {
        extIds.setVisibility(defaultVisibility);
    }
    bio.setExternalIdentifiers(extIds);
    Keywords keywords = new Keywords();
    Keyword keyword = new Keyword();
    keyword.setContent("k1");
    keywords.getKeyword().add(keyword);
    if (defaultVisibility != null) {
        keywords.setVisibility(defaultVisibility);
    }
    bio.setKeywords(keywords);
    PersonalDetails personalDetails = new PersonalDetails();
    personalDetails.setCreditName(new CreditName("credit-name"));
    personalDetails.setGivenNames(new GivenNames("given-names"));
    personalDetails.setFamilyName(new FamilyName("family-name"));
    OtherNames otherNames = new OtherNames();
    OtherName otherName = new OtherName();
    otherName.setContent("o1");
    otherNames.getOtherName().add(otherName);
    if (defaultVisibility != null) {
        otherNames.setVisibility(defaultVisibility);
    }
    personalDetails.setOtherNames(otherNames);
    bio.setPersonalDetails(personalDetails);
    ResearcherUrls researcherUrls = new ResearcherUrls();
    ResearcherUrl researcherUrl = new ResearcherUrl();
    researcherUrl.setUrl(new Url("http://orcid.org/researcher-url-1"));
    researcherUrl.setUrlName(new UrlName("url-name-1"));
    researcherUrls.getResearcherUrl().add(researcherUrl);
    if (defaultVisibility != null) {
        researcherUrls.setVisibility(defaultVisibility);
    }
    bio.setResearcherUrls(researcherUrls);
    profile.setOrcidBio(bio);
}
Also used : Email(org.orcid.jaxb.model.message.Email) Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) Address(org.orcid.jaxb.model.message.Address) OrganizationAddress(org.orcid.jaxb.model.message.OrganizationAddress) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) ArrayList(java.util.ArrayList) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) ExternalIdCommonName(org.orcid.jaxb.model.message.ExternalIdCommonName) 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) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) FundingExternalIdentifiers(org.orcid.jaxb.model.message.FundingExternalIdentifiers) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) ExternalIdReference(org.orcid.jaxb.model.message.ExternalIdReference) Keyword(org.orcid.jaxb.model.message.Keyword) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) FundingExternalIdentifier(org.orcid.jaxb.model.message.FundingExternalIdentifier) CreditName(org.orcid.jaxb.model.message.CreditName) OtherName(org.orcid.jaxb.model.message.OtherName) UrlName(org.orcid.jaxb.model.message.UrlName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Country(org.orcid.jaxb.model.message.Country) Iso3166Country(org.orcid.jaxb.model.message.Iso3166Country)

Example 5 with CreditName

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

the class Api12MembersTest method personUpdateTest.

@Test
public void personUpdateTest() throws InterruptedException, JSONException {
    String clientId = getClient1ClientId();
    String clientRedirectUri = getClient1RedirectUri();
    String clientSecret = getClient1ClientSecret();
    String userId = getUser1OrcidId();
    String password = getUser1Password();
    String giveName = getUser1GivenName();
    String familyName = getUser1FamilyNames();
    String creditName = getUser1CreditName();
    String accessToken = getAccessToken(userId, password, Arrays.asList("/person/update", "/orcid-bio/read-limited"), clientId, clientSecret, clientRedirectUri, true);
    OrcidMessage orcidMessage = new OrcidMessage();
    orcidMessage.setMessageVersion(OrcidMessage.DEFAULT_VERSION);
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidMessage.setOrcidProfile(orcidProfile);
    OrcidBio orcidBio = new OrcidBio();
    PersonalDetails personalDetails = new PersonalDetails();
    personalDetails.setGivenNames(new GivenNames("My given name"));
    personalDetails.setFamilyName(new FamilyName("My family name"));
    CreditName creditNameElement = new CreditName("My credit name");
    creditNameElement.setVisibility(Visibility.LIMITED);
    personalDetails.setCreditName(creditNameElement);
    orcidBio.setPersonalDetails(personalDetails);
    orcidProfile.setOrcidBio(orcidBio);
    ClientResponse clientResponse = t2OAuthClient_1_2.updateBioDetailsXml(userId, orcidMessage, accessToken);
    assertEquals(200, clientResponse.getStatus());
    ClientResponse response = t2OAuthClient_1_2.viewBioDetailsXml(userId, accessToken);
    assertNotNull(response);
    assertEquals(200, response.getStatus());
    OrcidMessage orcidMessageWithBio = response.getEntity(OrcidMessage.class);
    assertNotNull(orcidMessageWithBio);
    assertNotNull(orcidMessageWithBio.getOrcidProfile());
    assertNotNull(orcidMessageWithBio.getOrcidProfile().getOrcidBio());
    assertNotNull(orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails());
    assertNotNull(orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getGivenNames());
    assertEquals("My given name", orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getGivenNames().getContent());
    assertNotNull(orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getFamilyName());
    assertEquals("My family name", orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getFamilyName().getContent());
    assertNotNull(orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getCreditName());
    assertEquals("My credit name", orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getCreditName().getContent());
    assertEquals(Visibility.LIMITED, orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getCreditName().getVisibility());
    //Rollback changes
    orcidMessage = new OrcidMessage();
    orcidMessage.setMessageVersion(OrcidMessage.DEFAULT_VERSION);
    orcidProfile = new OrcidProfile();
    orcidMessage.setOrcidProfile(orcidProfile);
    orcidBio = new OrcidBio();
    personalDetails = new PersonalDetails();
    personalDetails.setGivenNames(new GivenNames(giveName));
    personalDetails.setFamilyName(new FamilyName(familyName));
    creditNameElement = new CreditName(creditName);
    creditNameElement.setVisibility(Visibility.PUBLIC);
    personalDetails.setCreditName(creditNameElement);
    orcidBio.setPersonalDetails(personalDetails);
    orcidProfile.setOrcidBio(orcidBio);
    clientResponse = t2OAuthClient_1_2.updateBioDetailsXml(userId, orcidMessage, accessToken);
    assertEquals(200, clientResponse.getStatus());
    response = t2OAuthClient_1_2.viewBioDetailsXml(userId, accessToken);
    assertNotNull(response);
    assertEquals(200, response.getStatus());
    orcidMessageWithBio = response.getEntity(OrcidMessage.class);
    assertNotNull(orcidMessageWithBio);
    assertNotNull(orcidMessageWithBio.getOrcidProfile());
    assertNotNull(orcidMessageWithBio.getOrcidProfile().getOrcidBio());
    assertNotNull(orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails());
    assertNotNull(orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getGivenNames());
    assertEquals(giveName, orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getGivenNames().getContent());
    assertNotNull(orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getFamilyName());
    assertEquals(familyName, orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getFamilyName().getContent());
    assertNotNull(orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getCreditName());
    assertEquals(creditName, orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getCreditName().getContent());
    assertEquals(Visibility.PUBLIC, orcidMessageWithBio.getOrcidProfile().getOrcidBio().getPersonalDetails().getCreditName().getVisibility());
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ClientResponse(com.sun.jersey.api.client.ClientResponse) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) GivenNames(org.orcid.jaxb.model.message.GivenNames) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) CreditName(org.orcid.jaxb.model.message.CreditName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Test(org.junit.Test)

Aggregations

CreditName (org.orcid.jaxb.model.message.CreditName)24 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)14 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)14 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)14 GivenNames (org.orcid.jaxb.model.message.GivenNames)11 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)9 FamilyName (org.orcid.jaxb.model.message.FamilyName)9 OtherNames (org.orcid.jaxb.model.message.OtherNames)8 Email (org.orcid.jaxb.model.message.Email)7 Test (org.junit.Test)6 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)6 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)6 Url (org.orcid.jaxb.model.message.Url)6 ExternalIdentifier (org.orcid.jaxb.model.message.ExternalIdentifier)5 Keyword (org.orcid.jaxb.model.message.Keyword)5 Keywords (org.orcid.jaxb.model.message.Keywords)5 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)5 WorkExternalIdentifiers (org.orcid.jaxb.model.message.WorkExternalIdentifiers)5 Biography (org.orcid.jaxb.model.message.Biography)4 Contributor (org.orcid.jaxb.model.message.Contributor)4