Search in sources :

Example 81 with WorkSummary

use of org.orcid.jaxb.model.record.summary_v2.WorkSummary in project ORCID-Source by ORCID.

the class ValidateV2SamplesTest method testUnmarshallRecord.

@Test
public void testUnmarshallRecord() throws SAXException, URISyntaxException {
    Record record = (Record) unmarshallFromPath("/record_2.0/samples/read_samples/record-2.0.xml", Record.class, "/record_2.0/record-2.0.xsd");
    assertNotNull(record);
    //Check activities
    assertNotNull(record.getActivitiesSummary());
    ActivitiesSummary activities = record.getActivitiesSummary();
    assertNotNull(activities.getLastModifiedDate());
    assertNotNull(activities.getEducations());
    Educations educations = activities.getEducations();
    assertNotNull(educations.getLastModifiedDate());
    assertEquals(1, educations.getSummaries().size());
    EducationSummary education = educations.getSummaries().get(0);
    assertEquals(Long.valueOf(0), education.getPutCode());
    assertEquals(Visibility.PRIVATE, education.getVisibility());
    assertEquals("education:department-name", education.getDepartmentName());
    assertEquals("education:role-title", education.getRoleTitle());
    assertNotNull(education.getEndDate());
    assertEquals("02", education.getEndDate().getDay().getValue());
    assertEquals("02", education.getEndDate().getMonth().getValue());
    assertEquals("1848", education.getEndDate().getYear().getValue());
    assertNotNull(education.getStartDate());
    assertEquals("02", education.getStartDate().getDay().getValue());
    assertEquals("02", education.getStartDate().getMonth().getValue());
    assertEquals("1848", education.getStartDate().getYear().getValue());
    assertNotNull(education.getOrganization());
    assertEquals("common:name", education.getOrganization().getName());
    assertEquals("common:city", education.getOrganization().getAddress().getCity());
    assertEquals("common:region", education.getOrganization().getAddress().getRegion());
    assertEquals(Iso3166Country.AF, education.getOrganization().getAddress().getCountry());
    assertNotNull(activities.getEmployments());
    Employments employments = activities.getEmployments();
    assertNotNull(employments.getLastModifiedDate());
    assertEquals(1, employments.getSummaries().size());
    EmploymentSummary employment = employments.getSummaries().get(0);
    assertEquals(Long.valueOf(0), employment.getPutCode());
    assertEquals(Visibility.PRIVATE, employment.getVisibility());
    assertEquals("employment:department-name", employment.getDepartmentName());
    assertEquals("employment:role-title", employment.getRoleTitle());
    assertNotNull(employment.getEndDate());
    assertEquals("02", employment.getEndDate().getDay().getValue());
    assertEquals("02", employment.getEndDate().getMonth().getValue());
    assertEquals("1848", employment.getEndDate().getYear().getValue());
    assertNotNull(employment.getStartDate());
    assertEquals("02", employment.getStartDate().getDay().getValue());
    assertEquals("02", employment.getStartDate().getMonth().getValue());
    assertEquals("1848", employment.getStartDate().getYear().getValue());
    assertNotNull(employment.getOrganization());
    assertEquals("common:name", employment.getOrganization().getName());
    assertEquals("common:city", employment.getOrganization().getAddress().getCity());
    assertEquals("common:region", employment.getOrganization().getAddress().getRegion());
    assertEquals(Iso3166Country.AF, employment.getOrganization().getAddress().getCountry());
    assertNotNull(activities.getFundings());
    Fundings fundings = activities.getFundings();
    assertNotNull(fundings.getLastModifiedDate());
    assertEquals(1, fundings.getFundingGroup().size());
    assertNotNull(fundings.getFundingGroup().get(0).getLastModifiedDate());
    assertEquals(1, fundings.getFundingGroup().get(0).getFundingSummary().size());
    assertEquals(1, fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertEquals("grant_number", fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getType());
    assertEquals("external-id-value", fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getValue());
    assertEquals(1, fundings.getFundingGroup().get(0).getFundingSummary().size());
    FundingSummary funding = fundings.getFundingGroup().get(0).getFundingSummary().get(0);
    assertEquals(Long.valueOf(0), funding.getPutCode());
    assertEquals(Visibility.PRIVATE, funding.getVisibility());
    assertNotNull(funding.getTitle());
    assertEquals("common:title", funding.getTitle().getTitle().getContent());
    assertEquals("common:translated-title", funding.getTitle().getTranslatedTitle().getContent());
    assertEquals("en", funding.getTitle().getTranslatedTitle().getLanguageCode());
    assertNotNull(funding.getExternalIdentifiers());
    assertEquals(1, funding.getExternalIdentifiers().getExternalIdentifier().size());
    assertEquals(Relationship.SELF, funding.getExternalIdentifiers().getExternalIdentifier().get(0).getRelationship());
    assertEquals("grant_number", funding.getExternalIdentifiers().getExternalIdentifier().get(0).getType());
    assertEquals("http://tempuri.org", funding.getExternalIdentifiers().getExternalIdentifier().get(0).getUrl().getValue());
    assertEquals("external-id-value", funding.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
    assertNotNull(funding.getEndDate());
    assertEquals("02", funding.getEndDate().getDay().getValue());
    assertEquals("02", funding.getEndDate().getMonth().getValue());
    assertEquals("1848", funding.getEndDate().getYear().getValue());
    assertNotNull(funding.getStartDate());
    assertEquals("02", funding.getStartDate().getDay().getValue());
    assertEquals("02", funding.getStartDate().getMonth().getValue());
    assertEquals("1848", funding.getStartDate().getYear().getValue());
    assertNotNull(funding.getOrganization());
    assertEquals("common:name", funding.getOrganization().getName());
    assertEquals("common:city", funding.getOrganization().getAddress().getCity());
    assertEquals("common:region", funding.getOrganization().getAddress().getRegion());
    assertEquals(Iso3166Country.AF, funding.getOrganization().getAddress().getCountry());
    assertNotNull(activities.getPeerReviews());
    assertNotNull(activities.getPeerReviews().getLastModifiedDate());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup());
    assertEquals(1, activities.getPeerReviews().getPeerReviewGroup().size());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier());
    assertEquals(1, activities.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getType());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getValue());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getUrl());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getRelationship());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary());
    assertEquals(1, activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().size());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getCompletionDate());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getCompletionDate().getDay());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getCompletionDate().getMonth());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getCompletionDate().getYear());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getCreatedDate());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getCreatedDate().getValue());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getDisplayIndex());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getExternalIdentifiers());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier());
    assertEquals(1, activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().size());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getType());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getUrl());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getRelationship());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getGroupId());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getLastModifiedDate());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getOrganization());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getOrganization().getAddress());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getOrganization().getAddress().getCity());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getOrganization().getAddress().getCountry());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getOrganization().getAddress().getRegion());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getOrganization().getName());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getPutCode());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getSource());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getSource().retrieveSourcePath());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getVisibility());
    assertNotNull(activities.getWorks());
    Works works = activities.getWorks();
    assertNotNull(works.getLastModifiedDate());
    assertEquals(1, works.getWorkGroup().size());
    assertNotNull(works.getWorkGroup().get(0).getIdentifiers());
    assertEquals(1, works.getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertEquals(Relationship.PART_OF, works.getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getRelationship());
    assertEquals("agr", works.getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getType());
    assertEquals("http://orcid.org", works.getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getUrl().getValue());
    assertEquals("external-id-value", works.getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getValue());
    assertEquals(1, works.getWorkGroup().get(0).getWorkSummary().size());
    WorkSummary work = works.getWorkGroup().get(0).getWorkSummary().get(0);
    assertEquals(Long.valueOf(0), work.getPutCode());
    assertEquals(Visibility.PRIVATE, work.getVisibility());
    assertNotNull(work.getTitle());
    assertEquals("common:title", work.getTitle().getTitle().getContent());
    assertEquals("common:translated-title", work.getTitle().getTranslatedTitle().getContent());
    assertEquals("en", work.getTitle().getTranslatedTitle().getLanguageCode());
    assertNotNull(work.getExternalIdentifiers());
    assertEquals(1, work.getExternalIdentifiers().getExternalIdentifier().size());
    assertEquals(Relationship.SELF, work.getExternalIdentifiers().getExternalIdentifier().get(0).getRelationship());
    assertEquals("agr", work.getExternalIdentifiers().getExternalIdentifier().get(0).getType());
    assertEquals("http://tempuri.org", work.getExternalIdentifiers().getExternalIdentifier().get(0).getUrl().getValue());
    assertEquals("external-id-value", work.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
    assertEquals(WorkType.ARTISTIC_PERFORMANCE, work.getType());
    assertNotNull(work.getPublicationDate());
    assertEquals("02", work.getPublicationDate().getDay().getValue());
    assertEquals("02", work.getPublicationDate().getMonth().getValue());
    assertEquals("1848", work.getPublicationDate().getYear().getValue());
    //Check biography
    Person person = record.getPerson();
    assertNotNull(person);
    assertNotNull(person.getLastModifiedDate().getValue());
    assertNotNull(person.getAddresses());
    assertNotNull(person.getAddresses().getLastModifiedDate());
    assertEquals(1, person.getAddresses().getAddress().size());
    Address address = person.getAddresses().getAddress().get(0);
    assertEquals(Long.valueOf(1), address.getPutCode());
    assertEquals(Visibility.PUBLIC, address.getVisibility());
    assertEquals(Iso3166Country.US, address.getCountry().getValue());
    assertEquals(Long.valueOf(0), address.getDisplayIndex());
    assertNotNull(address.getLastModifiedDate());
    assertNotNull(person.getBiography());
    assertEquals(Visibility.PUBLIC, person.getBiography().getVisibility());
    assertEquals("biography", person.getBiography().getContent());
    assertNotNull(person.getEmails());
    assertTrue(StringUtils.isNotBlank(person.getEmails().getPath()));
    assertNotNull(person.getEmails().getLastModifiedDate());
    assertNotNull(person.getEmails().getEmails());
    assertEquals(1, person.getEmails().getEmails().size());
    Email email = person.getEmails().getEmails().get(0);
    assertNotNull(email.getCreatedDate().getValue());
    assertEquals("user1@email.com", email.getEmail());
    assertNotNull(email.getLastModifiedDate().getValue());
    assertEquals(Long.valueOf(0), email.getPutCode());
    assertNotNull(email.getSource());
    assertEquals(Visibility.PUBLIC, email.getVisibility());
    assertNotNull(person.getExternalIdentifiers());
    assertTrue(StringUtils.isNotBlank(person.getExternalIdentifiers().getPath()));
    assertNotNull(person.getExternalIdentifiers().getLastModifiedDate().getValue());
    assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers());
    assertEquals(1, person.getExternalIdentifiers().getExternalIdentifiers().size());
    PersonExternalIdentifier extId = person.getExternalIdentifiers().getExternalIdentifiers().get(0);
    assertNotNull(extId.getCreatedDate().getValue());
    assertNotNull(extId.getLastModifiedDate());
    assertEquals(Long.valueOf(0), extId.getDisplayIndex());
    assertEquals(Long.valueOf(1), extId.getPutCode());
    assertEquals(Relationship.PART_OF, extId.getRelationship());
    assertNotNull(extId.getSource());
    assertEquals("type-1", extId.getType());
    assertEquals("http://url.com/1", extId.getUrl().getValue());
    assertEquals("value-1", extId.getValue());
    assertEquals(Visibility.PUBLIC, extId.getVisibility());
    assertNotNull(person.getKeywords());
    assertTrue(StringUtils.isNotBlank(person.getKeywords().getPath()));
    assertNotNull(person.getKeywords().getLastModifiedDate().getValue());
    assertNotNull(person.getKeywords().getKeywords());
    assertEquals(1, person.getKeywords().getKeywords().size());
    Keyword keyword = person.getKeywords().getKeywords().get(0);
    assertEquals("keyword1", keyword.getContent());
    assertNotNull(keyword.getCreatedDate().getValue());
    assertNotNull(keyword.getLastModifiedDate().getValue());
    assertEquals(Long.valueOf(0), keyword.getDisplayIndex());
    assertEquals(Long.valueOf(1), keyword.getPutCode());
    assertNotNull(keyword.getSource());
    assertEquals(Visibility.PUBLIC, keyword.getVisibility());
    assertNotNull(person.getOtherNames());
    assertTrue(StringUtils.isNotBlank(person.getOtherNames().getPath()));
    assertNotNull(person.getOtherNames().getLastModifiedDate().getValue());
    assertNotNull(person.getOtherNames().getOtherNames());
    assertEquals(1, person.getOtherNames().getOtherNames().size());
    OtherName otherName = person.getOtherNames().getOtherNames().get(0);
    assertEquals("other-name-1", otherName.getContent());
    assertNotNull(otherName.getCreatedDate().getValue());
    assertNotNull(otherName.getLastModifiedDate().getValue());
    assertEquals(Long.valueOf(0), otherName.getDisplayIndex());
    assertEquals(Long.valueOf(1), otherName.getPutCode());
    assertNotNull(otherName.getSource());
    assertEquals(Visibility.PUBLIC, otherName.getVisibility());
    assertNotNull(person.getResearcherUrls());
    assertTrue(StringUtils.isNotBlank(person.getResearcherUrls().getPath()));
    assertNotNull(person.getResearcherUrls().getLastModifiedDate().getValue());
    assertNotNull(person.getResearcherUrls().getResearcherUrls().size());
    ResearcherUrl rUrl = person.getResearcherUrls().getResearcherUrls().get(0);
    assertNotNull(rUrl.getCreatedDate().getValue());
    assertEquals(Long.valueOf(0), rUrl.getDisplayIndex());
    assertNotNull(rUrl.getLastModifiedDate().getValue());
    assertEquals(Long.valueOf(1248), rUrl.getPutCode());
    assertNotNull(rUrl.getSource());
    assertEquals("http://url.com/", rUrl.getUrl().getValue());
    assertEquals("url-name-1", rUrl.getUrlName());
    assertEquals(Visibility.PUBLIC, rUrl.getVisibility());
    assertNotNull(person.getName());
    Name name = person.getName();
    assertTrue(StringUtils.isNotBlank(name.getPath()));
    assertEquals("credit-name", name.getCreditName().getContent());
    assertEquals("family-name", name.getFamilyName().getContent());
    assertEquals("give-names", name.getGivenNames().getContent());
    assertNotNull(name.getLastModifiedDate().getValue());
    assertEquals(Visibility.PUBLIC, name.getVisibility());
}
Also used : Email(org.orcid.jaxb.model.record_v2.Email) Address(org.orcid.jaxb.model.record_v2.Address) Keyword(org.orcid.jaxb.model.record_v2.Keyword) Fundings(org.orcid.jaxb.model.record.summary_v2.Fundings) OtherName(org.orcid.jaxb.model.record_v2.OtherName) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary) CreditName(org.orcid.jaxb.model.record_v2.CreditName) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name) Employments(org.orcid.jaxb.model.record.summary_v2.Employments) WorkSummary(org.orcid.jaxb.model.record.summary_v2.WorkSummary) EducationSummary(org.orcid.jaxb.model.record.summary_v2.EducationSummary) Educations(org.orcid.jaxb.model.record.summary_v2.Educations) FundingSummary(org.orcid.jaxb.model.record.summary_v2.FundingSummary) EmploymentSummary(org.orcid.jaxb.model.record.summary_v2.EmploymentSummary) Record(org.orcid.jaxb.model.record_v2.Record) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Works(org.orcid.jaxb.model.record.summary_v2.Works) Person(org.orcid.jaxb.model.record_v2.Person) Test(org.junit.Test)

Example 82 with WorkSummary

use of org.orcid.jaxb.model.record.summary_v2.WorkSummary in project ORCID-Source by ORCID.

the class ActivitiesGroupGenerator_GroupingWorksTest method groupWorks_MergeTwoGroups_Test.

/**
     * work-1 and work-3 will be in different groups
     * then work-2 will go to the same group as work-1
     * then work-4 contains ARG(Y) and ARG(B) so, the two groups should be merged
     * */
@Test
public void groupWorks_MergeTwoGroups_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, WorkSummary> works = generateWorks();
    //Group the first group
    WorkSummary work1 = works.get("work-1");
    WorkSummary work2 = works.get("work-2");
    WorkSummary work3 = works.get("work-3");
    WorkSummary work4 = works.get("work-4");
    generator.group(work1);
    generator.group(work2);
    generator.group(work3);
    /**
         * At this point there are two groups
         * G1 with work1 and work2
         * G2 with work3
         * */
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(2, groups.size());
    checkActivitiesBelongsToTheSameGroup(groups, work1, work2);
    checkActivitiesDontBelongsToTheSameGroup(groups, work1, work3);
    checkActivitiesDontBelongsToTheSameGroup(groups, work2, work3);
    //group work4, which should merge the two groups
    generator.group(work4);
    groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(1, groups.size());
    assertEquals(4, groups.get(0).getActivities().size());
    assertEquals(9, groups.get(0).getGroupKeys().size());
    checkActivityIsOnGroups(work1, groups);
    checkActivityIsOnGroups(work2, groups);
    checkActivityIsOnGroups(work3, groups);
    checkActivityIsOnGroups(work4, groups);
    checkActivitiesBelongsToTheSameGroup(groups, work1, work2, work3, work4);
}
Also used : WorkSummary(org.orcid.jaxb.model.record.summary_v2.WorkSummary) Test(org.junit.Test)

Example 83 with WorkSummary

use of org.orcid.jaxb.model.record.summary_v2.WorkSummary 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 84 with WorkSummary

use of org.orcid.jaxb.model.record.summary_v2.WorkSummary in project ORCID-Source by ORCID.

the class ActivitiesGroupGenerator_GroupingWorksTest method groupWorks_2GroupsOf2Works_Test.

/**
     * Test grouping (work-1 and work-2) and (work-6 and work-7) 
     * */
@Test
public void groupWorks_2GroupsOf2Works_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, WorkSummary> works = generateWorks();
    WorkSummary work1 = works.get("work-1");
    WorkSummary work2 = works.get("work-2");
    WorkSummary work6 = works.get("work-6");
    WorkSummary work7 = works.get("work-7");
    generator.group(work1);
    generator.group(work2);
    generator.group(work6);
    generator.group(work7);
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(2, groups.size());
    //Check there are two activities in each group
    assertEquals(2, groups.get(0).getActivities().size());
    assertEquals(2, groups.get(1).getActivities().size());
    //Check there are five external ids in each group
    assertEquals(5, groups.get(0).getGroupKeys().size());
    assertEquals(5, groups.get(1).getGroupKeys().size());
    //Check each work
    checkActivityIsOnGroups(work1, groups);
    checkActivityIsOnGroups(work2, groups);
    checkActivityIsOnGroups(work6, groups);
    checkActivityIsOnGroups(work7, groups);
    //Check work1 and work2 are in the same group
    checkActivitiesBelongsToTheSameGroup(groups, work1, work2);
    //Check work6 and work7 are in the same group
    checkActivitiesBelongsToTheSameGroup(groups, work6, work7);
    //Check works are not mixed
    checkActivitiesDontBelongsToTheSameGroup(groups, work1, work6);
    checkActivitiesDontBelongsToTheSameGroup(groups, work1, work7);
    checkActivitiesDontBelongsToTheSameGroup(groups, work2, work6);
    checkActivitiesDontBelongsToTheSameGroup(groups, work2, work7);
}
Also used : WorkSummary(org.orcid.jaxb.model.record.summary_v2.WorkSummary) Test(org.junit.Test)

Example 85 with WorkSummary

use of org.orcid.jaxb.model.record.summary_v2.WorkSummary in project ORCID-Source by ORCID.

the class ActivitiesGroupGenerator_GroupingWorksTest method groupWorks_MergeGroupsDontAffectNotMergedGroups_Test.

/**
     * work-1, work-3, work-5 and work-8 will be in separate groups
     * then work-4 will merge groups of work-1 and work-3
     * 
     * Check that after that, there are 3 groups, one with work-1, work-3 and work-4, one with work-5 and other with work-8
     * */
@Test
public void groupWorks_MergeGroupsDontAffectNotMergedGroups_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, WorkSummary> works = generateWorks();
    //Group the first group
    WorkSummary work1 = works.get("work-1");
    WorkSummary work3 = works.get("work-3");
    WorkSummary work4 = works.get("work-4");
    WorkSummary work5 = works.get("work-5");
    WorkSummary work8 = works.get("work-8");
    //Respect order
    generator.group(work1);
    generator.group(work3);
    generator.group(work5);
    generator.group(work8);
    generator.group(work4);
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(3, groups.size());
    //Check work1, work3 and work4 belongs to the same group
    checkActivitiesBelongsToTheSameGroup(groups, work1, work3, work4);
    //Check work1, work5 and work8 are all in different groups
    checkActivitiesDontBelongsToTheSameGroup(groups, work1, work5, work8);
    checkActivityIsOnGroups(work1, groups);
    checkActivityIsOnGroups(work3, groups);
    checkActivityIsOnGroups(work4, groups);
    checkActivityIsOnGroups(work5, groups);
    checkActivityIsOnGroups(work8, groups);
}
Also used : WorkSummary(org.orcid.jaxb.model.record.summary_v2.WorkSummary) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)81 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)80 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)46 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)46 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)45 ActivitiesSummary (org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)44 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)43 ClientResponse (com.sun.jersey.api.client.ClientResponse)27 WorkGroup (org.orcid.jaxb.model.record.summary_v2.WorkGroup)25 Works (org.orcid.jaxb.model.record.summary_v2.Works)22 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)19 Address (org.orcid.jaxb.model.record_v2.Address)18 Email (org.orcid.jaxb.model.record_v2.Email)18 Keyword (org.orcid.jaxb.model.record_v2.Keyword)18 OtherName (org.orcid.jaxb.model.record_v2.OtherName)18 Record (org.orcid.jaxb.model.record_v2.Record)18 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)18 Name (org.orcid.jaxb.model.record_v2.Name)17 Addresses (org.orcid.jaxb.model.record_v2.Addresses)15 Biography (org.orcid.jaxb.model.record_v2.Biography)15