Search in sources :

Example 41 with FundingSummary

use of org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary in project ORCID-Source by ORCID.

the class ActivitiesGroupGenerator_GroupingFundingsTest method generateFundings.

/**
 * funding-1 -> A, B, C
 * funding-2 -> C, D, E
 * funding-3 -> X, Y, Z
 * funding-4 -> Y, B, 1
 * funding-5 -> M, N, O
 * funding-6 -> O, P, Q
 * funding-7 -> 1, 2, B
 * funding-8 -> No external identifiers
 * funding-9 -> No external identifiers
 */
private Map<String, FundingSummary> generateFundings() {
    Map<String, FundingSummary> result = new HashMap<String, FundingSummary>();
    for (int i = 1; i < 10; i++) {
        String name = "funding-" + i;
        FundingSummary funding = new FundingSummary();
        FundingTitle title = new FundingTitle();
        title.setTitle(new Title(name));
        funding.setTitle(title);
        ExternalIDs fei = new ExternalIDs();
        switch(i) {
            case 1:
                ExternalID f1 = new ExternalID();
                f1.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f1.setValue("A");
                ExternalID f2 = new ExternalID();
                f2.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f2.setValue("B");
                ExternalID f3 = new ExternalID();
                f3.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f3.setValue("C");
                fei.getExternalIdentifier().add(f1);
                fei.getExternalIdentifier().add(f2);
                fei.getExternalIdentifier().add(f3);
                break;
            case 2:
                ExternalID f4 = new ExternalID();
                f4.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f4.setValue("C");
                ExternalID f5 = new ExternalID();
                f5.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f5.setValue("D");
                ExternalID f6 = new ExternalID();
                f6.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f6.setValue("E");
                fei.getExternalIdentifier().add(f4);
                fei.getExternalIdentifier().add(f5);
                fei.getExternalIdentifier().add(f6);
                break;
            case 3:
                ExternalID f7 = new ExternalID();
                f7.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f7.setValue("X");
                ExternalID f8 = new ExternalID();
                f8.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f8.setValue("Y");
                ExternalID f9 = new ExternalID();
                f9.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f9.setValue("Z");
                fei.getExternalIdentifier().add(f7);
                fei.getExternalIdentifier().add(f8);
                fei.getExternalIdentifier().add(f9);
                break;
            case 4:
                ExternalID f10 = new ExternalID();
                f10.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f10.setValue("Y");
                ExternalID f11 = new ExternalID();
                f11.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f11.setValue("B");
                ExternalID f12 = new ExternalID();
                f12.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f12.setValue("1");
                fei.getExternalIdentifier().add(f10);
                fei.getExternalIdentifier().add(f11);
                fei.getExternalIdentifier().add(f12);
                break;
            case 5:
                ExternalID f13 = new ExternalID();
                f13.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f13.setValue("M");
                ExternalID f14 = new ExternalID();
                f14.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f14.setValue("N");
                ExternalID f15 = new ExternalID();
                f15.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f15.setValue("O");
                fei.getExternalIdentifier().add(f13);
                fei.getExternalIdentifier().add(f14);
                fei.getExternalIdentifier().add(f15);
                break;
            case 6:
                ExternalID f16 = new ExternalID();
                f16.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f16.setValue("O");
                ExternalID f17 = new ExternalID();
                f17.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f17.setValue("P");
                ExternalID f18 = new ExternalID();
                f18.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f18.setValue("Q");
                fei.getExternalIdentifier().add(f16);
                fei.getExternalIdentifier().add(f17);
                fei.getExternalIdentifier().add(f18);
                break;
            case 7:
                ExternalID f19 = new ExternalID();
                f19.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f19.setValue("1");
                ExternalID f20 = new ExternalID();
                f20.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f20.setValue("2");
                ExternalID f21 = new ExternalID();
                f21.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
                f21.setValue("B");
                fei.getExternalIdentifier().add(f19);
                fei.getExternalIdentifier().add(f20);
                fei.getExternalIdentifier().add(f21);
                break;
        }
        funding.setExternalIdentifiers(fei);
        result.put(name, funding);
    }
    return result;
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) HashMap(java.util.HashMap) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) Title(org.orcid.jaxb.model.v3.dev1.common.Title) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle)

Example 42 with FundingSummary

use of org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary in project ORCID-Source by ORCID.

the class MapperFacadeFactory method getFundingMapperFacade.

public MapperFacade getFundingMapperFacade() {
    MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
    ConverterFactory converterFactory = mapperFactory.getConverterFactory();
    converterFactory.registerConverter("fundingExternalIdentifiersConverterId", new JSONFundingExternalIdentifiersConverterV3());
    converterFactory.registerConverter("fundingContributorsConverterId", new JsonOrikaConverter<FundingContributors>());
    ClassMapBuilder<Funding, ProfileFundingEntity> fundingClassMap = mapperFactory.classMap(Funding.class, ProfileFundingEntity.class);
    addV3CommonFields(fundingClassMap);
    registerSourceConverters(mapperFactory, fundingClassMap);
    fundingClassMap.field("type", "type");
    fundingClassMap.field("organizationDefinedType.content", "organizationDefinedType");
    fundingClassMap.field("title.title.content", "title");
    fundingClassMap.field("title.translatedTitle.content", "translatedTitle");
    fundingClassMap.field("title.translatedTitle.languageCode", "translatedTitleLanguageCode");
    fundingClassMap.field("description", "description");
    fundingClassMap.field("amount.content", "numericAmount");
    fundingClassMap.field("amount.currencyCode", "currencyCode");
    fundingClassMap.field("url.value", "url");
    fundingClassMap.fieldBToA("org.name", "organization.name");
    fundingClassMap.fieldBToA("org.city", "organization.address.city");
    fundingClassMap.fieldBToA("org.region", "organization.address.region");
    fundingClassMap.fieldBToA("org.country", "organization.address.country");
    fundingClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
    fundingClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
    fundingClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
    fundingClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("fundingExternalIdentifiersConverterId").add();
    fundingClassMap.fieldMap("contributors", "contributorsJson").converter("fundingContributorsConverterId").add();
    fundingClassMap.register();
    ClassMapBuilder<FundingSummary, ProfileFundingEntity> fundingSummaryClassMap = mapperFactory.classMap(FundingSummary.class, ProfileFundingEntity.class);
    addV3CommonFields(fundingSummaryClassMap);
    registerSourceConverters(mapperFactory, fundingSummaryClassMap);
    fundingSummaryClassMap.field("type", "type");
    fundingSummaryClassMap.field("title.title.content", "title");
    fundingSummaryClassMap.field("title.translatedTitle.content", "translatedTitle");
    fundingSummaryClassMap.field("title.translatedTitle.languageCode", "translatedTitleLanguageCode");
    fundingSummaryClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("fundingExternalIdentifiersConverterId").add();
    fundingSummaryClassMap.fieldBToA("org.name", "organization.name");
    fundingSummaryClassMap.fieldBToA("org.city", "organization.address.city");
    fundingSummaryClassMap.fieldBToA("org.region", "organization.address.region");
    fundingSummaryClassMap.fieldBToA("org.country", "organization.address.country");
    fundingSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
    fundingSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
    fundingSummaryClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
    fundingSummaryClassMap.register();
    mapperFactory.classMap(FuzzyDate.class, StartDateEntity.class).field("year.value", "year").field("month.value", "month").field("day.value", "day").register();
    mapperFactory.classMap(FuzzyDate.class, EndDateEntity.class).field("year.value", "year").field("month.value", "month").field("day.value", "day").register();
    return mapperFactory.getMapperFacade();
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) FundingContributors(org.orcid.jaxb.model.v3.dev1.record.FundingContributors) FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) JSONFundingExternalIdentifiersConverterV3(org.orcid.core.adapter.jsonidentifier.converter.JSONFundingExternalIdentifiersConverterV3) ConverterFactory(ma.glasnost.orika.converter.ConverterFactory) ProfileFundingEntity(org.orcid.persistence.jpa.entities.ProfileFundingEntity)

Example 43 with FundingSummary

use of org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary in project ORCID-Source by ORCID.

the class OrcidSecurityManager_ActivitiesSummaryTest method testActivitiesSummary_When_SomePrivate_NoSource_ReadLimitedToken.

@Test
public void testActivitiesSummary_When_SomePrivate_NoSource_ReadLimitedToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ACTIVITIES_READ_LIMITED);
    DistinctionSummary d1 = createDistinctionSummary(Visibility.PUBLIC, CLIENT_2);
    DistinctionSummary d2 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
    DistinctionSummary d3 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
    EducationSummary e1 = createEducationSummary(Visibility.PUBLIC, CLIENT_2);
    EducationSummary e2 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
    EducationSummary e3 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
    EmploymentSummary em1 = createEmploymentSummary(Visibility.PUBLIC, CLIENT_2);
    EmploymentSummary em2 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
    EmploymentSummary em3 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
    InvitedPositionSummary i1 = createInvitedPositionSummary(Visibility.PUBLIC, CLIENT_2);
    InvitedPositionSummary i2 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
    InvitedPositionSummary i3 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
    MembershipSummary m1 = createMembershipSummary(Visibility.PUBLIC, CLIENT_2);
    MembershipSummary m2 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
    MembershipSummary m3 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
    QualificationSummary q1 = createQualificationSummary(Visibility.PUBLIC, CLIENT_2);
    QualificationSummary q2 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
    QualificationSummary q3 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
    ServiceSummary s1 = createServiceSummary(Visibility.PUBLIC, CLIENT_2);
    ServiceSummary s2 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
    ServiceSummary s3 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
    FundingSummary f1 = createFundingSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    FundingSummary f2 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
    FundingSummary f3 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    PeerReviewSummary p1 = createPeerReviewSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    PeerReviewSummary p2 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
    PeerReviewSummary p3 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    WorkSummary w1 = createWorkSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    WorkSummary w2 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
    WorkSummary w3 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    ActivitiesSummary as = new ActivitiesSummary();
    as.setEducations(createEducations(e1, e2, e3));
    as.setEmployments(createEmployments(em1, em2, em3));
    as.setFundings(createFundings(f1, f2, f3));
    as.setPeerReviews(createPeerReviews(p1, p2, p3));
    as.setWorks(createWorks(w1, w2, w3));
    as.setDistinctions(createDistinctions(d1, d2, d3));
    as.setInvitedPositions(createInvitedPositions(i1, i2, i3));
    as.setMemberships(createMemberships(m1, m2, m3));
    as.setQualifications(createQualifications(q1, q2, q3));
    as.setServices(createServices(s1, s2, s3));
    orcidSecurityManager.checkAndFilter(ORCID_1, as);
    assertNotNull(as);
    // Check distinctions
    assertEquals(1, as.getDistinctions().getSummaries().size());
    assertTrue(as.getDistinctions().getSummaries().contains(d1));
    assertFalse(as.getDistinctions().getSummaries().contains(d2));
    assertFalse(as.getDistinctions().getSummaries().contains(d3));
    // Check invited positions
    assertEquals(1, as.getInvitedPositions().getSummaries().size());
    assertTrue(as.getInvitedPositions().getSummaries().contains(i1));
    assertFalse(as.getInvitedPositions().getSummaries().contains(i2));
    assertFalse(as.getInvitedPositions().getSummaries().contains(i3));
    // Check memberships
    assertEquals(1, as.getMemberships().getSummaries().size());
    assertTrue(as.getMemberships().getSummaries().contains(m1));
    assertFalse(as.getMemberships().getSummaries().contains(m2));
    assertFalse(as.getMemberships().getSummaries().contains(m3));
    // Check qualifications
    assertEquals(1, as.getQualifications().getSummaries().size());
    assertTrue(as.getQualifications().getSummaries().contains(q1));
    assertFalse(as.getQualifications().getSummaries().contains(q2));
    assertFalse(as.getQualifications().getSummaries().contains(q3));
    // Check services
    assertEquals(1, as.getServices().getSummaries().size());
    assertTrue(as.getServices().getSummaries().contains(s1));
    assertFalse(as.getServices().getSummaries().contains(s2));
    assertFalse(as.getServices().getSummaries().contains(s3));
    // Check educations
    assertEquals(1, as.getEducations().getSummaries().size());
    assertTrue(as.getEducations().getSummaries().contains(e1));
    assertFalse(as.getEducations().getSummaries().contains(e2));
    assertFalse(as.getEducations().getSummaries().contains(e3));
    // Check employments
    assertEquals(1, as.getEmployments().getSummaries().size());
    assertTrue(as.getEmployments().getSummaries().contains(em1));
    assertFalse(as.getEmployments().getSummaries().contains(em2));
    assertFalse(as.getEmployments().getSummaries().contains(em3));
    // Check fundings
    assertEquals(1, as.getFundings().getFundingGroup().size());
    assertEquals(1, as.getFundings().getFundingGroup().get(0).getActivities().size());
    assertTrue(as.getFundings().getFundingGroup().get(0).getActivities().contains(f1));
    assertFalse(as.getFundings().getFundingGroup().get(0).getActivities().contains(f2));
    assertFalse(as.getFundings().getFundingGroup().get(0).getActivities().contains(f3));
    assertEquals(2, as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_1)));
    assertFalse(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_2)));
    assertFalse(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_3)));
    assertTrue(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED)));
    // Check peer reviews
    assertEquals(1, as.getPeerReviews().getPeerReviewGroup().size());
    assertEquals(1, as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().size());
    assertTrue(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p1));
    assertFalse(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p2));
    assertFalse(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p3));
    assertEquals(1, as.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED, "peer-review")));
    // Check works
    assertEquals(1, as.getWorks().getWorkGroup().size());
    assertEquals(1, as.getWorks().getWorkGroup().get(0).getActivities().size());
    assertTrue(as.getWorks().getWorkGroup().get(0).getActivities().contains(w1));
    assertFalse(as.getWorks().getWorkGroup().get(0).getActivities().contains(w2));
    assertFalse(as.getWorks().getWorkGroup().get(0).getActivities().contains(w3));
    assertEquals(2, as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_1)));
    assertFalse(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_2)));
    assertFalse(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_3)));
    assertTrue(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED)));
}
Also used : WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) InvitedPositionSummary(org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary) QualificationSummary(org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary) EducationSummary(org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary) PeerReviewSummary(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary) FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) DistinctionSummary(org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary) EmploymentSummary(org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary) MembershipSummary(org.orcid.jaxb.model.v3.dev1.record.summary.MembershipSummary) ServiceSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ServiceSummary) ActivitiesSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary) Test(org.junit.Test)

Example 44 with FundingSummary

use of org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary in project ORCID-Source by ORCID.

the class OrcidSecurityManager_ActivitiesSummaryTest method testActivitiesSummary_When_AffiliationsReadLimited_And_NotSource.

@Test
public void testActivitiesSummary_When_AffiliationsReadLimited_And_NotSource() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.AFFILIATIONS_READ_LIMITED);
    DistinctionSummary d1 = createDistinctionSummary(Visibility.PUBLIC, CLIENT_2);
    DistinctionSummary d2 = createDistinctionSummary(Visibility.LIMITED, CLIENT_2);
    DistinctionSummary d3 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
    EducationSummary e1 = createEducationSummary(Visibility.PUBLIC, CLIENT_2);
    EducationSummary e2 = createEducationSummary(Visibility.LIMITED, CLIENT_2);
    EducationSummary e3 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
    EmploymentSummary em1 = createEmploymentSummary(Visibility.PUBLIC, CLIENT_2);
    EmploymentSummary em2 = createEmploymentSummary(Visibility.LIMITED, CLIENT_2);
    EmploymentSummary em3 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
    InvitedPositionSummary i1 = createInvitedPositionSummary(Visibility.PUBLIC, CLIENT_2);
    InvitedPositionSummary i2 = createInvitedPositionSummary(Visibility.LIMITED, CLIENT_2);
    InvitedPositionSummary i3 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
    MembershipSummary m1 = createMembershipSummary(Visibility.PUBLIC, CLIENT_2);
    MembershipSummary m2 = createMembershipSummary(Visibility.LIMITED, CLIENT_2);
    MembershipSummary m3 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
    QualificationSummary q1 = createQualificationSummary(Visibility.PUBLIC, CLIENT_2);
    QualificationSummary q2 = createQualificationSummary(Visibility.LIMITED, CLIENT_2);
    QualificationSummary q3 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
    ServiceSummary s1 = createServiceSummary(Visibility.PUBLIC, CLIENT_2);
    ServiceSummary s2 = createServiceSummary(Visibility.LIMITED, CLIENT_2);
    ServiceSummary s3 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
    FundingSummary f1 = createFundingSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    FundingSummary f2 = createFundingSummary(Visibility.LIMITED, CLIENT_2, EXTID_2);
    FundingSummary f3 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    PeerReviewSummary p1 = createPeerReviewSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    PeerReviewSummary p2 = createPeerReviewSummary(Visibility.LIMITED, CLIENT_2, EXTID_2);
    PeerReviewSummary p3 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    WorkSummary w1 = createWorkSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    WorkSummary w2 = createWorkSummary(Visibility.LIMITED, CLIENT_2, EXTID_2);
    WorkSummary w3 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    ActivitiesSummary as = new ActivitiesSummary();
    as.setEducations(createEducations(e1, e2, e3));
    as.setEmployments(createEmployments(em1, em2, em3));
    as.setFundings(createFundings(f1, f2, f3));
    as.setPeerReviews(createPeerReviews(p1, p2, p3));
    as.setWorks(createWorks(w1, w2, w3));
    as.setDistinctions(createDistinctions(d1, d2, d3));
    as.setInvitedPositions(createInvitedPositions(i1, i2, i3));
    as.setMemberships(createMemberships(m1, m2, m3));
    as.setQualifications(createQualifications(q1, q2, q3));
    as.setServices(createServices(s1, s2, s3));
    orcidSecurityManager.checkAndFilter(ORCID_1, as);
    assertNotNull(as);
    // Check distinctions
    assertEquals(2, as.getDistinctions().getSummaries().size());
    assertTrue(as.getDistinctions().getSummaries().contains(d1));
    assertTrue(as.getDistinctions().getSummaries().contains(d2));
    assertFalse(as.getDistinctions().getSummaries().contains(d3));
    // Check invited positions
    assertEquals(2, as.getInvitedPositions().getSummaries().size());
    assertTrue(as.getInvitedPositions().getSummaries().contains(i1));
    assertTrue(as.getInvitedPositions().getSummaries().contains(i2));
    assertFalse(as.getInvitedPositions().getSummaries().contains(i3));
    // Check memberships
    assertEquals(2, as.getMemberships().getSummaries().size());
    assertTrue(as.getMemberships().getSummaries().contains(m1));
    assertTrue(as.getMemberships().getSummaries().contains(m2));
    assertFalse(as.getMemberships().getSummaries().contains(m3));
    // Check qualifications
    assertEquals(2, as.getQualifications().getSummaries().size());
    assertTrue(as.getQualifications().getSummaries().contains(q1));
    assertTrue(as.getQualifications().getSummaries().contains(q2));
    assertFalse(as.getQualifications().getSummaries().contains(q3));
    // Check services
    assertEquals(2, as.getServices().getSummaries().size());
    assertTrue(as.getServices().getSummaries().contains(s1));
    assertTrue(as.getServices().getSummaries().contains(s2));
    assertFalse(as.getServices().getSummaries().contains(s3));
    // Check it have limited Educations
    assertNotNull(as.getEducations());
    assertEquals(2, as.getEducations().getSummaries().size());
    assertTrue(as.getEducations().getSummaries().contains(e1));
    assertTrue(as.getEducations().getSummaries().contains(e2));
    assertFalse(as.getEducations().getSummaries().contains(e3));
    // Check it have limited Employments
    assertNotNull(as.getEmployments());
    assertEquals(2, as.getEmployments().getSummaries().size());
    assertTrue(as.getEmployments().getSummaries().contains(em1));
    assertTrue(as.getEmployments().getSummaries().contains(em2));
    assertFalse(as.getEmployments().getSummaries().contains(em3));
    // Check it have only public funding
    assertNotNull(as.getFundings());
    assertEquals(1, as.getFundings().getFundingGroup().size());
    assertEquals(1, as.getFundings().getFundingGroup().get(0).getActivities().size());
    assertTrue(as.getFundings().getFundingGroup().get(0).getActivities().contains(f1));
    assertFalse(as.getFundings().getFundingGroup().get(0).getActivities().contains(f2));
    assertFalse(as.getFundings().getFundingGroup().get(0).getActivities().contains(f3));
    assertEquals(2, as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_1)));
    assertFalse(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_2)));
    assertFalse(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_3)));
    assertTrue(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED)));
    // Check it have only public peer reviews
    assertNotNull(as.getPeerReviews());
    assertEquals(1, as.getPeerReviews().getPeerReviewGroup().size());
    assertEquals(1, as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().size());
    assertTrue(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p1));
    assertFalse(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p2));
    assertFalse(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p3));
    assertEquals(1, as.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED, "peer-review")));
    // Check it have only public works
    assertNotNull(as.getWorks());
    assertEquals(1, as.getWorks().getWorkGroup().size());
    assertEquals(1, as.getWorks().getWorkGroup().get(0).getActivities().size());
    assertTrue(as.getWorks().getWorkGroup().get(0).getActivities().contains(w1));
    assertFalse(as.getWorks().getWorkGroup().get(0).getActivities().contains(w2));
    assertFalse(as.getWorks().getWorkGroup().get(0).getActivities().contains(w3));
    assertEquals(2, as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_1)));
    assertFalse(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_2)));
    assertFalse(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_3)));
    assertTrue(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED)));
}
Also used : WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) InvitedPositionSummary(org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary) QualificationSummary(org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary) EducationSummary(org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary) PeerReviewSummary(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary) FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) DistinctionSummary(org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary) EmploymentSummary(org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary) MembershipSummary(org.orcid.jaxb.model.v3.dev1.record.summary.MembershipSummary) ServiceSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ServiceSummary) ActivitiesSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary) Test(org.junit.Test)

Example 45 with FundingSummary

use of org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary in project ORCID-Source by ORCID.

the class OrcidSecurityManager_ActivitiesSummaryTest method testActivitiesSummary_When_AllReadLimited_And_NotSource.

@Test
public void testActivitiesSummary_When_AllReadLimited_And_NotSource() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.AFFILIATIONS_READ_LIMITED, ScopePathType.FUNDING_READ_LIMITED, ScopePathType.PEER_REVIEW_READ_LIMITED, ScopePathType.ORCID_WORKS_READ_LIMITED);
    DistinctionSummary d1 = createDistinctionSummary(Visibility.PUBLIC, CLIENT_2);
    DistinctionSummary d2 = createDistinctionSummary(Visibility.LIMITED, CLIENT_2);
    DistinctionSummary d3 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
    EducationSummary e1 = createEducationSummary(Visibility.PUBLIC, CLIENT_2);
    EducationSummary e2 = createEducationSummary(Visibility.LIMITED, CLIENT_2);
    EducationSummary e3 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
    EmploymentSummary em1 = createEmploymentSummary(Visibility.PUBLIC, CLIENT_2);
    EmploymentSummary em2 = createEmploymentSummary(Visibility.LIMITED, CLIENT_2);
    EmploymentSummary em3 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
    InvitedPositionSummary i1 = createInvitedPositionSummary(Visibility.PUBLIC, CLIENT_2);
    InvitedPositionSummary i2 = createInvitedPositionSummary(Visibility.LIMITED, CLIENT_2);
    InvitedPositionSummary i3 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
    MembershipSummary m1 = createMembershipSummary(Visibility.PUBLIC, CLIENT_2);
    MembershipSummary m2 = createMembershipSummary(Visibility.LIMITED, CLIENT_2);
    MembershipSummary m3 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
    QualificationSummary q1 = createQualificationSummary(Visibility.PUBLIC, CLIENT_2);
    QualificationSummary q2 = createQualificationSummary(Visibility.LIMITED, CLIENT_2);
    QualificationSummary q3 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
    ServiceSummary s1 = createServiceSummary(Visibility.PUBLIC, CLIENT_2);
    ServiceSummary s2 = createServiceSummary(Visibility.LIMITED, CLIENT_2);
    ServiceSummary s3 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
    FundingSummary f1 = createFundingSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    FundingSummary f2 = createFundingSummary(Visibility.LIMITED, CLIENT_2, EXTID_2);
    FundingSummary f3 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    PeerReviewSummary p1 = createPeerReviewSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    PeerReviewSummary p2 = createPeerReviewSummary(Visibility.LIMITED, CLIENT_2, EXTID_2);
    PeerReviewSummary p3 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    WorkSummary w1 = createWorkSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    WorkSummary w2 = createWorkSummary(Visibility.LIMITED, CLIENT_2, EXTID_2);
    WorkSummary w3 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    ActivitiesSummary as = new ActivitiesSummary();
    as.setEducations(createEducations(e1, e2, e3));
    as.setEmployments(createEmployments(em1, em2, em3));
    as.setFundings(createFundings(f1, f2, f3));
    as.setPeerReviews(createPeerReviews(p1, p2, p3));
    as.setWorks(createWorks(w1, w2, w3));
    as.setDistinctions(createDistinctions(d1, d2, d3));
    as.setInvitedPositions(createInvitedPositions(i1, i2, i3));
    as.setMemberships(createMemberships(m1, m2, m3));
    as.setQualifications(createQualifications(q1, q2, q3));
    as.setServices(createServices(s1, s2, s3));
    orcidSecurityManager.checkAndFilter(ORCID_1, as);
    // Check distinctions
    assertEquals(2, as.getDistinctions().getSummaries().size());
    assertTrue(as.getDistinctions().getSummaries().contains(d1));
    assertTrue(as.getDistinctions().getSummaries().contains(d2));
    assertFalse(as.getDistinctions().getSummaries().contains(d3));
    // Check invited positions
    assertEquals(2, as.getInvitedPositions().getSummaries().size());
    assertTrue(as.getInvitedPositions().getSummaries().contains(i1));
    assertTrue(as.getInvitedPositions().getSummaries().contains(i2));
    assertFalse(as.getInvitedPositions().getSummaries().contains(i3));
    // Check memberships
    assertEquals(2, as.getMemberships().getSummaries().size());
    assertTrue(as.getMemberships().getSummaries().contains(m1));
    assertTrue(as.getMemberships().getSummaries().contains(m2));
    assertFalse(as.getMemberships().getSummaries().contains(m3));
    // Check qualifications
    assertEquals(2, as.getQualifications().getSummaries().size());
    assertTrue(as.getQualifications().getSummaries().contains(q1));
    assertTrue(as.getQualifications().getSummaries().contains(q2));
    assertFalse(as.getQualifications().getSummaries().contains(q3));
    // Check services
    assertEquals(2, as.getServices().getSummaries().size());
    assertTrue(as.getServices().getSummaries().contains(s1));
    assertTrue(as.getServices().getSummaries().contains(s2));
    assertFalse(as.getServices().getSummaries().contains(s3));
    // Check it have limited Educations
    assertNotNull(as.getEducations());
    assertEquals(2, as.getEducations().getSummaries().size());
    assertTrue(as.getEducations().getSummaries().contains(e1));
    assertTrue(as.getEducations().getSummaries().contains(e2));
    assertFalse(as.getEducations().getSummaries().contains(e3));
    // Check it have limited Employments
    assertNotNull(as.getEmployments());
    assertEquals(2, as.getEmployments().getSummaries().size());
    assertTrue(as.getEmployments().getSummaries().contains(em1));
    assertTrue(as.getEmployments().getSummaries().contains(em2));
    assertFalse(as.getEmployments().getSummaries().contains(em3));
    // Check it have limited funding
    assertNotNull(as.getFundings());
    assertEquals(1, as.getFundings().getFundingGroup().size());
    assertEquals(2, as.getFundings().getFundingGroup().get(0).getActivities().size());
    assertTrue(as.getFundings().getFundingGroup().get(0).getActivities().contains(f1));
    assertTrue(as.getFundings().getFundingGroup().get(0).getActivities().contains(f2));
    assertFalse(as.getFundings().getFundingGroup().get(0).getActivities().contains(f3));
    assertEquals(3, as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_1)));
    assertTrue(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_2)));
    assertFalse(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_3)));
    assertTrue(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED)));
    // Check it have limited reviews
    assertNotNull(as.getPeerReviews());
    assertEquals(1, as.getPeerReviews().getPeerReviewGroup().size());
    assertEquals(2, as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().size());
    assertTrue(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p1));
    assertTrue(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p2));
    assertFalse(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p3));
    assertEquals(1, as.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED, "peer-review")));
    // Check it have limited works
    assertNotNull(as.getWorks());
    assertEquals(1, as.getWorks().getWorkGroup().size());
    assertEquals(2, as.getWorks().getWorkGroup().get(0).getActivities().size());
    assertTrue(as.getWorks().getWorkGroup().get(0).getActivities().contains(w1));
    assertTrue(as.getWorks().getWorkGroup().get(0).getActivities().contains(w2));
    assertFalse(as.getWorks().getWorkGroup().get(0).getActivities().contains(w3));
    assertEquals(3, as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_1)));
    assertTrue(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_2)));
    assertFalse(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_3)));
    assertTrue(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED)));
}
Also used : WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) InvitedPositionSummary(org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary) QualificationSummary(org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary) EducationSummary(org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary) PeerReviewSummary(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary) FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) DistinctionSummary(org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary) EmploymentSummary(org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary) MembershipSummary(org.orcid.jaxb.model.v3.dev1.record.summary.MembershipSummary) ServiceSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ServiceSummary) ActivitiesSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary) Test(org.junit.Test)

Aggregations

FundingSummary (org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)67 Test (org.junit.Test)52 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)40 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)40 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)40 PeerReviewSummary (org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary)39 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)36 DistinctionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary)35 InvitedPositionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary)35 MembershipSummary (org.orcid.jaxb.model.v3.dev1.record.summary.MembershipSummary)35 QualificationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary)35 ServiceSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ServiceSummary)35 Fundings (org.orcid.jaxb.model.v3.dev1.record.summary.Fundings)16 Address (org.orcid.jaxb.model.v3.dev1.record.Address)15 Email (org.orcid.jaxb.model.v3.dev1.record.Email)15 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)15 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)15 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)15 Record (org.orcid.jaxb.model.v3.dev1.record.Record)15 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)15