Search in sources :

Example 16 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method getFundingContributorWithoutOrcid.

private FundingContributors getFundingContributorWithoutOrcid() {
    FundingContributor contributor = new FundingContributor();
    contributor.setContributorEmail(new ContributorEmail("never@show.this"));
    contributor.setCreditName(new CreditName("original credit name"));
    FundingContributors fundingContributors = new FundingContributors();
    fundingContributors.getContributor().add(contributor);
    return fundingContributors;
}
Also used : FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) FundingContributors(org.orcid.jaxb.model.v3.dev1.record.FundingContributors) ContributorEmail(org.orcid.jaxb.model.v3.dev1.common.ContributorEmail)

Example 17 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method testFilterContributorPrivateDataForWorkWithPrivateName.

@Test
public void testFilterContributorPrivateDataForWorkWithPrivateName() {
    when(profileEntityManager.orcidExists(anyString())).thenReturn(true);
    when(profileEntityCacheManager.retrieve(anyString())).thenReturn(new ProfileEntity());
    when(cacheManager.getPublicCreditName(any(ProfileEntity.class))).thenReturn(null);
    Work work = getWorkWithOrcidContributor();
    contributorUtils.filterContributorPrivateData(work);
    Contributor contributor = work.getWorkContributors().getContributor().get(0);
    assertNull(contributor.getContributorEmail());
    assertEquals("", contributor.getCreditName().getContent());
}
Also used : Work(org.orcid.jaxb.model.v3.dev1.record.Work) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Test(org.junit.Test)

Example 18 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithPrivateName.

@Test
public void testFilterContributorPrivateDataForFundingWithPrivateName() {
    when(profileEntityManager.orcidExists(anyString())).thenReturn(true);
    when(profileEntityCacheManager.retrieve(anyString())).thenReturn(new ProfileEntity());
    when(cacheManager.getPublicCreditName(any(ProfileEntity.class))).thenReturn(null);
    Funding funding = getFundingWithOrcidContributor();
    contributorUtils.filterContributorPrivateData(funding);
    FundingContributor contributor = funding.getContributors().getContributor().get(0);
    assertNull(contributor.getContributorEmail());
    assertEquals("", contributor.getCreditName().getContent());
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Test(org.junit.Test)

Example 19 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method testFilterContributorPrivateDataForWorkWithNoOrcidRecord.

@Test
public void testFilterContributorPrivateDataForWorkWithNoOrcidRecord() {
    Work work = getWorkWithContributorWithoutOrcid();
    contributorUtils.filterContributorPrivateData(work);
    Contributor contributor = work.getWorkContributors().getContributor().get(0);
    assertNull(contributor.getContributorEmail());
    assertEquals("original credit name", contributor.getCreditName().getContent());
}
Also used : Work(org.orcid.jaxb.model.v3.dev1.record.Work) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor) Test(org.junit.Test)

Example 20 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method getWorkWithContributorWithoutOrcid.

private Work getWorkWithContributorWithoutOrcid() {
    Work work = new Work();
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("work with contributor without ORCID record"));
    work.setWorkTitle(workTitle);
    work.setWorkContributors(getWorkContributorWithoutOrcid());
    return work;
}
Also used : WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) Work(org.orcid.jaxb.model.v3.dev1.record.Work) Title(org.orcid.jaxb.model.v3.dev1.common.Title) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle)

Aggregations

FundingContributor (org.orcid.jaxb.model.v3.dev1.record.FundingContributor)24 Work (org.orcid.jaxb.model.v3.dev1.record.Work)14 Contributor (org.orcid.jaxb.model.v3.dev1.common.Contributor)12 CreditName (org.orcid.jaxb.model.v3.dev1.common.CreditName)11 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)11 Test (org.junit.Test)10 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)10 Title (org.orcid.jaxb.model.v3.dev1.common.Title)9 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)9 ContributorOrcid (org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid)8 FundingTitle (org.orcid.jaxb.model.v3.dev1.record.FundingTitle)7 ContributorEmail (org.orcid.jaxb.model.v3.dev1.common.ContributorEmail)6 WorkContributors (org.orcid.jaxb.model.v3.dev1.record.WorkContributors)6 ArrayList (java.util.ArrayList)5 Contributor (org.orcid.pojo.ajaxForm.Contributor)5 PublicationDate (org.orcid.jaxb.model.v3.dev1.common.PublicationDate)4 Url (org.orcid.jaxb.model.v3.dev1.common.Url)4 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)4 Amount (org.orcid.jaxb.model.v3.dev1.common.Amount)3 Country (org.orcid.jaxb.model.v3.dev1.common.Country)3