Search in sources :

Example 31 with Url

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

the class PeerReviewForm method toPeerReview.

public PeerReview toPeerReview() {
    PeerReview peerReview = new PeerReview();
    // Put Code
    if (!PojoUtil.isEmpty(putCode)) {
        peerReview.setPutCode(Long.valueOf(putCode.getValue()));
    }
    // Visibility
    if (visibility != null && visibility.getVisibility() != null) {
        peerReview.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(visibility.getVisibility().value()));
    }
    // Completion date
    if (completionDate != null) {
        peerReview.setCompletionDate(new FuzzyDate(completionDate.toFuzzyDate()));
    }
    // External identifiers
    if (externalIdentifiers != null && !externalIdentifiers.isEmpty()) {
        peerReview.setExternalIdentifiers(new ExternalIDs());
        for (WorkExternalIdentifier extId : externalIdentifiers) {
            peerReview.getExternalIdentifiers().getExternalIdentifier().add(extId.toRecordWorkExternalIdentifier());
        }
    }
    // Set Organization
    Organization organization = new Organization();
    OrganizationAddress organizationAddress = new OrganizationAddress();
    organization.setAddress(organizationAddress);
    if (!PojoUtil.isEmpty(orgName)) {
        organization.setName(orgName.getValue());
    }
    if (!PojoUtil.isEmpty(city)) {
        organizationAddress.setCity(city.getValue());
    }
    if (!PojoUtil.isEmpty(region)) {
        organizationAddress.setRegion(region.getValue());
    }
    if (!PojoUtil.isEmpty(country)) {
        organizationAddress.setCountry(Iso3166Country.fromValue(country.getValue()));
    }
    if (!PojoUtil.isEmpty(disambiguatedOrganizationSourceId)) {
        organization.setDisambiguatedOrganization(new DisambiguatedOrganization());
        organization.getDisambiguatedOrganization().setDisambiguatedOrganizationIdentifier(disambiguatedOrganizationSourceId.getValue());
        organization.getDisambiguatedOrganization().setDisambiguationSource(disambiguationSource.getValue());
    }
    peerReview.setOrganization(organization);
    // Role
    if (!PojoUtil.isEmpty(role)) {
        peerReview.setRole(Role.fromValue(role.getValue()));
    }
    // Type
    if (!PojoUtil.isEmpty(type)) {
        peerReview.setType(PeerReviewType.fromValue(type.getValue()));
    }
    // Url
    if (!PojoUtil.isEmpty(url)) {
        peerReview.setUrl(new Url(url.getValue()));
    }
    // Group id
    if (!PojoUtil.isEmpty(groupId)) {
        peerReview.setGroupId(groupId.getValue());
    }
    // Subject external id
    if (!PojoUtil.isEmpty(subjectExternalIdentifier)) {
        ExternalID subjectExtId = new ExternalID();
        if (!PojoUtil.isEmpty(subjectExternalIdentifier.getRelationship())) {
            subjectExtId.setRelationship(Relationship.fromValue(subjectExternalIdentifier.getRelationship().getValue()));
        }
        if (!PojoUtil.isEmpty(subjectExternalIdentifier.getUrl())) {
            subjectExtId.setUrl(new Url(subjectExternalIdentifier.getUrl().getValue()));
        }
        if (!PojoUtil.isEmpty(subjectExternalIdentifier.getWorkExternalIdentifierId())) {
            subjectExtId.setValue(subjectExternalIdentifier.getWorkExternalIdentifierId().getValue());
        }
        if (!PojoUtil.isEmpty(subjectExternalIdentifier.getWorkExternalIdentifierType())) {
            subjectExtId.setType(subjectExternalIdentifier.getWorkExternalIdentifierType().getValue());
        }
        peerReview.setSubjectExternalIdentifier(subjectExtId);
    }
    // Subject container name
    if (!PojoUtil.isEmpty(subjectContainerName)) {
        Title containerName = new Title(subjectContainerName.getValue());
        peerReview.setSubjectContainerName(containerName);
    }
    // Subject type
    if (!PojoUtil.isEmpty(subjectType)) {
        peerReview.setSubjectType(WorkType.fromValue(subjectType.getValue()));
    }
    // Subject name and subject translated name
    if (!PojoUtil.isEmpty(subjectName) || !PojoUtil.isEmpty(translatedSubjectName)) {
        WorkTitle workTitle = new WorkTitle();
        if (!PojoUtil.isEmpty(subjectName)) {
            workTitle.setTitle(new Title(subjectName.getValue()));
        }
        if (translatedSubjectName != null) {
            org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle tTitle = new org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle();
            if (!PojoUtil.isEmpty(translatedSubjectName.getContent())) {
                tTitle.setContent(translatedSubjectName.getContent());
            }
            if (!PojoUtil.isEmpty(translatedSubjectName.getLanguageCode())) {
                tTitle.setLanguageCode(translatedSubjectName.getLanguageCode());
            }
            workTitle.setTranslatedTitle(tTitle);
        }
        peerReview.setSubjectName(workTitle);
    }
    // Subject url
    if (!PojoUtil.isEmpty(subjectUrl)) {
        peerReview.setSubjectUrl(new Url(subjectUrl.getValue()));
    }
    return peerReview;
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) Organization(org.orcid.jaxb.model.v3.dev1.common.Organization) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) OrganizationAddress(org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) Title(org.orcid.jaxb.model.v3.dev1.common.Title) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) Url(org.orcid.jaxb.model.v3.dev1.common.Url) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) PeerReview(org.orcid.jaxb.model.v3.dev1.record.PeerReview)

Example 32 with Url

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

the class FundingForm method toFunding.

public Funding toFunding() {
    Funding result = new Funding();
    Amount orcidAmount = new Amount();
    if (!PojoUtil.isEmpty(amount))
        orcidAmount.setContent(amount.getValue());
    if (!PojoUtil.isEmpty(currencyCode))
        orcidAmount.setCurrencyCode(currencyCode.getValue());
    result.setAmount(orcidAmount);
    if (!PojoUtil.isEmpty(description))
        result.setDescription(description.getValue());
    if (!PojoUtil.isEmpty(startDate))
        result.setStartDate(new FuzzyDate(startDate.toFuzzyDate()));
    if (!PojoUtil.isEmpty(endDate))
        result.setEndDate(new FuzzyDate(endDate.toFuzzyDate()));
    if (!PojoUtil.isEmpty(putCode))
        result.setPutCode(Long.valueOf(putCode.getValue()));
    if (fundingTitle != null) {
        result.setTitle(fundingTitle.toFundingTitle());
    }
    if (!PojoUtil.isEmpty(fundingType))
        result.setType(FundingType.fromValue(fundingType.getValue()));
    if (organizationDefinedFundingSubType != null && !PojoUtil.isEmpty(organizationDefinedFundingSubType.getSubtype()))
        result.setOrganizationDefinedType(new OrganizationDefinedFundingSubType(organizationDefinedFundingSubType.getSubtype().getValue()));
    if (!PojoUtil.isEmpty(url))
        result.setUrl(new Url(url.getValue()));
    else
        result.setUrl(new Url());
    if (visibility != null)
        result.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(visibility.getVisibility().value()));
    // Set Organization
    Organization organization = new Organization();
    if (!PojoUtil.isEmpty(fundingName))
        organization.setName(fundingName.getValue());
    OrganizationAddress organizationAddress = new OrganizationAddress();
    organization.setAddress(organizationAddress);
    if (!PojoUtil.isEmpty(city))
        organizationAddress.setCity(city.getValue());
    if (!PojoUtil.isEmpty(region)) {
        organizationAddress.setRegion(region.getValue());
    }
    if (!PojoUtil.isEmpty(country)) {
        organizationAddress.setCountry(Iso3166Country.fromValue(country.getValue()));
    }
    if (!PojoUtil.isEmpty(disambiguatedFundingSourceId)) {
        organization.setDisambiguatedOrganization(new DisambiguatedOrganization());
        organization.getDisambiguatedOrganization().setDisambiguatedOrganizationIdentifier(disambiguatedFundingSourceId.getValue());
        organization.getDisambiguatedOrganization().setDisambiguationSource(disambiguationSource.getValue());
    }
    result.setOrganization(organization);
    // Set contributors
    if (contributors != null && !contributors.isEmpty()) {
        FundingContributors fContributors = new FundingContributors();
        for (Contributor contributor : contributors) {
            if (!PojoUtil.isEmtpy(contributor))
                fContributors.getContributor().add(contributor.toFundingContributor());
        }
        result.setContributors(fContributors);
    }
    // Set external identifiers
    if (externalIdentifiers != null && !externalIdentifiers.isEmpty()) {
        ExternalIDs fExternalIdentifiers = new ExternalIDs();
        for (FundingExternalIdentifierForm fExternalIdentifier : externalIdentifiers) {
            if (!PojoUtil.isEmtpy(fExternalIdentifier))
                fExternalIdentifiers.getExternalIdentifier().add(fExternalIdentifier.toFundingExternalIdentifier());
        }
        result.setExternalIdentifiers(fExternalIdentifiers);
    }
    return result;
}
Also used : Organization(org.orcid.jaxb.model.v3.dev1.common.Organization) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) Amount(org.orcid.jaxb.model.v3.dev1.common.Amount) OrganizationAddress(org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) FundingContributors(org.orcid.jaxb.model.v3.dev1.record.FundingContributors) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Url(org.orcid.jaxb.model.v3.dev1.common.Url) OrganizationDefinedFundingSubType(org.orcid.jaxb.model.v3.dev1.common.OrganizationDefinedFundingSubType)

Example 33 with Url

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

the class AffiliationForm method toAffiliation.

public Affiliation toAffiliation() {
    Affiliation affiliation = null;
    if (AffiliationType.DISTINCTION.value().equals(affiliationType.getValue())) {
        affiliation = new Distinction();
    } else if (AffiliationType.EDUCATION.value().equals(affiliationType.getValue())) {
        affiliation = new Education();
    } else if (AffiliationType.EMPLOYMENT.value().equals(affiliationType.getValue())) {
        affiliation = new Employment();
    } else if (AffiliationType.INVITED_POSITION.value().equals(affiliationType.getValue())) {
        affiliation = new InvitedPosition();
    } else if (AffiliationType.MEMBERSHIP.value().equals(affiliationType.getValue())) {
        affiliation = new Membership();
    } else if (AffiliationType.QUALIFICATION.value().equals(affiliationType.getValue())) {
        affiliation = new Qualification();
    } else if (AffiliationType.SERVICE.value().equals(affiliationType.getValue())) {
        affiliation = new Service();
    }
    if (!PojoUtil.isEmpty(putCode)) {
        affiliation.setPutCode(Long.valueOf(putCode.getValue()));
    }
    if (visibility != null && visibility.getVisibility() != null) {
        affiliation.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.fromValue(visibility.getVisibility().value()));
    }
    Organization organization = new Organization();
    affiliation.setOrganization(organization);
    organization.setName(affiliationName.getValue());
    OrganizationAddress organizationAddress = new OrganizationAddress();
    organization.setAddress(organizationAddress);
    organizationAddress.setCity(city.getValue());
    if (!PojoUtil.isEmpty(region)) {
        organizationAddress.setRegion(region.getValue());
    }
    if (!PojoUtil.isEmpty(disambiguatedAffiliationSourceId)) {
        organization.setDisambiguatedOrganization(new DisambiguatedOrganization());
        organization.getDisambiguatedOrganization().setDisambiguatedOrganizationIdentifier(disambiguatedAffiliationSourceId.getValue());
        organization.getDisambiguatedOrganization().setDisambiguationSource(disambiguationSource.getValue());
    }
    organizationAddress.setCountry(Iso3166Country.fromValue(country.getValue()));
    if (!PojoUtil.isEmpty(roleTitle)) {
        affiliation.setRoleTitle(roleTitle.getValue());
    }
    if (!PojoUtil.isEmpty(departmentName)) {
        affiliation.setDepartmentName(departmentName.getValue());
    }
    if (!PojoUtil.isEmpty(startDate)) {
        affiliation.setStartDate(startDate.toV3FuzzyDate());
    }
    if (!PojoUtil.isEmpty(endDate)) {
        affiliation.setEndDate(endDate.toV3FuzzyDate());
    }
    if (!PojoUtil.isEmpty(url)) {
        affiliation.setUrl(new Url(url.getValue()));
    }
    if (affiliationExternalIdentifiers != null) {
        ExternalIDs externalIDs = new ExternalIDs();
        for (AffiliationExternalIdentifier affiliationExternalIdentifier : affiliationExternalIdentifiers) {
            externalIDs.getExternalIdentifier().add(affiliationExternalIdentifier.toExternalID());
        }
        affiliation.setExternalIDs(externalIDs);
    }
    return affiliation;
}
Also used : Organization(org.orcid.jaxb.model.v3.dev1.common.Organization) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) InvitedPosition(org.orcid.jaxb.model.v3.dev1.record.InvitedPosition) OrganizationAddress(org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress) Service(org.orcid.jaxb.model.v3.dev1.record.Service) Url(org.orcid.jaxb.model.v3.dev1.common.Url) Qualification(org.orcid.jaxb.model.v3.dev1.record.Qualification) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) Education(org.orcid.jaxb.model.v3.dev1.record.Education) Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) Membership(org.orcid.jaxb.model.v3.dev1.record.Membership) Distinction(org.orcid.jaxb.model.v3.dev1.record.Distinction) Affiliation(org.orcid.jaxb.model.v3.dev1.record.Affiliation)

Example 34 with Url

use of org.orcid.jaxb.model.v3.dev1.common.Url 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 35 with Url

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

the class JSONExternalIdentifiersConverterV3 method convertFrom.

@Override
public ExternalIDs convertFrom(String source, Type<ExternalIDs> destinationType) {
    JSONExternalIdentifiers externalIdentifiers = JsonUtils.readObjectFromJsonString(source, JSONExternalIdentifiers.class);
    ExternalIDs externalIDs = new ExternalIDs();
    for (JSONExternalIdentifier externalIdentifier : externalIdentifiers.getExternalIdentifier()) {
        ExternalID id = new ExternalID();
        if (externalIdentifier.getType() == null) {
            id.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
        } else {
            id.setType(externalIdentifier.getType().toLowerCase());
        }
        if (externalIdentifier.getUrl() != null && !PojoUtil.isEmpty(externalIdentifier.getUrl().getValue())) {
            Url url = new Url(externalIdentifier.getUrl().getValue());
            id.setUrl(url);
        }
        if (!PojoUtil.isEmpty(externalIdentifier.getValue())) {
            id.setValue(externalIdentifier.getValue());
        }
        if (externalIdentifier.getRelationship() != null) {
            id.setRelationship(Relationship.fromValue(conv.convertFrom(externalIdentifier.getRelationship(), null)));
        }
        externalIDs.getExternalIdentifier().add(id);
    }
    return externalIDs;
}
Also used : JSONExternalIdentifier(org.orcid.core.adapter.jsonidentifier.JSONExternalIdentifier) ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) JSONUrl(org.orcid.core.adapter.jsonidentifier.JSONUrl) Url(org.orcid.jaxb.model.v3.dev1.common.Url) JSONExternalIdentifiers(org.orcid.core.adapter.jsonidentifier.JSONExternalIdentifiers)

Aggregations

Url (org.orcid.jaxb.model.v3.dev1.common.Url)85 Test (org.junit.Test)76 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)68 ExternalIDs (org.orcid.jaxb.model.v3.dev1.record.ExternalIDs)50 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)42 Response (javax.ws.rs.core.Response)28 DBUnitTest (org.orcid.test.DBUnitTest)28 Title (org.orcid.jaxb.model.v3.dev1.common.Title)23 Work (org.orcid.jaxb.model.v3.dev1.record.Work)23 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)19 List (java.util.List)16 PeerReview (org.orcid.jaxb.model.v3.dev1.record.PeerReview)13 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)13 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)12 ClientResponse (com.sun.jersey.api.client.ClientResponse)10 DisambiguatedOrganization (org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization)8 TranslatedTitle (org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle)8 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)8 BaseTest (org.orcid.core.BaseTest)7 Organization (org.orcid.jaxb.model.v3.dev1.common.Organization)6