Search in sources :

Example 6 with Url

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

the class WorkForm method populateExternalIdentifiers.

private static void populateExternalIdentifiers(WorkForm workForm, Work work) {
    ExternalIDs workExternalIds = new ExternalIDs();
    if (workForm.getWorkExternalIdentifiers() != null && !workForm.getWorkExternalIdentifiers().isEmpty()) {
        for (WorkExternalIdentifier wfExtId : workForm.getWorkExternalIdentifiers()) {
            ExternalID wExtId = new ExternalID();
            if (!PojoUtil.isEmpty(wfExtId.getWorkExternalIdentifierId())) {
                wExtId.setValue(wfExtId.getWorkExternalIdentifierId().getValue());
            }
            if (!PojoUtil.isEmpty(wfExtId.getWorkExternalIdentifierType())) {
                wExtId.setType(wfExtId.getWorkExternalIdentifierType().getValue());
            }
            if (!PojoUtil.isEmpty(wfExtId.getRelationship())) {
                wExtId.setRelationship(Relationship.fromValue(wfExtId.getRelationship().getValue()));
            }
            if (!PojoUtil.isEmpty(wfExtId.getUrl())) {
                wExtId.setUrl(new org.orcid.jaxb.model.common_v2.Url(wfExtId.getUrl().getValue()));
            }
            workExternalIds.getExternalIdentifier().add(wExtId);
        }
    }
    work.setWorkExternalIdentifiers(workExternalIds);
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) Url(org.orcid.jaxb.model.common_v2.Url) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID)

Example 7 with Url

use of org.orcid.jaxb.model.common_rc2.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) {
        peerReview.setVisibility(visibility);
    }
    // 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.common_v2.TranslatedTitle tTitle = new org.orcid.jaxb.model.common_v2.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.record_v2.ExternalIDs) DisambiguatedOrganization(org.orcid.jaxb.model.common_v2.DisambiguatedOrganization) Organization(org.orcid.jaxb.model.common_v2.Organization) OrganizationAddress(org.orcid.jaxb.model.common_v2.OrganizationAddress) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) FuzzyDate(org.orcid.jaxb.model.common_v2.FuzzyDate) Title(org.orcid.jaxb.model.common_v2.Title) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Url(org.orcid.jaxb.model.common_v2.Url) DisambiguatedOrganization(org.orcid.jaxb.model.common_v2.DisambiguatedOrganization) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview)

Example 8 with Url

use of org.orcid.jaxb.model.common_rc2.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.common_v2.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 : DisambiguatedOrganization(org.orcid.jaxb.model.common_v2.DisambiguatedOrganization) Organization(org.orcid.jaxb.model.common_v2.Organization) DisambiguatedOrganization(org.orcid.jaxb.model.common_v2.DisambiguatedOrganization) ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) Funding(org.orcid.jaxb.model.record_v2.Funding) Amount(org.orcid.jaxb.model.common_v2.Amount) OrganizationAddress(org.orcid.jaxb.model.common_v2.OrganizationAddress) FuzzyDate(org.orcid.jaxb.model.common_v2.FuzzyDate) FundingContributors(org.orcid.jaxb.model.record_v2.FundingContributors) FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) Url(org.orcid.jaxb.model.common_v2.Url) OrganizationDefinedFundingSubType(org.orcid.jaxb.model.common_v2.OrganizationDefinedFundingSubType)

Example 9 with Url

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

the class WebsiteForm method toResearcherUrl.

public ResearcherUrl toResearcherUrl() {
    ResearcherUrl researcherUrl = new ResearcherUrl();
    if (!PojoUtil.isEmpty(this.getUrl())) {
        researcherUrl.setUrl(new Url(this.getUrl()));
    }
    if (!PojoUtil.isEmpty(this.getUrlName())) {
        researcherUrl.setUrlName(this.getUrlName());
    }
    if (this.visibility != null && this.visibility.getVisibility() != null) {
        researcherUrl.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(this.getVisibility().getVisibility().value()));
    }
    if (!PojoUtil.isEmpty(this.getPutCode())) {
        researcherUrl.setPutCode(Long.valueOf(this.getPutCode()));
    }
    if (displayIndex != null) {
        researcherUrl.setDisplayIndex(displayIndex);
    } else {
        researcherUrl.setDisplayIndex(0L);
    }
    researcherUrl.setSource(new Source(source));
    return researcherUrl;
}
Also used : ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Url(org.orcid.jaxb.model.common_v2.Url) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Source(org.orcid.jaxb.model.common_v2.Source)

Example 10 with Url

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

the class SourceInActivitiesTest method getFundingWithoutTitle.

private ProfileFundingEntity getFundingWithoutTitle(String userOrcid) {
    Funding funding = new Funding();
    funding.setOrganization(getOrganization());
    funding.setType(org.orcid.jaxb.model.record_v2.FundingType.AWARD);
    ExternalID extId = new ExternalID();
    extId.setValue("111");
    extId.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
    extId.setUrl(new Url("http://test.com"));
    ExternalIDs extIdentifiers = new ExternalIDs();
    extIdentifiers.getExternalIdentifier().add(extId);
    funding.setExternalIdentifiers(extIdentifiers);
    funding = profileFundingManager.createFunding(userOrcid, funding, true);
    return profileFundingManager.getProfileFundingEntity(funding.getPutCode());
}
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) Url(org.orcid.jaxb.model.common_v2.Url)

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