use of org.orcid.jaxb.model.v3.dev1.record.FundingContributors 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.record.FundingContributors in project ORCID-Source by ORCID.
the class ContributorUtilsTest method getFundingContributorWithOrcid.
private FundingContributors getFundingContributorWithOrcid() {
ContributorOrcid contributorOrcid = new ContributorOrcid();
contributorOrcid.setPath("0000-0003-4902-6327");
contributorOrcid.setHost("orcid.org");
contributorOrcid.setUri("http://orcid.org/0000-0003-4902-6327");
FundingContributor contributor = new FundingContributor();
contributor.setContributorOrcid(contributorOrcid);
contributor.setContributorEmail(new ContributorEmail("never@show.this"));
contributor.setCreditName(new CreditName("original credit name"));
FundingContributors fundingContributors = new FundingContributors();
fundingContributors.getContributor().add(contributor);
return fundingContributors;
}
use of org.orcid.jaxb.model.v3.dev1.record.FundingContributors 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;
}
use of org.orcid.jaxb.model.v3.dev1.record.FundingContributors in project ORCID-Source by ORCID.
the class ActivityUtilsTest method getEmptyFunding.
private Funding getEmptyFunding() {
Funding f = new Funding();
FundingContributors fcs = new FundingContributors();
FundingContributor fc = new FundingContributor();
fc.setCreditName(new CreditName(""));
fcs.getContributor().add(fc);
f.setContributors(fcs);
return f;
}
use of org.orcid.jaxb.model.v3.dev1.record.FundingContributors in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getFundingMapperFacade.
public MapperFacade getFundingMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ConverterFactory converterFactory = mapperFactory.getConverterFactory();
converterFactory.registerConverter("fundingExternalIdentifiersConverterId", new JSONFundingExternalIdentifiersConverterV3());
converterFactory.registerConverter("fundingContributorsConverterId", new JsonOrikaConverter<FundingContributors>());
ClassMapBuilder<Funding, ProfileFundingEntity> fundingClassMap = mapperFactory.classMap(Funding.class, ProfileFundingEntity.class);
addV3CommonFields(fundingClassMap);
registerSourceConverters(mapperFactory, fundingClassMap);
fundingClassMap.field("type", "type");
fundingClassMap.field("organizationDefinedType.content", "organizationDefinedType");
fundingClassMap.field("title.title.content", "title");
fundingClassMap.field("title.translatedTitle.content", "translatedTitle");
fundingClassMap.field("title.translatedTitle.languageCode", "translatedTitleLanguageCode");
fundingClassMap.field("description", "description");
fundingClassMap.field("amount.content", "numericAmount");
fundingClassMap.field("amount.currencyCode", "currencyCode");
fundingClassMap.field("url.value", "url");
fundingClassMap.fieldBToA("org.name", "organization.name");
fundingClassMap.fieldBToA("org.city", "organization.address.city");
fundingClassMap.fieldBToA("org.region", "organization.address.region");
fundingClassMap.fieldBToA("org.country", "organization.address.country");
fundingClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
fundingClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
fundingClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
fundingClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("fundingExternalIdentifiersConverterId").add();
fundingClassMap.fieldMap("contributors", "contributorsJson").converter("fundingContributorsConverterId").add();
fundingClassMap.register();
ClassMapBuilder<FundingSummary, ProfileFundingEntity> fundingSummaryClassMap = mapperFactory.classMap(FundingSummary.class, ProfileFundingEntity.class);
addV3CommonFields(fundingSummaryClassMap);
registerSourceConverters(mapperFactory, fundingSummaryClassMap);
fundingSummaryClassMap.field("type", "type");
fundingSummaryClassMap.field("title.title.content", "title");
fundingSummaryClassMap.field("title.translatedTitle.content", "translatedTitle");
fundingSummaryClassMap.field("title.translatedTitle.languageCode", "translatedTitleLanguageCode");
fundingSummaryClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("fundingExternalIdentifiersConverterId").add();
fundingSummaryClassMap.fieldBToA("org.name", "organization.name");
fundingSummaryClassMap.fieldBToA("org.city", "organization.address.city");
fundingSummaryClassMap.fieldBToA("org.region", "organization.address.region");
fundingSummaryClassMap.fieldBToA("org.country", "organization.address.country");
fundingSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
fundingSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
fundingSummaryClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
fundingSummaryClassMap.register();
mapperFactory.classMap(FuzzyDate.class, StartDateEntity.class).field("year.value", "year").field("month.value", "month").field("day.value", "day").register();
mapperFactory.classMap(FuzzyDate.class, EndDateEntity.class).field("year.value", "year").field("month.value", "month").field("day.value", "day").register();
return mapperFactory.getMapperFacade();
}
Aggregations