use of org.orcid.jaxb.model.record_rc3.FundingContributor 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() });
}
}
}
}
use of org.orcid.jaxb.model.record_rc3.FundingContributor in project ORCID-Source by ORCID.
the class ContributorUtils method filterContributorPrivateData.
public void filterContributorPrivateData(Funding funding) {
if (funding.getContributors() != null && funding.getContributors().getContributor() != null) {
for (FundingContributor contributor : funding.getContributors().getContributor()) {
contributor.setContributorEmail(null);
if (!PojoUtil.isEmpty(contributor.getContributorOrcid())) {
String contributorOrcid = contributor.getContributorOrcid().getPath();
if (profileEntityManager.orcidExists(contributorOrcid)) {
// contributor is an ORCID user - visibility of user's
// name in record must be taken into account
ProfileEntity profileEntity = profileEntityCacheManager.retrieve(contributorOrcid);
String publicContributorCreditName = cacheManager.getPublicCreditName(profileEntity);
CreditName creditName = new CreditName(publicContributorCreditName != null ? publicContributorCreditName : "");
contributor.setCreditName(creditName);
}
}
}
}
}
use of org.orcid.jaxb.model.record_rc3.FundingContributor 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("http://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;
}
use of org.orcid.jaxb.model.record_rc3.FundingContributor 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.record_rc3.FundingContributor in project ORCID-Source by ORCID.
the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithNoOrcidRecord.
@Test
public void testFilterContributorPrivateDataForFundingWithNoOrcidRecord() {
Funding funding = getFundingWithContributorWithoutOrcid();
contributorUtils.filterContributorPrivateData(funding);
FundingContributor contributor = funding.getContributors().getContributor().get(0);
assertNull(contributor.getContributorEmail());
assertEquals("original credit name", contributor.getCreditName().getContent());
}
Aggregations