Search in sources :

Example 16 with CreditName

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;
}
Also used : Subtitle(org.orcid.jaxb.model.common_v2.Subtitle) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) WorkContributors(org.orcid.jaxb.model.record_v2.WorkContributors) Work(org.orcid.jaxb.model.record_v2.Work) CreditName(org.orcid.jaxb.model.common_v2.CreditName) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Title(org.orcid.jaxb.model.common_v2.Title) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) Contributor(org.orcid.jaxb.model.common_v2.Contributor) Citation(org.orcid.jaxb.model.record_v2.Citation)

Example 17 with CreditName

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;
}
Also used : Funding(org.orcid.jaxb.model.record_v2.Funding) FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) FundingContributors(org.orcid.jaxb.model.record_v2.FundingContributors) CreditName(org.orcid.jaxb.model.common_v2.CreditName)

Example 18 with CreditName

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\""));
}
Also used : MediaType(javax.ws.rs.core.MediaType) Record(org.orcid.jaxb.model.record_v2.Record) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 19 with CreditName

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;
}
Also used : FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) CreditName(org.orcid.jaxb.model.common_v2.CreditName) FundingContributors(org.orcid.jaxb.model.record_v2.FundingContributors) ContributorOrcid(org.orcid.jaxb.model.common_v2.ContributorOrcid) ContributorEmail(org.orcid.jaxb.model.common_v2.ContributorEmail)

Example 20 with CreditName

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);
                }
            }
        }
    }
}
Also used : CreditName(org.orcid.jaxb.model.common_v2.CreditName) FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) Contributor(org.orcid.jaxb.model.common_v2.Contributor) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity)

Aggregations

Test (org.junit.Test)17 CreditName (org.orcid.jaxb.model.common_v2.CreditName)16 Name (org.orcid.jaxb.model.record_v2.Name)10 CreditName (org.orcid.jaxb.model.record_v2.CreditName)9 FundingContributor (org.orcid.jaxb.model.record_v2.FundingContributor)9 FamilyName (org.orcid.jaxb.model.record_v2.FamilyName)8 GivenNames (org.orcid.jaxb.model.record_v2.GivenNames)8 IOException (java.io.IOException)5 InputStreamReader (java.io.InputStreamReader)5 Reader (java.io.Reader)5 Contributor (org.orcid.jaxb.model.common_v2.Contributor)5 ContributorEmail (org.orcid.jaxb.model.common_v2.ContributorEmail)5 Biography (org.orcid.jaxb.model.record_v2.Biography)4 Work (org.orcid.jaxb.model.record_v2.Work)4 WorkContributors (org.orcid.jaxb.model.record_v2.WorkContributors)4 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)4 ContributorOrcid (org.orcid.jaxb.model.common_v2.ContributorOrcid)3 ActivitiesSummary (org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)3 CreditName (org.orcid.jaxb.model.record_rc2.CreditName)3 CreditName (org.orcid.jaxb.model.record_rc4.CreditName)3