Search in sources :

Example 1 with Contributor

use of org.orcid.jaxb.model.common_rc2.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.record_v2.Work) FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) Contributor(org.orcid.jaxb.model.common_v2.Contributor) Test(org.junit.Test)

Example 2 with Contributor

use of org.orcid.jaxb.model.common_rc2.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method getWorkContributorWithOrcid.

private WorkContributors getWorkContributorWithOrcid() {
    ContributorOrcid contributorOrcid = new ContributorOrcid();
    contributorOrcid.setPath("0000-0003-4902-6327");
    contributorOrcid.setHost("orcid.org");
    contributorOrcid.setUri("http://orcid.org/0000-0003-4902-6327");
    Contributor contributor = new Contributor();
    contributor.setContributorOrcid(contributorOrcid);
    contributor.setContributorEmail(new ContributorEmail("never@show.this"));
    contributor.setCreditName(new CreditName("original credit name"));
    return new WorkContributors(Arrays.asList(contributor));
}
Also used : WorkContributors(org.orcid.jaxb.model.record_v2.WorkContributors) CreditName(org.orcid.jaxb.model.common_v2.CreditName) FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) Contributor(org.orcid.jaxb.model.common_v2.Contributor) ContributorOrcid(org.orcid.jaxb.model.common_v2.ContributorOrcid) ContributorEmail(org.orcid.jaxb.model.common_v2.ContributorEmail)

Example 3 with Contributor

use of org.orcid.jaxb.model.common_rc2.Contributor in project ORCID-Source by ORCID.

the class MemberV2ApiServiceImplV2_0_rc1 method compareWorkAndCreditNameVisibility.

private void compareWorkAndCreditNameVisibility(Work work) {
    Visibility workVisibility = work.getVisibility();
    if (work.getWorkContributors() != null && work.getWorkContributors().getContributor() != null) {
        for (Contributor contributor : work.getWorkContributors().getContributor()) {
            if (contributor.getCreditName() != null && contributor.getCreditName().getVisibility() != null && contributor.getCreditName().getVisibility().isMoreRestrictiveThan(workVisibility)) {
                String title = (work.getWorkTitle() == null || work.getWorkTitle().getTitle() == null) ? null : work.getWorkTitle().getTitle().getContent();
                LOGGER.error("Client posting work '{}' with visibility ({}) less restrictive than its contributor credit name '{}' ({})", new Object[] { title, workVisibility, contributor.getCreditName().getContent(), contributor.getCreditName().getVisibility() });
            }
        }
    }
}
Also used : FundingContributor(org.orcid.jaxb.model.record_rc1.FundingContributor) Contributor(org.orcid.jaxb.model.common_rc1.Contributor) Visibility(org.orcid.jaxb.model.common_rc1.Visibility)

Example 4 with Contributor

use of org.orcid.jaxb.model.common_rc2.Contributor in project ORCID-Source by ORCID.

the class MemberV2ApiServiceImplV2_0_rc2 method compareFundingAndCreditNameVisibility.

private void compareFundingAndCreditNameVisibility(Funding funding) {
    Visibility fundingVisibility = funding.getVisibility();
    if (funding.getContributors() != null && funding.getContributors().getContributor() != null) {
        for (FundingContributor contributor : funding.getContributors().getContributor()) {
            if (contributor.getCreditName() != null && contributor.getCreditName().getVisibility() != null && contributor.getCreditName().getVisibility().isMoreRestrictiveThan(fundingVisibility)) {
                String title = (funding.getTitle() == null || funding.getTitle().getTitle() == null) ? null : funding.getTitle().getTitle().getContent();
                LOGGER.error("Client posting funding '{}' with visibility ({}) less restrictive than its contributor credit name '{}' ({})", new Object[] { title, fundingVisibility, contributor.getCreditName().getContent(), contributor.getCreditName().getVisibility() });
            }
        }
    }
}
Also used : FundingContributor(org.orcid.jaxb.model.record_rc2.FundingContributor) Visibility(org.orcid.jaxb.model.common_rc2.Visibility)

Example 5 with Contributor

use of org.orcid.jaxb.model.common_rc2.Contributor in project ORCID-Source by ORCID.

the class MemberV2ApiServiceImplV2_0_rc3 method compareWorkAndCreditNameVisibility.

private void compareWorkAndCreditNameVisibility(Work work) {
    Visibility workVisibility = work.getVisibility();
    if (work.getWorkContributors() != null && work.getWorkContributors().getContributor() != null) {
        for (Contributor contributor : work.getWorkContributors().getContributor()) {
            if (contributor.getCreditName() != null && contributor.getCreditName().getVisibility() != null && contributor.getCreditName().getVisibility().isMoreRestrictiveThan(workVisibility)) {
                String title = (work.getWorkTitle() == null || work.getWorkTitle().getTitle() == null) ? null : work.getWorkTitle().getTitle().getContent();
                LOGGER.error("Client posting work '{}' with visibility ({}) less restrictive than its contributor credit name '{}' ({})", new Object[] { title, workVisibility, contributor.getCreditName().getContent(), contributor.getCreditName().getVisibility() });
            }
        }
    }
}
Also used : FundingContributor(org.orcid.jaxb.model.record_rc3.FundingContributor) Contributor(org.orcid.jaxb.model.common_rc3.Contributor) Visibility(org.orcid.jaxb.model.common_rc3.Visibility)

Aggregations

Contributor (org.orcid.jaxb.model.common_v2.Contributor)12 FundingContributor (org.orcid.jaxb.model.record_v2.FundingContributor)9 Work (org.orcid.jaxb.model.record_v2.Work)7 CreditName (org.orcid.jaxb.model.common_v2.CreditName)5 WorkContributors (org.orcid.jaxb.model.record_v2.WorkContributors)5 Test (org.junit.Test)4 ContributorEmail (org.orcid.jaxb.model.common_v2.ContributorEmail)3 ContributorOrcid (org.orcid.jaxb.model.common_v2.ContributorOrcid)3 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)3 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)3 ArrayList (java.util.ArrayList)2 Visibility (org.orcid.jaxb.model.common_rc2.Visibility)2 Iso3166Country (org.orcid.jaxb.model.common_v2.Iso3166Country)2 PublicationDate (org.orcid.jaxb.model.common_v2.PublicationDate)2 FundingTitle (org.orcid.jaxb.model.record_v2.FundingTitle)2 CSLItemDataBuilder (de.undercouch.citeproc.csl.CSLItemDataBuilder)1 CSLNameBuilder (de.undercouch.citeproc.csl.CSLNameBuilder)1 IOException (java.io.IOException)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1