Search in sources :

Example 26 with WorkTitle

use of org.orcid.jaxb.model.record_rc4.WorkTitle in project ORCID-Source by ORCID.

the class ContributorUtilsTest method getWorkWithContributorWithoutOrcid.

private Work getWorkWithContributorWithoutOrcid() {
    Work work = new Work();
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("work with contributor without ORCID record"));
    work.setWorkTitle(workTitle);
    work.setWorkContributors(getWorkContributorWithoutOrcid());
    return work;
}
Also used : WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Work(org.orcid.jaxb.model.record_v2.Work) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Title(org.orcid.jaxb.model.common_v2.Title)

Example 27 with WorkTitle

use of org.orcid.jaxb.model.record_rc4.WorkTitle in project ORCID-Source by ORCID.

the class ActivityValidator method validateWork.

public void validateWork(Work work, SourceEntity sourceEntity, boolean createFlag, boolean isApiRequest, Visibility originalVisibility) {
    WorkTitle title = work.getWorkTitle();
    if (title == null || title.getTitle() == null || StringUtils.isEmpty(title.getTitle().getContent())) {
        throw new ActivityTitleValidationException();
    }
    if (work.getCountry() != null) {
        if (work.getCountry().getValue() == null) {
            Map<String, String> params = new HashMap<String, String>();
            String values = Arrays.stream(Iso3166Country.values()).map(element -> element.value()).collect(Collectors.joining(", "));
            params.put("type", "country");
            params.put("values", values);
            throw new ActivityTypeValidationException(params);
        }
    }
    //translated title language code
    if (title != null && title.getTranslatedTitle() != null) {
        String translatedTitle = title.getTranslatedTitle().getContent();
        String languageCode = title.getTranslatedTitle().getLanguageCode();
        if (PojoUtil.isEmpty(translatedTitle) && !PojoUtil.isEmpty(languageCode)) {
            throw new OrcidValidationException("Please specify a translated title or remove the language code");
        }
        //If translated title language code is null or invalid
        if (!PojoUtil.isEmpty(translatedTitle) && (PojoUtil.isEmpty(title.getTranslatedTitle().getLanguageCode()) || !Arrays.stream(SiteConstants.AVAILABLE_ISO_LANGUAGES).anyMatch(title.getTranslatedTitle().getLanguageCode()::equals))) {
            Map<String, String> params = new HashMap<String, String>();
            String values = Arrays.stream(SiteConstants.AVAILABLE_ISO_LANGUAGES).collect(Collectors.joining(", "));
            params.put("type", "translated title -> language code");
            params.put("values", values);
            throw new ActivityTypeValidationException(params);
        }
    }
    if (work.getWorkType() == null) {
        Map<String, String> params = new HashMap<String, String>();
        String values = Arrays.stream(WorkType.values()).map(element -> element.value()).collect(Collectors.joining(", "));
        params.put("type", "work type");
        params.put("values", values);
        throw new ActivityTypeValidationException(params);
    }
    if (!PojoUtil.isEmpty(work.getLanguageCode())) {
        if (!Arrays.stream(SiteConstants.AVAILABLE_ISO_LANGUAGES).anyMatch(work.getLanguageCode()::equals)) {
            Map<String, String> params = new HashMap<String, String>();
            String values = Arrays.stream(SiteConstants.AVAILABLE_ISO_LANGUAGES).collect(Collectors.joining(", "));
            params.put("type", "language code");
            params.put("values", values);
            throw new ActivityTypeValidationException(params);
        }
    }
    //publication date
    if (work.getPublicationDate() != null) {
        PublicationDate pd = work.getPublicationDate();
        Year year = pd.getYear();
        Month month = pd.getMonth();
        Day day = pd.getDay();
        if (year != null) {
            try {
                Integer.valueOf(year.getValue());
            } catch (NumberFormatException n) {
                Map<String, String> params = new HashMap<String, String>();
                params.put("type", "publication date -> year");
                params.put("values", "integers");
                throw new ActivityTypeValidationException(params);
            }
            if (year.getValue().length() != 4) {
                throw new OrcidValidationException("Invalid year " + year.getValue() + " please specify a four digits value");
            }
        }
        if (month != null) {
            try {
                Integer.valueOf(month.getValue());
            } catch (NumberFormatException n) {
                Map<String, String> params = new HashMap<String, String>();
                params.put("type", "publication date -> month");
                params.put("values", "integers");
                throw new ActivityTypeValidationException(params);
            }
            if (month.getValue().length() != 2) {
                throw new OrcidValidationException("Invalid month " + month.getValue() + " please specify a two digits value");
            }
        }
        if (day != null) {
            try {
                Integer.valueOf(day.getValue());
            } catch (NumberFormatException n) {
                Map<String, String> params = new HashMap<String, String>();
                params.put("type", "publication date -> day");
                params.put("values", "integers");
                throw new ActivityTypeValidationException(params);
            }
            if (day.getValue().length() != 2) {
                throw new OrcidValidationException("Invalid day " + day.getValue() + " please specify a two digits value");
            }
        }
        //Check the date is valid
        boolean isYearEmpty = (year == null || year.getValue() == null) ? true : false;
        boolean isMonthEmpty = (month == null || month.getValue() == null) ? true : false;
        boolean isDayEmpty = (day == null || day.getValue() == null) ? true : false;
        if (isYearEmpty && (!isMonthEmpty || !isDayEmpty)) {
            throw new OrcidValidationException("Invalid date, please specify a year element");
        } else if (!isYearEmpty && isMonthEmpty && !isDayEmpty) {
            throw new OrcidValidationException("Invalid date, please specify a month element");
        } else if (isYearEmpty && isMonthEmpty && !isDayEmpty) {
            throw new OrcidValidationException("Invalid date, please specify a year and month elements");
        }
    }
    //citation
    if (work.getWorkCitation() != null) {
        String citation = work.getWorkCitation().getCitation();
        CitationType type = work.getWorkCitation().getWorkCitationType();
        if (type == null) {
            Map<String, String> params = new HashMap<String, String>();
            String values = Arrays.stream(CitationType.values()).map(element -> element.value()).collect(Collectors.joining(", "));
            params.put("type", "citation type");
            params.put("values", values);
            throw new ActivityTypeValidationException(params);
        }
        if (PojoUtil.isEmpty(citation)) {
            throw new OrcidValidationException("Please specify a citation or remove the parent tag");
        }
    }
    if (work.getWorkExternalIdentifiers() == null || work.getWorkExternalIdentifiers().getExternalIdentifier() == null || work.getExternalIdentifiers().getExternalIdentifier().isEmpty()) {
        throw new ActivityIdentifierValidationException();
    }
    if (work.getWorkContributors() != null) {
        WorkContributors contributors = work.getWorkContributors();
        if (!contributors.getContributor().isEmpty()) {
            for (Contributor contributor : contributors.getContributor()) {
                if (contributor.getContributorOrcid() != null) {
                    ContributorOrcid contributorOrcid = contributor.getContributorOrcid();
                    if (!PojoUtil.isEmpty(contributorOrcid.getUri())) {
                        if (!OrcidStringUtils.isValidOrcidUri(contributorOrcid.getUri())) {
                            throw new OrcidValidationException("Invalid contributor URI");
                        }
                    }
                    if (!PojoUtil.isEmpty(contributorOrcid.getPath())) {
                        if (!OrcidStringUtils.isValidOrcid(contributorOrcid.getPath())) {
                            throw new OrcidValidationException("Invalid contributor ORCID");
                        }
                    }
                }
                if (contributor.getCreditName() != null) {
                    if (PojoUtil.isEmpty(contributor.getCreditName().getContent())) {
                        throw new OrcidValidationException("Please specify a contributor credit name or remove the empty tag");
                    }
                }
                if (contributor.getContributorEmail() != null) {
                    if (PojoUtil.isEmpty(contributor.getContributorEmail().getValue())) {
                        throw new OrcidValidationException("Please specify a contributor email or remove the empty tag");
                    }
                }
            }
        }
    }
    if (work.getPutCode() != null && createFlag) {
        Map<String, String> params = new HashMap<String, String>();
        if (sourceEntity != null) {
            params.put("clientName", sourceEntity.getSourceName());
        }
        throw new InvalidPutCodeException(params);
    }
    // Check that we are not changing the visibility
    if (isApiRequest && !createFlag) {
        Visibility updatedVisibility = work.getVisibility();
        validateVisibilityDoesntChange(updatedVisibility, originalVisibility);
    }
    externalIDValidator.validateWorkOrPeerReview(work.getExternalIdentifiers());
}
Also used : FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Arrays(java.util.Arrays) Year(org.orcid.jaxb.model.common_v2.Year) InvalidPutCodeException(org.orcid.core.exception.InvalidPutCodeException) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) OrcidStringUtils(org.orcid.utils.OrcidStringUtils) ActivityTitleValidationException(org.orcid.core.exception.ActivityTitleValidationException) OrcidDuplicatedActivityException(org.orcid.core.exception.OrcidDuplicatedActivityException) Contributor(org.orcid.jaxb.model.common_v2.Contributor) ContributorOrcid(org.orcid.jaxb.model.common_v2.ContributorOrcid) Amount(org.orcid.jaxb.model.common_v2.Amount) PojoUtil(org.orcid.pojo.ajaxForm.PojoUtil) HashMap(java.util.HashMap) GroupIdRecord(org.orcid.jaxb.model.groupid_v2.GroupIdRecord) StringUtils(org.apache.commons.lang3.StringUtils) OrcidValidationException(org.orcid.core.exception.OrcidValidationException) Day(org.orcid.jaxb.model.common_v2.Day) Matcher(java.util.regex.Matcher) ActivityTypeValidationException(org.orcid.core.exception.ActivityTypeValidationException) Source(org.orcid.jaxb.model.common_v2.Source) Map(java.util.Map) VisibilityMismatchException(org.orcid.core.exception.VisibilityMismatchException) CitationType(org.orcid.jaxb.model.record_v2.CitationType) Employment(org.orcid.jaxb.model.record_v2.Employment) Funding(org.orcid.jaxb.model.record_v2.Funding) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) PublicationDate(org.orcid.jaxb.model.common_v2.PublicationDate) Resource(javax.annotation.Resource) Month(org.orcid.jaxb.model.common_v2.Month) Collectors(java.util.stream.Collectors) WorkContributors(org.orcid.jaxb.model.record_v2.WorkContributors) ActivityIdentifierValidationException(org.orcid.core.exception.ActivityIdentifierValidationException) WorkType(org.orcid.jaxb.model.record_v2.WorkType) Iso3166Country(org.orcid.jaxb.model.common_v2.Iso3166Country) Visibility(org.orcid.jaxb.model.common_v2.Visibility) Relationship(org.orcid.jaxb.model.record_v2.Relationship) Work(org.orcid.jaxb.model.record_v2.Work) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Pattern(java.util.regex.Pattern) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) SiteConstants(org.orcid.persistence.constants.SiteConstants) Education(org.orcid.jaxb.model.record_v2.Education) ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) PeerReviewType(org.orcid.jaxb.model.record_v2.PeerReviewType) PublicationDate(org.orcid.jaxb.model.common_v2.PublicationDate) HashMap(java.util.HashMap) WorkContributors(org.orcid.jaxb.model.record_v2.WorkContributors) OrcidValidationException(org.orcid.core.exception.OrcidValidationException) Contributor(org.orcid.jaxb.model.common_v2.Contributor) ActivityTypeValidationException(org.orcid.core.exception.ActivityTypeValidationException) ActivityIdentifierValidationException(org.orcid.core.exception.ActivityIdentifierValidationException) Month(org.orcid.jaxb.model.common_v2.Month) ActivityTitleValidationException(org.orcid.core.exception.ActivityTitleValidationException) Year(org.orcid.jaxb.model.common_v2.Year) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) InvalidPutCodeException(org.orcid.core.exception.InvalidPutCodeException) CitationType(org.orcid.jaxb.model.record_v2.CitationType) Visibility(org.orcid.jaxb.model.common_v2.Visibility) ContributorOrcid(org.orcid.jaxb.model.common_v2.ContributorOrcid) Day(org.orcid.jaxb.model.common_v2.Day) HashMap(java.util.HashMap) Map(java.util.Map)

Example 28 with WorkTitle

use of org.orcid.jaxb.model.record_rc4.WorkTitle in project ORCID-Source by ORCID.

the class MemberV2Test method testTokenWorksOnlyForTheScopeItWasIssued.

@SuppressWarnings({ "deprecation", "rawtypes" })
@Test
public void testTokenWorksOnlyForTheScopeItWasIssued() throws JSONException, InterruptedException, URISyntaxException {
    long time = System.currentTimeMillis();
    List<String> scopes = getScopes(ScopePathType.FUNDING_CREATE, ScopePathType.FUNDING_UPDATE);
    String accessToken = getAccessToken(scopes);
    Work work1 = (Work) unmarshallFromPath("/record_2.0_rc4/samples/work-2.0_rc4.xml", Work.class);
    work1.setPutCode(null);
    work1.getExternalIdentifiers().getExternalIdentifier().clear();
    org.orcid.jaxb.model.record_rc4.WorkTitle title1 = new org.orcid.jaxb.model.record_rc4.WorkTitle();
    title1.setTitle(new Title("Work # 1"));
    work1.setWorkTitle(title1);
    ExternalID wExtId1 = new ExternalID();
    wExtId1.setValue("Work Id " + time);
    wExtId1.setType(WorkExternalIdentifierType.AGR.value());
    wExtId1.setRelationship(Relationship.SELF);
    wExtId1.setUrl(new Url("http://orcid.org/work#1"));
    work1.getExternalIdentifiers().getExternalIdentifier().clear();
    work1.getExternalIdentifiers().getExternalIdentifier().add(wExtId1);
    //Add the work
    ClientResponse postResponse = memberV2ApiClient.createWorkXml(this.getUser1OrcidId(), work1, accessToken);
    assertNotNull(postResponse);
    assertEquals(Response.Status.FORBIDDEN.getStatusCode(), postResponse.getStatus());
    Funding funding = (Funding) unmarshallFromPath("/record_2.0_rc4/samples/funding-2.0_rc4.xml", Funding.class);
    funding.setPutCode(null);
    funding.setVisibility(Visibility.PUBLIC);
    funding.getExternalIdentifiers().getExternalIdentifier().clear();
    ExternalID fExtId = new ExternalID();
    fExtId.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
    fExtId.setValue("Funding Id " + time);
    fExtId.setRelationship(Relationship.SELF);
    funding.getExternalIdentifiers().getExternalIdentifier().add(fExtId);
    //Add the funding
    postResponse = memberV2ApiClient.createFundingXml(this.getUser1OrcidId(), funding, accessToken);
    assertNotNull(postResponse);
    assertEquals(Response.Status.CREATED.getStatusCode(), postResponse.getStatus());
    // Delete funding        
    Map map = postResponse.getMetadata();
    assertNotNull(map);
    assertTrue(map.containsKey("Location"));
    List resultWithPutCode = (List) map.get("Location");
    String location = resultWithPutCode.get(0).toString();
    Long putCode = Long.valueOf(location.substring(location.lastIndexOf('/') + 1));
    ClientResponse deleteResponse = memberV2ApiClient.deleteFundingXml(this.getUser1OrcidId(), putCode, accessToken);
    assertNotNull(deleteResponse);
    assertEquals(Response.Status.NO_CONTENT.getStatusCode(), deleteResponse.getStatus());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) Funding(org.orcid.jaxb.model.record_rc4.Funding) ExternalID(org.orcid.jaxb.model.record_rc4.ExternalID) Title(org.orcid.jaxb.model.common_rc4.Title) Url(org.orcid.jaxb.model.common_rc4.Url) Work(org.orcid.jaxb.model.record_rc4.Work) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) Test(org.junit.Test)

Example 29 with WorkTitle

use of org.orcid.jaxb.model.record_rc4.WorkTitle in project ORCID-Source by ORCID.

the class ActivitiesGroupGenerator_GroupingWorksTest method generateWorks.

/**
     * work-1 -> ARG(A), ARG(B), ARG(C) 
     * work-2 -> ARG(C), ARG(D), ARG(E)
     * work-3 -> ARG(X), ARG(Y), ARG(Z)
     * work-4 -> ARG(Y), ARG(B), ARG(1)
     * work-5 -> ARG(M), ARG(N), ARG(O) 
     * work-6 -> ARXIV(A), ARXIV(B), ARXIV(C)
     * work-7 -> DOI(1), DOI(2), ARIXV(B)  
     * work-8 -> No external identifiers
     * work-9 -> No external identifiers  
     * work-10 -> ISSN(1), ISSN(2), ISSN(3)
     * work-11 -> ISSN(3), ISSN(4), ISSN(5)
     * work-12 -> DOI(1), ISSN(1)
     * work-13 -> DOI(1), ISSN(4)
     * */
private Map<String, WorkSummary> generateWorks() {
    Map<String, WorkSummary> result = new HashMap<String, WorkSummary>();
    for (int i = 1; i < 14; i++) {
        String title = "work-" + i;
        WorkSummary work = new WorkSummary();
        //Set title
        WorkTitle workTitle = new WorkTitle();
        workTitle.setTitle(new Title(title));
        work.setTitle(workTitle);
        ExternalIDs wei = new ExternalIDs();
        switch(i) {
            case 1:
                ExternalID e1 = new ExternalID();
                e1.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e1.setValue("A");
                ExternalID e2 = new ExternalID();
                e2.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e2.setValue("B");
                ExternalID e3 = new ExternalID();
                e3.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e3.setValue("C");
                wei.getExternalIdentifier().add(e1);
                wei.getExternalIdentifier().add(e2);
                wei.getExternalIdentifier().add(e3);
                break;
            case 2:
                ExternalID e4 = new ExternalID();
                e4.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e4.setValue("C");
                ExternalID e5 = new ExternalID();
                e5.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e5.setValue("D");
                ExternalID e6 = new ExternalID();
                e6.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e6.setValue("E");
                wei.getExternalIdentifier().add(e4);
                wei.getExternalIdentifier().add(e5);
                wei.getExternalIdentifier().add(e6);
                break;
            case 3:
                ExternalID e7 = new ExternalID();
                e7.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e7.setValue("X");
                ExternalID e8 = new ExternalID();
                e8.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e8.setValue("Y");
                ExternalID e9 = new ExternalID();
                e9.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e9.setValue("Z");
                wei.getExternalIdentifier().add(e7);
                wei.getExternalIdentifier().add(e8);
                wei.getExternalIdentifier().add(e9);
                break;
            case 4:
                ExternalID e10 = new ExternalID();
                e10.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e10.setValue("Y");
                ExternalID e11 = new ExternalID();
                e11.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e11.setValue("B");
                ExternalID e12 = new ExternalID();
                e12.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e12.setValue("1");
                wei.getExternalIdentifier().add(e10);
                wei.getExternalIdentifier().add(e11);
                wei.getExternalIdentifier().add(e12);
                break;
            case 5:
                ExternalID e13 = new ExternalID();
                e13.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e13.setValue("M");
                ExternalID e14 = new ExternalID();
                e14.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e14.setValue("N");
                ExternalID e15 = new ExternalID();
                e15.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
                e15.setValue("O");
                wei.getExternalIdentifier().add(e13);
                wei.getExternalIdentifier().add(e14);
                wei.getExternalIdentifier().add(e15);
                break;
            case 6:
                ExternalID e16 = new ExternalID();
                e16.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
                e16.setValue("A");
                ExternalID e17 = new ExternalID();
                e17.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
                e17.setValue("B");
                ExternalID e18 = new ExternalID();
                e18.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
                e18.setValue("C");
                wei.getExternalIdentifier().add(e16);
                wei.getExternalIdentifier().add(e17);
                wei.getExternalIdentifier().add(e18);
                break;
            case 7:
                ExternalID e19 = new ExternalID();
                e19.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
                e19.setValue("1");
                ExternalID e20 = new ExternalID();
                e20.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
                e20.setValue("2");
                ExternalID e21 = new ExternalID();
                e21.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
                e21.setValue("B");
                wei.getExternalIdentifier().add(e19);
                wei.getExternalIdentifier().add(e20);
                wei.getExternalIdentifier().add(e21);
                break;
            case 10:
                ExternalID e22 = new ExternalID();
                e22.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
                e22.setValue("1");
                ExternalID e23 = new ExternalID();
                e23.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
                e23.setValue("2");
                ExternalID e24 = new ExternalID();
                e24.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
                e24.setValue("3");
                wei.getExternalIdentifier().add(e22);
                wei.getExternalIdentifier().add(e23);
                wei.getExternalIdentifier().add(e24);
                break;
            case 11:
                ExternalID e25 = new ExternalID();
                e25.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
                e25.setValue("3");
                ExternalID e26 = new ExternalID();
                e26.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
                e26.setValue("3");
                ExternalID e27 = new ExternalID();
                e27.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
                e27.setValue("3");
                wei.getExternalIdentifier().add(e25);
                wei.getExternalIdentifier().add(e26);
                wei.getExternalIdentifier().add(e27);
                break;
            case 12:
                ExternalID e28 = new ExternalID();
                e28.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
                e28.setValue("1");
                ExternalID e29 = new ExternalID();
                e29.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
                e29.setValue("1");
                wei.getExternalIdentifier().add(e28);
                wei.getExternalIdentifier().add(e29);
                break;
            case 13:
                ExternalID e30 = new ExternalID();
                e30.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
                e30.setValue("1");
                ExternalID e31 = new ExternalID();
                e31.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
                e31.setValue("4");
                wei.getExternalIdentifier().add(e30);
                wei.getExternalIdentifier().add(e31);
                break;
        }
        work.setExternalIdentifiers(wei);
        result.put(title, work);
    }
    return result;
}
Also used : WorkSummary(org.orcid.jaxb.model.record.summary_v2.WorkSummary) ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) HashMap(java.util.HashMap) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Title(org.orcid.jaxb.model.common_v2.Title) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle)

Example 30 with WorkTitle

use of org.orcid.jaxb.model.record_rc4.WorkTitle in project ORCID-Source by ORCID.

the class SourceInActivitiesTest method getWorkWithoutExternalIdentifier.

private Work getWorkWithoutExternalIdentifier(String userOrcid, boolean validate) {
    Work work = new Work();
    WorkTitle title = new WorkTitle();
    title.setTitle(new Title("Work " + System.currentTimeMillis()));
    work.setWorkTitle(title);
    work.setWorkType(org.orcid.jaxb.model.record_v2.WorkType.BOOK);
    work = workManager.createWork(userOrcid, work, validate);
    return workManager.getWork(userOrcid, work.getPutCode(), 0L);
}
Also used : WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) 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)

Aggregations

WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)28 Title (org.orcid.jaxb.model.common_v2.Title)27 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)20 Work (org.orcid.jaxb.model.record_v2.Work)20 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)18 Test (org.junit.Test)12 Url (org.orcid.jaxb.model.common_v2.Url)12 FundingTitle (org.orcid.jaxb.model.record_v2.FundingTitle)11 TranslatedTitle (org.orcid.jaxb.model.common_v2.TranslatedTitle)9 ClientResponse (com.sun.jersey.api.client.ClientResponse)5 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)5 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)4 DBUnitTest (org.orcid.test.DBUnitTest)4 BaseTest (org.orcid.core.BaseTest)3 Title (org.orcid.jaxb.model.common_rc4.Title)3 ContributorOrcid (org.orcid.jaxb.model.common_v2.ContributorOrcid)3 Subtitle (org.orcid.jaxb.model.common_v2.Subtitle)3 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2