Search in sources :

Example 1 with Url

use of org.orcid.jaxb.model.common_rc2.Url in project ORCID-Source by ORCID.

the class Utils method getPersonExternalIdentifier.

public static PersonExternalIdentifier getPersonExternalIdentifier() {
    PersonExternalIdentifier newExtId = new PersonExternalIdentifier();
    newExtId.setType("new-common-name");
    newExtId.setValue("new-reference");
    newExtId.setUrl(new Url("http://newUrl.com"));
    newExtId.setVisibility(Visibility.LIMITED);
    return newExtId;
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Url(org.orcid.jaxb.model.common_v2.Url) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl)

Example 2 with Url

use of org.orcid.jaxb.model.common_rc2.Url in project ORCID-Source by ORCID.

the class Utils method getWork.

public static Work getWork(String title) {
    Work work = new Work();
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title(title));
    work.setWorkTitle(workTitle);
    work.setWorkType(WorkType.BOOK);
    work.setVisibility(Visibility.PUBLIC);
    ExternalIDs extIds = new ExternalIDs();
    ExternalID extId = new ExternalID();
    extId.setRelationship(Relationship.PART_OF);
    extId.setType(WorkExternalIdentifierType.AGR.value());
    extId.setValue("ext-id-" + System.currentTimeMillis());
    extId.setUrl(new Url("http://thisIsANewUrl.com"));
    extIds.getExternalIdentifier().add(extId);
    work.setWorkExternalIdentifiers(extIds);
    return work;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Work(org.orcid.jaxb.model.record_v2.Work) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Title(org.orcid.jaxb.model.common_v2.Title) Url(org.orcid.jaxb.model.common_v2.Url) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl)

Example 3 with Url

use of org.orcid.jaxb.model.common_rc2.Url in project ORCID-Source by ORCID.

the class Utils method getFunding.

public static Funding getFunding() {
    Funding newFunding = new Funding();
    FundingTitle title = new FundingTitle();
    title.setTitle(new Title("Public Funding # 2"));
    newFunding.setTitle(title);
    newFunding.setType(FundingType.AWARD);
    ExternalID fExtId = new ExternalID();
    fExtId.setRelationship(Relationship.PART_OF);
    fExtId.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
    fExtId.setUrl(new Url("http://fundingExtId.com"));
    fExtId.setValue("new-funding-ext-id");
    ExternalIDs fExtIds = new ExternalIDs();
    fExtIds.getExternalIdentifier().add(fExtId);
    newFunding.setExternalIdentifiers(fExtIds);
    newFunding.setOrganization(getOrganization());
    return newFunding;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) Funding(org.orcid.jaxb.model.record_v2.Funding) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Title(org.orcid.jaxb.model.common_v2.Title) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Url(org.orcid.jaxb.model.common_v2.Url) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl)

Example 4 with Url

use of org.orcid.jaxb.model.common_rc2.Url in project ORCID-Source by ORCID.

the class Utils method getPeerReview.

public static PeerReview getPeerReview() {
    PeerReview peerReview = new PeerReview();
    ExternalIDs weis = new ExternalIDs();
    ExternalID wei1 = new ExternalID();
    wei1.setRelationship(Relationship.PART_OF);
    wei1.setUrl(new Url("http://myUrl.com"));
    wei1.setValue("work-external-identifier-id");
    wei1.setType(WorkExternalIdentifierType.DOI.value());
    weis.getExternalIdentifier().add(wei1);
    peerReview.setExternalIdentifiers(weis);
    peerReview.setGroupId("issn:0000003");
    peerReview.setOrganization(getOrganization());
    peerReview.setRole(Role.CHAIR);
    peerReview.setSubjectContainerName(new Title("subject-container-name"));
    peerReview.setSubjectExternalIdentifier(wei1);
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("work-title"));
    peerReview.setSubjectName(workTitle);
    peerReview.setSubjectType(WorkType.DATA_SET);
    peerReview.setType(PeerReviewType.EVALUATION);
    return peerReview;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Title(org.orcid.jaxb.model.common_v2.Title) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Url(org.orcid.jaxb.model.common_v2.Url) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl)

Example 5 with Url

use of org.orcid.jaxb.model.common_rc2.Url in project ORCID-Source by ORCID.

the class WorkForm method toWork.

public Work toWork() {
    Work work = new Work();
    // Set work id
    if (!PojoUtil.isEmpty(this.getPutCode())) {
        work.setPutCode(Long.valueOf(this.getPutCode().getValue()));
    }
    // Set language
    if (!PojoUtil.isEmpty(this.getLanguageCode())) {
        work.setLanguageCode(this.getLanguageCode().getValue());
    }
    // Set type
    if (!PojoUtil.isEmpty(this.getWorkType())) {
        work.setWorkType(WorkType.fromValue(this.getWorkType().getValue()));
    }
    org.orcid.jaxb.model.record_v2.WorkTitle workTitle = new org.orcid.jaxb.model.record_v2.WorkTitle();
    // Set title
    if (!PojoUtil.isEmpty(this.getTitle())) {
        workTitle.setTitle(new org.orcid.jaxb.model.common_v2.Title(this.getTitle().getValue()));
    }
    // Set translated title        
    if (this.getTranslatedTitle() != null && !PojoUtil.isEmpty(this.getTranslatedTitle().getContent())) {
        org.orcid.jaxb.model.common_v2.TranslatedTitle translatedTitle = new org.orcid.jaxb.model.common_v2.TranslatedTitle();
        translatedTitle.setContent(this.getTranslatedTitle().getContent());
        translatedTitle.setLanguageCode(this.getTranslatedTitle().getLanguageCode());
        workTitle.setTranslatedTitle(translatedTitle);
    }
    // Set subtitle
    if (!PojoUtil.isEmpty(this.getSubtitle())) {
        org.orcid.jaxb.model.common_v2.Subtitle subtitle = new org.orcid.jaxb.model.common_v2.Subtitle();
        subtitle.setContent(this.getSubtitle().getValue());
        workTitle.setSubtitle(subtitle);
    }
    work.setWorkTitle(workTitle);
    // Set journal title
    if (!PojoUtil.isEmpty(this.getJournalTitle())) {
        work.setJournalTitle(new org.orcid.jaxb.model.common_v2.Title(this.getJournalTitle().getValue()));
    }
    // Set description
    if (!PojoUtil.isEmpty(this.getShortDescription())) {
        work.setShortDescription(this.getShortDescription().getValue());
    }
    // Set url
    if (!PojoUtil.isEmpty(this.getUrl())) {
        work.setUrl(new Url(this.getUrl().getValue()));
    } else {
        work.setUrl(new Url());
    }
    // Set visibility
    if (this.getVisibility() != null) {
        work.setVisibility(this.getVisibility());
    }
    // Set country
    if (!PojoUtil.isEmpty(this.getCountryCode())) {
        work.setCountry(new org.orcid.jaxb.model.common_v2.Country(org.orcid.jaxb.model.common_v2.Iso3166Country.fromValue(this.getCountryCode().getValue())));
    }
    // Set publication date        
    if (this.getPublicationDate() != null) {
        Integer yearInteger = PojoUtil.isEmpty(this.getPublicationDate().getYear()) ? null : Integer.valueOf(this.getPublicationDate().getYear());
        Integer monthInteger = PojoUtil.isEmpty(this.getPublicationDate().getMonth()) ? null : Integer.valueOf(this.getPublicationDate().getMonth());
        Integer dayInteger = PojoUtil.isEmpty(this.getPublicationDate().getDay()) ? null : Integer.valueOf(this.getPublicationDate().getDay());
        org.orcid.jaxb.model.common_v2.Year year = null;
        org.orcid.jaxb.model.common_v2.Month month = null;
        org.orcid.jaxb.model.common_v2.Day day = null;
        if (yearInteger != null) {
            year = new org.orcid.jaxb.model.common_v2.Year(yearInteger);
        }
        if (monthInteger != null) {
            month = new org.orcid.jaxb.model.common_v2.Month(monthInteger);
        }
        if (dayInteger != null) {
            day = new org.orcid.jaxb.model.common_v2.Day(dayInteger);
        }
        work.setPublicationDate(new org.orcid.jaxb.model.common_v2.PublicationDate(year, month, day));
    }
    // Set citation
    if (this.getCitation() != null) {
        org.orcid.jaxb.model.record_v2.Citation citation = new org.orcid.jaxb.model.record_v2.Citation();
        if (!PojoUtil.isEmpty(this.getCitation().getCitation())) {
            citation.setCitation(this.getCitation().getCitation().getValue());
        }
        if (!PojoUtil.isEmpty(this.getCitation().getCitationType())) {
            citation.setWorkCitationType(CitationType.fromValue(this.getCitation().getCitationType().getValue()));
        }
        work.setWorkCitation(citation);
    }
    // Set contributors
    populateContributors(this, work);
    // Set external identifiers
    populateExternalIdentifiers(this, work);
    // Set created date
    if (!PojoUtil.isEmpty(this.getCreatedDate())) {
        CreatedDate createdDate = new CreatedDate();
        createdDate.setValue(DateUtils.convertToXMLGregorianCalendar(this.getCreatedDate().toJavaDate()));
        work.setCreatedDate(createdDate);
    }
    // Set last modified
    if (!PojoUtil.isEmpty(this.getLastModified())) {
        org.orcid.jaxb.model.common_v2.LastModifiedDate lastModified = new org.orcid.jaxb.model.common_v2.LastModifiedDate();
        lastModified.setValue(DateUtils.convertToXMLGregorianCalendar(this.getLastModified().toJavaDate()));
        work.setLastModifiedDate(lastModified);
    }
    if (!PojoUtil.isEmpty(this.getSource())) {
        org.orcid.jaxb.model.common_v2.Source source = new org.orcid.jaxb.model.common_v2.Source();
        if (OrcidStringUtils.isClientId(this.getSource())) {
            source.setSourceClientId(new SourceClientId(this.getSource()));
        } else {
            source.setSourceOrcid(new SourceOrcid(this.getSource()));
        }
        work.setSource(source);
    }
    return work;
}
Also used : SourceClientId(org.orcid.jaxb.model.common_v2.SourceClientId) Url(org.orcid.jaxb.model.common_v2.Url) Work(org.orcid.jaxb.model.record_v2.Work) CreatedDate(org.orcid.jaxb.model.common_v2.CreatedDate) SourceOrcid(org.orcid.jaxb.model.common_v2.SourceOrcid)

Aggregations

Url (org.orcid.jaxb.model.common_v2.Url)86 Test (org.junit.Test)84 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)55 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)37 ClientResponse (com.sun.jersey.api.client.ClientResponse)30 MarshallingTest (org.orcid.jaxb.model.notification.custom.MarshallingTest)24 Title (org.orcid.jaxb.model.common_v2.Title)23 Work (org.orcid.jaxb.model.record_v2.Work)21 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)20 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)18 Validator (javax.xml.validation.Validator)16 Funding (org.orcid.jaxb.model.record_v2.Funding)15 ArrayList (java.util.ArrayList)14 Url (org.orcid.jaxb.model.common_rc3.Url)11 Url (org.orcid.jaxb.model.common_rc4.Url)11 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)11 Response (javax.ws.rs.core.Response)10 FundingTitle (org.orcid.jaxb.model.record_v2.FundingTitle)10 DBUnitTest (org.orcid.test.DBUnitTest)10 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)9