Search in sources :

Example 11 with WorkExternalIdentifiers

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

the class OrcidProfileManagerBaseTest method createWork2Identifiers.

protected WorkExternalIdentifiers createWork2Identifiers() {
    WorkExternalIdentifiers work2ExternalIdentifiers = new WorkExternalIdentifiers();
    WorkExternalIdentifier work2ExternalIdentifier1 = new WorkExternalIdentifier();
    work2ExternalIdentifier1.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
    work2ExternalIdentifier1.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work2-doi1"));
    WorkExternalIdentifier work2ExternalIdentifier2 = new WorkExternalIdentifier();
    work2ExternalIdentifier2.setWorkExternalIdentifierType(WorkExternalIdentifierType.PMID);
    work2ExternalIdentifier2.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work2-pmid"));
    work2ExternalIdentifiers.getWorkExternalIdentifier().add(work2ExternalIdentifier1);
    work2ExternalIdentifiers.getWorkExternalIdentifier().add(work2ExternalIdentifier2);
    return work2ExternalIdentifiers;
}
Also used : WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) WorkExternalIdentifierId(org.orcid.jaxb.model.message.WorkExternalIdentifierId) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier)

Example 12 with WorkExternalIdentifiers

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

the class OrcidProfileManagerBaseTest method createWork3Identifiers.

protected WorkExternalIdentifiers createWork3Identifiers() {
    WorkExternalIdentifiers work3ExternalIdentifiers = new WorkExternalIdentifiers();
    WorkExternalIdentifier work3ExternalIdentifier1 = new WorkExternalIdentifier();
    work3ExternalIdentifier1.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
    work3ExternalIdentifier1.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work3-doi1"));
    WorkExternalIdentifier work3ExternalIdentifier2 = new WorkExternalIdentifier();
    work3ExternalIdentifier2.setWorkExternalIdentifierType(WorkExternalIdentifierType.PMID);
    work3ExternalIdentifier2.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work3-doi2"));
    work3ExternalIdentifiers.getWorkExternalIdentifier().add(work3ExternalIdentifier1);
    work3ExternalIdentifiers.getWorkExternalIdentifier().add(work3ExternalIdentifier2);
    return work3ExternalIdentifiers;
}
Also used : WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) WorkExternalIdentifierId(org.orcid.jaxb.model.message.WorkExternalIdentifierId) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier)

Example 13 with WorkExternalIdentifiers

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

the class OrcidProfileManagerImplTest method getWorkInsideOrcidProfile.

private OrcidProfile getWorkInsideOrcidProfile(String defaultTitle, String orcid) {
    OrcidWork orcidWork = new OrcidWork();
    //Set title
    WorkTitle title = new WorkTitle();
    if (defaultTitle != null)
        title.setTitle(new Title(defaultTitle));
    else
        title.setTitle(new Title("Title"));
    orcidWork.setWorkTitle(title);
    //Set external identifiers
    WorkExternalIdentifier extId1 = new WorkExternalIdentifier();
    extId1.setWorkExternalIdentifierId(new WorkExternalIdentifierId("doi-" + defaultTitle));
    extId1.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
    WorkExternalIdentifier extId2 = new WorkExternalIdentifier();
    if (defaultTitle != null)
        extId2.setWorkExternalIdentifierId(new WorkExternalIdentifierId("issn-" + defaultTitle));
    else
        extId2.setWorkExternalIdentifierId(new WorkExternalIdentifierId("issn-" + System.currentTimeMillis()));
    extId2.setWorkExternalIdentifierType(WorkExternalIdentifierType.ISSN);
    WorkExternalIdentifiers extIds = new WorkExternalIdentifiers();
    extIds.getWorkExternalIdentifier().add(extId1);
    extIds.getWorkExternalIdentifier().add(extId2);
    orcidWork.setWorkExternalIdentifiers(extIds);
    orcidWork.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
    OrcidProfile profile = new OrcidProfile();
    profile.setOrcidIdentifier(orcid);
    List<OrcidWork> workList = new ArrayList<OrcidWork>();
    workList.add(orcidWork);
    OrcidWorks orcidWorks = new OrcidWorks();
    orcidWorks.setOrcidWork(workList);
    profile.setOrcidWorks(orcidWorks);
    return profile;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) WorkExternalIdentifierId(org.orcid.jaxb.model.message.WorkExternalIdentifierId) ArrayList(java.util.ArrayList) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks)

Example 14 with WorkExternalIdentifiers

use of org.orcid.jaxb.model.message.WorkExternalIdentifiers 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 15 with WorkExternalIdentifiers

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

the class OrcidMessageVersionConverterImplV1_2_rc5ToV1_2_rc6 method downGradeActivity.

private void downGradeActivity(OrcidWork orcidWork) {
    Source source = orcidWork.getSource();
    if (source != null) {
        SourceOrcid sourceOrcid = source.getSourceOrcid();
        if (sourceOrcid != null) {
            orcidWork.setSource(null);
            orcidWork.setWorkSource(new WorkSource(sourceOrcid));
        }
    }
    WorkExternalIdentifiers externalIdentifiers = orcidWork.getWorkExternalIdentifiers();
    if (externalIdentifiers != null) {
        for (WorkExternalIdentifier wei : externalIdentifiers.getWorkExternalIdentifier()) {
            WorkExternalIdentifierType type = wei.getWorkExternalIdentifierType();
            if (type != null) {
                if (Arrays.binarySearch(NEW_WORK_EXT_ID_TYPES, type) >= 0) {
                    wei.setWorkExternalIdentifierType(OTHER_ID);
                }
            }
        }
    }
}
Also used : WorkExternalIdentifierType(org.orcid.jaxb.model.message.WorkExternalIdentifierType) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) SourceOrcid(org.orcid.jaxb.model.message.SourceOrcid) WorkSource(org.orcid.jaxb.model.message.WorkSource) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) ExternalIdSource(org.orcid.jaxb.model.message.ExternalIdSource) Source(org.orcid.jaxb.model.message.Source) WorkSource(org.orcid.jaxb.model.message.WorkSource)

Aggregations

WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)16 WorkExternalIdentifiers (org.orcid.jaxb.model.message.WorkExternalIdentifiers)16 WorkExternalIdentifierId (org.orcid.jaxb.model.message.WorkExternalIdentifierId)15 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)11 Title (org.orcid.jaxb.model.message.Title)10 WorkTitle (org.orcid.jaxb.model.message.WorkTitle)10 FundingTitle (org.orcid.jaxb.model.message.FundingTitle)8 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)8 OrcidWorks (org.orcid.jaxb.model.message.OrcidWorks)7 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)6 Test (org.junit.Test)5 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)5 OrcidIdentifier (org.orcid.jaxb.model.message.OrcidIdentifier)4 DBUnitTest (org.orcid.test.DBUnitTest)4 Transactional (org.springframework.transaction.annotation.Transactional)3 Response (javax.ws.rs.core.Response)2 CreditName (org.orcid.jaxb.model.message.CreditName)2 Source (org.orcid.jaxb.model.message.Source)2 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 ArrayList (java.util.ArrayList)1