use of org.orcid.jaxb.model.record_v2.CreditName 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;
}
use of org.orcid.jaxb.model.record_v2.CreditName 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.record_v2.CreditName in project ORCID-Source by ORCID.
the class RDFWriterTest method missingCreditName.
@Test
public void missingCreditName() throws Exception {
ByteArrayOutputStream entityStream = new ByteArrayOutputStream(1024);
Record fakeBio = fakeBio();
// empty creditName
fakeBio.getPerson().getName().setCreditName(null);
// fakeBio.getOrcidProfile().getOrcidBio().getPersonalDetails().setCreditName(null);
rdfWriter.writeTo(fakeBio, Record.class, null, null, new MediaType("text", "turtle"), null, entityStream);
String str = entityStream.toString("utf-8");
System.out.println(str);
// Should NOT include a foaf:name
assertFalse(str.contains("foaf:name"));
// but do include a concatenation as a label
assertTrue(str.contains("rdfs:label"));
assertTrue(str.contains("\"John Doe\""));
// And family/given
assertTrue(str.contains("foaf:familyName"));
assertTrue(str.contains("\"Doe\""));
assertTrue(str.contains("foaf:givenName"));
assertTrue(str.contains("\"John\""));
}
use of org.orcid.jaxb.model.record_v2.CreditName 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.record_v2.CreditName in project ORCID-Source by ORCID.
the class ContributorUtils method filterContributorPrivateData.
public void filterContributorPrivateData(Work work) {
if (work.getWorkContributors() != null && work.getWorkContributors().getContributor() != null) {
for (Contributor contributor : work.getWorkContributors().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);
}
}
}
}
}
Aggregations