use of org.orcid.jaxb.model.v3.dev1.common.OrganizationDefinedFundingSubType in project ORCID-Source by ORCID.
the class FundingForm method toFunding.
public Funding toFunding() {
Funding result = new Funding();
Amount orcidAmount = new Amount();
if (!PojoUtil.isEmpty(amount))
orcidAmount.setContent(amount.getValue());
if (!PojoUtil.isEmpty(currencyCode))
orcidAmount.setCurrencyCode(currencyCode.getValue());
result.setAmount(orcidAmount);
if (!PojoUtil.isEmpty(description))
result.setDescription(description.getValue());
if (!PojoUtil.isEmpty(startDate))
result.setStartDate(new FuzzyDate(startDate.toFuzzyDate()));
if (!PojoUtil.isEmpty(endDate))
result.setEndDate(new FuzzyDate(endDate.toFuzzyDate()));
if (!PojoUtil.isEmpty(putCode))
result.setPutCode(Long.valueOf(putCode.getValue()));
if (fundingTitle != null) {
result.setTitle(fundingTitle.toFundingTitle());
}
if (!PojoUtil.isEmpty(fundingType))
result.setType(FundingType.fromValue(fundingType.getValue()));
if (organizationDefinedFundingSubType != null && !PojoUtil.isEmpty(organizationDefinedFundingSubType.getSubtype()))
result.setOrganizationDefinedType(new OrganizationDefinedFundingSubType(organizationDefinedFundingSubType.getSubtype().getValue()));
if (!PojoUtil.isEmpty(url))
result.setUrl(new Url(url.getValue()));
else
result.setUrl(new Url());
if (visibility != null)
result.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(visibility.getVisibility().value()));
// Set Organization
Organization organization = new Organization();
if (!PojoUtil.isEmpty(fundingName))
organization.setName(fundingName.getValue());
OrganizationAddress organizationAddress = new OrganizationAddress();
organization.setAddress(organizationAddress);
if (!PojoUtil.isEmpty(city))
organizationAddress.setCity(city.getValue());
if (!PojoUtil.isEmpty(region)) {
organizationAddress.setRegion(region.getValue());
}
if (!PojoUtil.isEmpty(country)) {
organizationAddress.setCountry(Iso3166Country.fromValue(country.getValue()));
}
if (!PojoUtil.isEmpty(disambiguatedFundingSourceId)) {
organization.setDisambiguatedOrganization(new DisambiguatedOrganization());
organization.getDisambiguatedOrganization().setDisambiguatedOrganizationIdentifier(disambiguatedFundingSourceId.getValue());
organization.getDisambiguatedOrganization().setDisambiguationSource(disambiguationSource.getValue());
}
result.setOrganization(organization);
// Set contributors
if (contributors != null && !contributors.isEmpty()) {
FundingContributors fContributors = new FundingContributors();
for (Contributor contributor : contributors) {
if (!PojoUtil.isEmtpy(contributor))
fContributors.getContributor().add(contributor.toFundingContributor());
}
result.setContributors(fContributors);
}
// Set external identifiers
if (externalIdentifiers != null && !externalIdentifiers.isEmpty()) {
ExternalIDs fExternalIdentifiers = new ExternalIDs();
for (FundingExternalIdentifierForm fExternalIdentifier : externalIdentifiers) {
if (!PojoUtil.isEmtpy(fExternalIdentifier))
fExternalIdentifiers.getExternalIdentifier().add(fExternalIdentifier.toFundingExternalIdentifier());
}
result.setExternalIdentifiers(fExternalIdentifiers);
}
return result;
}
use of org.orcid.jaxb.model.v3.dev1.common.OrganizationDefinedFundingSubType 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;
}
Aggregations