Search in sources :

Example 21 with Contributor

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

the class ContributorUtilsTest method getWorkContributorWithoutOrcid.

private WorkContributors getWorkContributorWithoutOrcid() {
    Contributor contributor = new Contributor();
    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.v3.dev1.record.WorkContributors) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor) ContributorEmail(org.orcid.jaxb.model.v3.dev1.common.ContributorEmail)

Example 22 with Contributor

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

the class ActivityUtilsTest method getEmptyWork.

private Work getEmptyWork() {
    Work w = new Work();
    // Title
    WorkTitle title = new WorkTitle();
    title.setTitle(new Title(""));
    title.setSubtitle(new Subtitle(""));
    title.setTranslatedTitle(new TranslatedTitle(""));
    w.setWorkTitle(title);
    // Citation
    w.setWorkCitation(new Citation());
    WorkContributors wc = new WorkContributors();
    // Contributors
    Contributor c = new Contributor();
    c.setCreditName(new CreditName(""));
    wc.getContributor().add(c);
    w.setWorkContributors(wc);
    return w;
}
Also used : Subtitle(org.orcid.jaxb.model.v3.dev1.common.Subtitle) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) WorkContributors(org.orcid.jaxb.model.v3.dev1.record.WorkContributors) Work(org.orcid.jaxb.model.v3.dev1.record.Work) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) Title(org.orcid.jaxb.model.v3.dev1.common.Title) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor) Citation(org.orcid.jaxb.model.v3.dev1.record.Citation)

Example 23 with Contributor

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

the class Contributor method toFundingContributor.

public FundingContributor toFundingContributor() {
    FundingContributor c = new FundingContributor();
    if (this.getContributorRole() != null || this.getContributorSequence() != null) {
        FundingContributorAttributes ca = new FundingContributorAttributes();
        if (!PojoUtil.isEmpty(this.getContributorRole()))
            ca.setContributorRole(FundingContributorRole.fromValue(this.getContributorRole().getValue()));
        c.setContributorAttributes(ca);
    }
    if (this.getEmail() != null)
        c.setContributorEmail(new ContributorEmail(this.getEmail().getValue()));
    if (this.getOrcid() != null) {
        ContributorOrcid contributorOrcid = new ContributorOrcid(this.getOrcid().getValue());
        if (this.getUri() != null) {
            String uriString = this.getUri().getValue();
            if (StringUtils.isNotBlank(uriString)) {
                try {
                    URI uri = new URI(uriString);
                    contributorOrcid.setHost(uri.getHost());
                } catch (URISyntaxException e) {
                    throw new RuntimeException("Problem parsing contributor orcid uri", e);
                }
            }
        }
        contributorOrcid.setUri(this.getUri().getValue());
        c.setContributorOrcid(contributorOrcid);
    }
    if (this.getCreditName() != null) {
        CreditName cn = new CreditName(this.getCreditName().getValue());
        c.setCreditName(cn);
    }
    return c;
}
Also used : FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) FundingContributorAttributes(org.orcid.jaxb.model.v3.dev1.record.FundingContributorAttributes) ContributorOrcid(org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid) URISyntaxException(java.net.URISyntaxException) ContributorEmail(org.orcid.jaxb.model.v3.dev1.common.ContributorEmail) URI(java.net.URI)

Example 24 with Contributor

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

the class Contributor method valueOf.

public static Contributor valueOf(org.orcid.jaxb.model.v3.dev1.common.Contributor contributor) {
    Contributor c = new Contributor();
    if (contributor != null) {
        if (contributor.getContributorAttributes() != null) {
            contributor.getContributorAttributes();
            if (contributor.getContributorAttributes().getContributorRole() != null)
                c.setContributorRole(Text.valueOf(contributor.getContributorAttributes().getContributorRole().value()));
            if (contributor.getContributorAttributes().getContributorSequence() != null)
                c.setContributorSequence(Text.valueOf(contributor.getContributorAttributes().getContributorSequence().value()));
        }
        if (contributor.getContributorOrcid() != null) {
            c.setOrcid(Text.valueOf(contributor.getContributorOrcid().getPath()));
            c.setUri(Text.valueOf(contributor.getContributorOrcid().getUri()));
        }
        // Set default values that must be overwritten by the controller
        if (contributor.getCreditName() != null) {
            c.setCreditName(Text.valueOf(contributor.getCreditName().getContent()));
        }
    }
    return c;
}
Also used : FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor)

Example 25 with Contributor

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

the class Contributor method valueOf.

@Deprecated
public static Contributor valueOf(org.orcid.jaxb.model.message.FundingContributor contributor) {
    Contributor c = new Contributor();
    if (contributor != null) {
        if (contributor.getContributorAttributes() != null) {
            contributor.getContributorAttributes();
            if (contributor.getContributorAttributes().getContributorRole() != null)
                c.setContributorRole(Text.valueOf(contributor.getContributorAttributes().getContributorRole().value()));
        }
        if (contributor.getContributorEmail() != null)
            c.setEmail(Text.valueOf(contributor.getContributorEmail().getValue()));
        if (contributor.getContributorOrcid() != null) {
            c.setOrcid(Text.valueOf(contributor.getContributorOrcid().getPath()));
            c.setUri(Text.valueOf(contributor.getContributorOrcid().getUri()));
        }
        if (contributor.getCreditName() != null) {
            c.setCreditName(Text.valueOf(contributor.getCreditName().getContent()));
        }
    }
    return c;
}
Also used : FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor)

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