Search in sources :

Example 6 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class WorkFormTest method getWork.

public static Work getWork() {
    Work work = new Work();
    work.setCountry(new Country(Iso3166Country.US));
    Date date = new Date();
    work.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(date)));
    work.setJournalTitle(new Title("Journal Title"));
    work.setLanguageCode("EN");
    work.setPublicationDate(new PublicationDate(new Year(2015), new Month(1), new Day(1)));
    work.setPutCode(Long.valueOf("12345"));
    work.setShortDescription("Short description");
    work.setUrl(new Url("http://test.com"));
    work.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.LIMITED);
    work.setWorkCitation(new org.orcid.jaxb.model.v3.dev1.record.Citation("Citation", CitationType.BIBTEX));
    WorkContributors contributors = new WorkContributors();
    org.orcid.jaxb.model.v3.dev1.common.Contributor contributor = new org.orcid.jaxb.model.v3.dev1.common.Contributor();
    contributor.setCreditName(new CreditName("Credit name"));
    contributor.setContributorOrcid(new ContributorOrcid("0000-0000-0000-0000"));
    ContributorAttributes att = new ContributorAttributes();
    att.setContributorRole(ContributorRole.ASSIGNEE);
    att.setContributorSequence(SequenceType.FIRST);
    contributor.setContributorAttributes(att);
    contributors.getContributor().add(contributor);
    work.setWorkContributors(contributors);
    ExternalIDs weis = new ExternalIDs();
    ExternalID wei = new ExternalID();
    wei.setRelationship(Relationship.SELF);
    wei.setUrl(new Url("http://test.com"));
    wei.setValue("ID");
    wei.setType(WorkExternalIdentifierType.AGR.value());
    weis.getExternalIdentifier().add(wei);
    work.setWorkExternalIdentifiers(weis);
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("Work Title"));
    workTitle.setSubtitle(new Subtitle("Subtitle"));
    TranslatedTitle translated = new TranslatedTitle("Translated", "US");
    workTitle.setTranslatedTitle(translated);
    work.setWorkTitle(workTitle);
    work.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
    return work;
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) WorkContributors(org.orcid.jaxb.model.v3.dev1.record.WorkContributors) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) Url(org.orcid.jaxb.model.v3.dev1.common.Url) Month(org.orcid.jaxb.model.v3.dev1.common.Month) Work(org.orcid.jaxb.model.v3.dev1.record.Work) PublicationDate(org.orcid.jaxb.model.v3.dev1.common.PublicationDate) ContributorAttributes(org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) Title(org.orcid.jaxb.model.v3.dev1.common.Title) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) Date(java.util.Date) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate) PublicationDate(org.orcid.jaxb.model.v3.dev1.common.PublicationDate) Subtitle(org.orcid.jaxb.model.v3.dev1.common.Subtitle) Year(org.orcid.jaxb.model.v3.dev1.common.Year) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate) Iso3166Country(org.orcid.jaxb.model.v3.dev1.common.Iso3166Country) Country(org.orcid.jaxb.model.v3.dev1.common.Country) ContributorOrcid(org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid) Day(org.orcid.jaxb.model.v3.dev1.common.Day)

Example 7 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ActivityValidatorTest method getWork.

public Work getWork() {
    Work work = new Work();
    work.setCountry(new Country(Iso3166Country.US));
    work.setJournalTitle(new Title("journal-title"));
    work.setLanguageCode("en");
    work.setPublicationDate(new PublicationDate(getFuzzyDate()));
    work.setShortDescription("short-description");
    work.setUrl(new Url("http://test.orcid.org"));
    work.setVisibility(Visibility.PUBLIC);
    work.setWorkCitation(new Citation("citation", CitationType.FORMATTED_HARVARD));
    ContributorAttributes attributes = new ContributorAttributes();
    attributes.setContributorRole(ContributorRole.ASSIGNEE);
    attributes.setContributorSequence(SequenceType.FIRST);
    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 contributor = new Contributor();
    contributor.setContributorAttributes(attributes);
    contributor.setContributorOrcid(contributorOrcid);
    contributor.setCreditName(new CreditName("credit name"));
    contributor.setContributorEmail(new ContributorEmail("email@test.orcid.org"));
    WorkContributors contributors = new WorkContributors(Stream.of(contributor).collect(Collectors.toList()));
    work.setWorkContributors(contributors);
    work.setWorkExternalIdentifiers(getExternalIDs());
    work.setWorkTitle(getWorkTitle());
    work.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
    return work;
}
Also used : PublicationDate(org.orcid.jaxb.model.v3.dev1.common.PublicationDate) ContributorAttributes(org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes) FundingContributorAttributes(org.orcid.jaxb.model.v3.dev1.record.FundingContributorAttributes) WorkContributors(org.orcid.jaxb.model.v3.dev1.record.WorkContributors) Work(org.orcid.jaxb.model.v3.dev1.record.Work) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) Country(org.orcid.jaxb.model.v3.dev1.common.Country) Iso3166Country(org.orcid.jaxb.model.v3.dev1.common.Iso3166Country) Title(org.orcid.jaxb.model.v3.dev1.common.Title) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor) Citation(org.orcid.jaxb.model.v3.dev1.record.Citation) ContributorOrcid(org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid) ContributorEmail(org.orcid.jaxb.model.v3.dev1.common.ContributorEmail) Url(org.orcid.jaxb.model.v3.dev1.common.Url)

Example 8 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class BibtexManagerImpl method workToBibtex.

public String workToBibtex(Work work, String creditName) {
    StringBuffer out = new StringBuffer();
    switch(work.getWorkType()) {
        case JOURNAL_ARTICLE:
            out.append("@article{");
            break;
        case BOOK:
        case BOOK_CHAPTER:
            out.append("@book{");
            break;
        case CONFERENCE_PAPER:
        case CONFERENCE_ABSTRACT:
        case CONFERENCE_POSTER:
            out.append("@conference{");
            break;
        default:
            out.append("@misc{");
            break;
    }
    // id
    out.append(escapeStringForBibtex(creditName).replace(' ', '_') + work.getPutCode());
    // title
    out.append(",\ntitle={" + escapeStringForBibtex((work.getWorkTitle() != null) ? work.getWorkTitle().getTitle().getContent() : "No Title") + "}");
    // journal title
    if (work.getJournalTitle() != null) {
        out.append(",\njournal={" + escapeStringForBibtex(work.getJournalTitle().getContent()) + "}");
    }
    // name
    List<String> names = new ArrayList<String>();
    names.add(creditName);
    if (work.getWorkContributors() != null && work.getWorkContributors().getContributor() != null) {
        for (Contributor c : work.getWorkContributors().getContributor()) {
            if (c.getCreditName() != null && c.getCreditName().getContent() != null) {
                names.add(c.getCreditName().getContent());
            }
        }
    }
    out.append(",\nauthor={" + escapeStringForBibtex(Joiner.on(" and ").skipNulls().join(names)) + "}");
    // ids
    String doi = extractID(work, WorkExternalIdentifierType.DOI);
    String url = extractID(work, WorkExternalIdentifierType.URI);
    if (doi != null) {
        out.append(",\ndoi={" + escapeStringForBibtex(doi) + "}");
    }
    if (url != null) {
        out.append(",\nurl={" + escapeStringForBibtex(url) + "}");
    } else if (doi != null) {
        out.append(",\nurl={" + escapeStringForBibtex("http://doi.org/" + doi) + "}");
    } else {
        url = extractID(work, WorkExternalIdentifierType.HANDLE);
        if (url != null) {
            out.append(",\nurl={" + escapeStringForBibtex(url) + "}");
        }
    }
    String isbn = extractID(work, WorkExternalIdentifierType.ISBN);
    if (isbn != null)
        out.append(",\nisbn={" + escapeStringForBibtex(isbn) + "}");
    String issn = extractID(work, WorkExternalIdentifierType.ISSN);
    if (issn != null)
        out.append(",\nissn={" + escapeStringForBibtex(issn) + "}");
    // year
    if (work.getPublicationDate() != null) {
        int year = 0;
        try {
            year = Integer.parseInt(work.getPublicationDate().getYear().getValue());
        } catch (Exception e) {
        }
        if (year > 0) {
            out.append(",\nyear={" + year + "}");
        }
    }
    out.append("\n}");
    return out.toString();
}
Also used : ArrayList(java.util.ArrayList) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor)

Example 9 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor 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);
                }
            }
        }
    }
}
Also used : FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity)

Example 10 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithInvalidOrcidRecord.

@Test
public void testFilterContributorPrivateDataForFundingWithInvalidOrcidRecord() {
    when(profileEntityManager.orcidExists(anyString())).thenReturn(false);
    Funding funding = getFundingWithOrcidContributor();
    contributorUtils.filterContributorPrivateData(funding);
    FundingContributor contributor = funding.getContributors().getContributor().get(0);
    assertNull(contributor.getContributorEmail());
    assertEquals("original credit name", contributor.getCreditName().getContent());
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Test(org.junit.Test)

Aggregations

FundingContributor (org.orcid.jaxb.model.v3.dev1.record.FundingContributor)24 Work (org.orcid.jaxb.model.v3.dev1.record.Work)14 Contributor (org.orcid.jaxb.model.v3.dev1.common.Contributor)12 CreditName (org.orcid.jaxb.model.v3.dev1.common.CreditName)11 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)11 Test (org.junit.Test)10 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)10 Title (org.orcid.jaxb.model.v3.dev1.common.Title)9 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)9 ContributorOrcid (org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid)8 FundingTitle (org.orcid.jaxb.model.v3.dev1.record.FundingTitle)7 ContributorEmail (org.orcid.jaxb.model.v3.dev1.common.ContributorEmail)6 WorkContributors (org.orcid.jaxb.model.v3.dev1.record.WorkContributors)6 ArrayList (java.util.ArrayList)5 Contributor (org.orcid.pojo.ajaxForm.Contributor)5 PublicationDate (org.orcid.jaxb.model.v3.dev1.common.PublicationDate)4 Url (org.orcid.jaxb.model.v3.dev1.common.Url)4 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)4 Amount (org.orcid.jaxb.model.v3.dev1.common.Amount)3 Country (org.orcid.jaxb.model.v3.dev1.common.Country)3