Search in sources :

Example 1 with ContributorAttributes

use of org.orcid.jaxb.model.message.ContributorAttributes in project ORCID-Source by ORCID.

the class CurrentWorkContributor method retrieveContributorAttributes.

private ContributorAttributes retrieveContributorAttributes(Contributor contributor) {
    ContributorAttributes attributes = contributor.getContributorAttributes();
    if (attributes == null) {
        attributes = new ContributorAttributes();
        contributor.setContributorAttributes(attributes);
    }
    return attributes;
}
Also used : ContributorAttributes(org.orcid.jaxb.model.message.ContributorAttributes)

Example 2 with ContributorAttributes

use of org.orcid.jaxb.model.message.ContributorAttributes in project ORCID-Source by ORCID.

the class CurrentWorkContributor method getContributor.

public Contributor getContributor() {
    Contributor contributor = new Contributor();
    if (StringUtils.isNotBlank(orcid)) {
        contributor.setContributorOrcid(new ContributorOrcid(orcid));
    }
    if (StringUtils.isNotBlank(creditName)) {
        contributor.setCreditName(new CreditName(creditName));
    }
    if (StringUtils.isNotBlank(email)) {
        contributor.setContributorEmail(new ContributorEmail(email));
    }
    if (StringUtils.isNotBlank(role)) {
        ContributorAttributes attributes = retrieveContributorAttributes(contributor);
        ContributorRole contributorRole = ContributorRole.fromValue(role);
        attributes.setContributorRole(contributorRole);
    }
    if (StringUtils.isNotBlank(sequence)) {
        ContributorAttributes attributes = retrieveContributorAttributes(contributor);
        SequenceType sequenceType = SequenceType.fromValue(sequence);
        attributes.setContributorSequence(sequenceType);
    }
    return contributor;
}
Also used : ContributorRole(org.orcid.jaxb.model.message.ContributorRole) ContributorAttributes(org.orcid.jaxb.model.message.ContributorAttributes) CreditName(org.orcid.jaxb.model.message.CreditName) Contributor(org.orcid.jaxb.model.message.Contributor) ContributorOrcid(org.orcid.jaxb.model.message.ContributorOrcid) SequenceType(org.orcid.jaxb.model.message.SequenceType) ContributorEmail(org.orcid.jaxb.model.message.ContributorEmail)

Example 3 with ContributorAttributes

use of org.orcid.jaxb.model.message.ContributorAttributes in project ORCID-Source by ORCID.

the class Publication method getOrcidWork.

public OrcidWork getOrcidWork() {
    initCrossRefContext();
    OrcidWork orcidWork = new OrcidWork();
    if (StringUtils.isNotBlank(doi)) {
        WorkExternalIdentifier doiExtId = new WorkExternalIdentifier();
        doiExtId.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
        doiExtId.setWorkExternalIdentifierId(new WorkExternalIdentifierId(doi));
        WorkExternalIdentifiers workExtIds = new WorkExternalIdentifiers();
        orcidWork.setWorkExternalIdentifiers(workExtIds);
        workExtIds.getWorkExternalIdentifier().add(doiExtId);
    }
    if (StringUtils.isNotBlank(title)) {
        WorkTitle workTitle = new WorkTitle();
        orcidWork.setWorkTitle(workTitle);
        workTitle.setTitle(new Title(title));
    }
    // Will throw an IllegalArgumentException if not valid
    CitationType cType = CitationType.fromValue(citationType);
    Citation citation = new Citation(fullCitation, cType);
    orcidWork.setWorkCitation(citation);
    String publicationDateString = crossRefContext.getDate();
    if (StringUtils.isNotBlank(publicationDateString)) {
        XMLGregorianCalendar publicationDateGregCal = DateUtils.convertToXMLGregorianCalendar(publicationDateString);
        if (publicationDateGregCal != null) {
            Year publicationyear = new Year(publicationDateGregCal.getYear());
            Month publicationMonth = publicationDateGregCal.getMonth() == DatatypeConstants.FIELD_UNDEFINED ? null : new Month(publicationDateGregCal.getMonth());
            Day publicationDay = publicationDateGregCal.getDay() == DatatypeConstants.FIELD_UNDEFINED ? null : new Day(publicationDateGregCal.getDay());
            orcidWork.setPublicationDate(new PublicationDate(publicationyear, publicationMonth, publicationDay));
        }
    }
    String author = crossRefContext.getAuthor();
    if (StringUtils.isNotBlank(author)) {
        WorkContributors workContributors = new WorkContributors();
        orcidWork.setWorkContributors(workContributors);
        Contributor contributor = new Contributor();
        workContributors.getContributor().add(contributor);
        contributor.setCreditName(new CreditName(author));
        ContributorAttributes contributorAttributes = new ContributorAttributes();
        contributor.setContributorAttributes(contributorAttributes);
        contributorAttributes.setContributorRole(ContributorRole.AUTHOR);
        contributorAttributes.setContributorSequence(SequenceType.FIRST);
    }
    return orcidWork;
}
Also used : PublicationDate(org.orcid.jaxb.model.message.PublicationDate) ContributorAttributes(org.orcid.jaxb.model.message.ContributorAttributes) WorkContributors(org.orcid.jaxb.model.message.WorkContributors) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) WorkExternalIdentifierId(org.orcid.jaxb.model.message.WorkExternalIdentifierId) CreditName(org.orcid.jaxb.model.message.CreditName) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) Contributor(org.orcid.jaxb.model.message.Contributor) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) Month(org.orcid.jaxb.model.message.Month) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) Year(org.orcid.jaxb.model.message.Year) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) CitationType(org.orcid.jaxb.model.message.CitationType) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) Citation(org.orcid.jaxb.model.message.Citation) Day(org.orcid.jaxb.model.message.Day)

Example 4 with ContributorAttributes

use of org.orcid.jaxb.model.message.ContributorAttributes in project ORCID-Source by ORCID.

the class OrcidProfileManagerBaseTest method createWork1Contributors.

private WorkContributors createWork1Contributors() {
    WorkContributors workContributors = new WorkContributors();
    Contributor workContributor1 = new Contributor();
    workContributors.getContributor().add(workContributor1);
    workContributor1.setCreditName(new CreditName("Will Simpson"));
    ContributorAttributes contributorAttributes1 = new ContributorAttributes();
    workContributor1.setContributorAttributes(contributorAttributes1);
    contributorAttributes1.setContributorRole(ContributorRole.AUTHOR);
    contributorAttributes1.setContributorSequence(SequenceType.FIRST);
    Contributor workContributor2 = new Contributor();
    workContributors.getContributor().add(workContributor2);
    workContributor2.setCreditName(new CreditName("Josiah Wedgewood"));
    ContributorAttributes contributorAttributes2 = new ContributorAttributes();
    workContributor2.setContributorAttributes(contributorAttributes2);
    contributorAttributes2.setContributorRole(ContributorRole.AUTHOR);
    contributorAttributes2.setContributorSequence(SequenceType.ADDITIONAL);
    return workContributors;
}
Also used : ContributorAttributes(org.orcid.jaxb.model.message.ContributorAttributes) WorkContributors(org.orcid.jaxb.model.message.WorkContributors) CreditName(org.orcid.jaxb.model.message.CreditName) Contributor(org.orcid.jaxb.model.message.Contributor)

Aggregations

ContributorAttributes (org.orcid.jaxb.model.message.ContributorAttributes)4 Contributor (org.orcid.jaxb.model.message.Contributor)3 CreditName (org.orcid.jaxb.model.message.CreditName)3 WorkContributors (org.orcid.jaxb.model.message.WorkContributors)2 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)1 Citation (org.orcid.jaxb.model.message.Citation)1 CitationType (org.orcid.jaxb.model.message.CitationType)1 ContributorEmail (org.orcid.jaxb.model.message.ContributorEmail)1 ContributorOrcid (org.orcid.jaxb.model.message.ContributorOrcid)1 ContributorRole (org.orcid.jaxb.model.message.ContributorRole)1 Day (org.orcid.jaxb.model.message.Day)1 Month (org.orcid.jaxb.model.message.Month)1 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)1 PublicationDate (org.orcid.jaxb.model.message.PublicationDate)1 SequenceType (org.orcid.jaxb.model.message.SequenceType)1 Title (org.orcid.jaxb.model.message.Title)1 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)1 WorkExternalIdentifierId (org.orcid.jaxb.model.message.WorkExternalIdentifierId)1 WorkExternalIdentifiers (org.orcid.jaxb.model.message.WorkExternalIdentifiers)1 WorkTitle (org.orcid.jaxb.model.message.WorkTitle)1