Search in sources :

Example 31 with OrcidProfile

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

the class OrcidIndexManagerImplTest method solrDocFilteredByNameVisibility.

private OrcidSolrDocument solrDocFilteredByNameVisibility() {
    OrcidSolrDocument orcidSolrDocument = fullyPopulatedSolrDocumentForPersistence();
    orcidSolrDocument.setCreditName(null);
    orcidSolrDocument.setOtherNames(null);
    orcidSolrDocument.setGivenNames(null);
    orcidSolrDocument.setFamilyName(null);
    orcidSolrDocument.setGivenAndFamilyNames(null);
    OrcidProfile orcidProfile = orcidProfileLimitedVisiblityCreditNameAndOtherNames();
    OrcidMessage orcidMessage = createFilteredOrcidMessage(orcidProfile);
    orcidSolrDocument.setPublicProfileMessage(orcidMessage.toString());
    return orcidSolrDocument;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage)

Example 32 with OrcidProfile

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

the class OrcidIndexManagerImplTest method getOrcidWithGrants.

private OrcidProfile getOrcidWithGrants() {
    OrcidProfile orcidWithGrants = getStandardOrcid();
    FundingList orcidFundings = new FundingList();
    Funding funding1 = new Funding();
    funding1.setVisibility(Visibility.PUBLIC);
    FundingTitle title = new FundingTitle();
    title.setTitle(new Title("grant 1"));
    funding1.setTitle(title);
    Funding funding2 = new Funding();
    funding2.setVisibility(Visibility.PUBLIC);
    FundingTitle title2 = new FundingTitle();
    title2.setTitle(new Title("grant 2"));
    funding2.setTitle(title2);
    Funding funding3 = new Funding();
    funding3.setVisibility(Visibility.LIMITED);
    FundingTitle title3 = new FundingTitle();
    title3.setTitle(new Title("grant 3"));
    funding3.setTitle(title3);
    Funding funding4 = new Funding();
    funding4.setVisibility(Visibility.PUBLIC);
    orcidFundings.getFundings().addAll(Arrays.asList(new Funding[] { funding1, funding2, funding3, funding4 }));
    orcidWithGrants.setFundings(orcidFundings);
    return orcidWithGrants;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) FundingList(org.orcid.jaxb.model.message.FundingList) Funding(org.orcid.jaxb.model.message.Funding) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) FundingTitle(org.orcid.jaxb.model.message.FundingTitle)

Example 33 with OrcidProfile

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

the class OrcidIndexManagerImplTest method onlyDoiPersistedFromOrcidWorks.

@Test
@Rollback
public void onlyDoiPersistedFromOrcidWorks() {
    OrcidProfile orcidProfileWithDOI = getStandardOrcidWithDoiInformation();
    OrcidSolrDocument doiListings = solrDocumentLimitedtoVisibleDoi();
    // check that the limited profiles or non doi identifiers aren't
    // included
    orcidIndexManager.persistProfileInformationForIndexing(orcidProfileWithDOI);
    verify(solrDao).persist(eq(doiListings));
    // now check null values aren't persisted when either the type or value
    // are missing
    OrcidWork orcidWork1 = orcidProfileWithDOI.retrieveOrcidWorks().getOrcidWork().get(0);
    orcidWork1.getWorkExternalIdentifiers().getWorkExternalIdentifier().get(0).setWorkExternalIdentifierType(null);
    OrcidWork orcidWork2 = orcidProfileWithDOI.retrieveOrcidWorks().getOrcidWork().get(1);
    orcidWork2.getWorkExternalIdentifiers().getWorkExternalIdentifier().get(0).setWorkExternalIdentifierId(null);
    // so this should leave only the second doi
    doiListings.setDigitalObjectIds(Arrays.asList(new String[] { "work2-doi2" }));
    OrcidMessage orcidMessage = createFilteredOrcidMessage(orcidProfileWithDOI);
    doiListings.setPublicProfileMessage(orcidMessage.toString());
    orcidIndexManager.persistProfileInformationForIndexing(orcidProfileWithDOI);
    verify(solrDao).persist(eq(doiListings));
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 34 with OrcidProfile

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

the class OrcidIndexManagerImplTest method orcidProfileLimitedVisiblityAffiliations.

private OrcidProfile orcidProfileLimitedVisiblityAffiliations() {
    OrcidProfile limitedOrcid = getStandardOrcid();
    List<Affiliation> affiliations = limitedOrcid.getOrcidActivities().getAffiliations().getAffiliation();
    for (Affiliation affiliation : affiliations) {
        affiliation.setVisibility(Visibility.LIMITED);
    }
    return limitedOrcid;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Affiliation(org.orcid.jaxb.model.message.Affiliation)

Example 35 with OrcidProfile

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

the class RegistrationControllerTest method createBasicProfile.

protected OrcidProfile createBasicProfile() {
    OrcidProfile profile = new OrcidProfile();
    profile.setPassword("password");
    profile.setVerificationCode("1234");
    profile.setSecurityQuestionAnswer("random answer");
    OrcidBio bio = new OrcidBio();
    ContactDetails contactDetails = new ContactDetails();
    contactDetails.addOrReplacePrimaryEmail(new Email("will@semantico.com"));
    bio.setContactDetails(contactDetails);
    profile.setOrcidBio(bio);
    PersonalDetails personalDetails = new PersonalDetails();
    bio.setPersonalDetails(personalDetails);
    personalDetails.setGivenNames(new GivenNames("Will"));
    personalDetails.setFamilyName(new FamilyName("Simpson"));
    bio.setBiography(new Biography("Will is a software developer"));
    ResearcherUrls researcherUrls = new ResearcherUrls();
    bio.setResearcherUrls(researcherUrls);
    researcherUrls.getResearcherUrl().add(new ResearcherUrl(new Url("http://www.wjrs.co.uk"), null));
    OrcidWorks orcidWorks = new OrcidWorks();
    profile.setOrcidWorks(orcidWorks);
    return profile;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Email(org.orcid.jaxb.model.message.Email) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) FamilyName(org.orcid.jaxb.model.message.FamilyName) 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) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks)

Aggregations

OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)241 Test (org.junit.Test)118 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)77 Transactional (org.springframework.transaction.annotation.Transactional)50 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)45 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)43 DBUnitTest (org.orcid.test.DBUnitTest)43 Rollback (org.springframework.test.annotation.Rollback)40 OrcidWorks (org.orcid.jaxb.model.message.OrcidWorks)36 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)35 Date (java.util.Date)27 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)27 OrcidIdentifier (org.orcid.jaxb.model.message.OrcidIdentifier)25 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)23 Affiliations (org.orcid.jaxb.model.message.Affiliations)22 FundingTitle (org.orcid.jaxb.model.message.FundingTitle)22 Title (org.orcid.jaxb.model.message.Title)22 Email (org.orcid.jaxb.model.message.Email)21 GivenNames (org.orcid.jaxb.model.message.GivenNames)21 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)21