Search in sources :

Example 1 with FundingContributorAttributes

use of org.orcid.jaxb.model.v3.dev1.record.FundingContributorAttributes 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 2 with FundingContributorAttributes

use of org.orcid.jaxb.model.v3.dev1.record.FundingContributorAttributes in project ORCID-Source by ORCID.

the class ActivityValidatorTest method getFunding.

public Funding getFunding() {
    Funding funding = new Funding();
    Amount amount = new Amount();
    amount.setContent("1000");
    amount.setCurrencyCode("$");
    funding.setAmount(amount);
    FundingContributor contributor = new FundingContributor();
    FundingContributorAttributes attributes = new FundingContributorAttributes();
    attributes.setContributorRole(FundingContributorRole.LEAD);
    ContributorOrcid contributorOrcid = new ContributorOrcid();
    contributorOrcid.setHost("http://test.orcid.org");
    contributorOrcid.setPath("0000-0000-0000-0000");
    contributorOrcid.setUri("https://test.orcid.org/0000-0000-0000-0000");
    contributor.setContributorAttributes(attributes);
    contributor.setContributorOrcid(contributorOrcid);
    FundingContributors contributors = new FundingContributors();
    contributors.getContributor().add(contributor);
    funding.setContributors(contributors);
    funding.setDescription("description");
    funding.setEndDate(getFuzzyDate());
    funding.setExternalIdentifiers(getExternalIDs());
    funding.setOrganization(getOrganization());
    funding.setOrganizationDefinedType(new OrganizationDefinedFundingSubType("subtype"));
    funding.setStartDate(getFuzzyDate());
    FundingTitle title = new FundingTitle();
    title.setTitle(new Title("title"));
    title.setTranslatedTitle(new TranslatedTitle("translated title", "en"));
    funding.setTitle(title);
    funding.setType(FundingType.AWARD);
    funding.setUrl(new Url("http://test.orcid.org"));
    funding.setVisibility(Visibility.PUBLIC);
    return funding;
}
Also used : TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) Amount(org.orcid.jaxb.model.v3.dev1.common.Amount) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) FundingContributors(org.orcid.jaxb.model.v3.dev1.record.FundingContributors) FundingContributorAttributes(org.orcid.jaxb.model.v3.dev1.record.FundingContributorAttributes) Title(org.orcid.jaxb.model.v3.dev1.common.Title) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) ContributorOrcid(org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) Url(org.orcid.jaxb.model.v3.dev1.common.Url) OrganizationDefinedFundingSubType(org.orcid.jaxb.model.v3.dev1.common.OrganizationDefinedFundingSubType)

Aggregations

ContributorOrcid (org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid)2 FundingContributor (org.orcid.jaxb.model.v3.dev1.record.FundingContributor)2 FundingContributorAttributes (org.orcid.jaxb.model.v3.dev1.record.FundingContributorAttributes)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 Amount (org.orcid.jaxb.model.v3.dev1.common.Amount)1 ContributorEmail (org.orcid.jaxb.model.v3.dev1.common.ContributorEmail)1 CreditName (org.orcid.jaxb.model.v3.dev1.common.CreditName)1 OrganizationDefinedFundingSubType (org.orcid.jaxb.model.v3.dev1.common.OrganizationDefinedFundingSubType)1 Title (org.orcid.jaxb.model.v3.dev1.common.Title)1 TranslatedTitle (org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle)1 Url (org.orcid.jaxb.model.v3.dev1.common.Url)1 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)1 FundingContributors (org.orcid.jaxb.model.v3.dev1.record.FundingContributors)1 FundingTitle (org.orcid.jaxb.model.v3.dev1.record.FundingTitle)1 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)1