use of org.orcid.jaxb.model.record.summary_rc2.EducationSummary in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EducationsTest method testViewEducationSummaryReadPublic.
@Test
public void testViewEducationSummaryReadPublic() {
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewEducationSummary(ORCID, 20L);
EducationSummary element = (EducationSummary) r.getEntity();
assertNotNull(element);
assertEquals("/0000-0000-0000-0003/education/20", element.getPath());
Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
use of org.orcid.jaxb.model.record.summary_rc2.EducationSummary in project ORCID-Source by ORCID.
the class ActivitiesSummaryManagerReadOnlyImpl method getActivitiesSummary.
public ActivitiesSummary getActivitiesSummary(String orcid, boolean justPublic) {
long lastModifiedTime = getLastModified(orcid);
ActivitiesSummary activities = new ActivitiesSummary();
// Set educations
List<EducationSummary> educationsList = affiliationsManager.getEducationSummaryList(orcid, lastModifiedTime);
Educations educations = new Educations();
for (EducationSummary summary : educationsList) {
if (justPublic) {
if (Visibility.PUBLIC.equals(summary.getVisibility())) {
educations.getSummaries().add(summary);
}
} else {
educations.getSummaries().add(summary);
}
}
activities.setEducations(educations);
// Set employments
List<EmploymentSummary> employmentList = affiliationsManager.getEmploymentSummaryList(orcid, lastModifiedTime);
Employments employments = new Employments();
for (EmploymentSummary summary : employmentList) {
if (justPublic) {
if (Visibility.PUBLIC.equals(summary.getVisibility())) {
employments.getSummaries().add(summary);
}
} else {
employments.getSummaries().add(summary);
}
}
activities.setEmployments(employments);
// Set fundings
List<FundingSummary> fundingSummaries = fundingManager.getFundingSummaryList(orcid, lastModifiedTime);
Fundings fundings = fundingManager.groupFundings(fundingSummaries, justPublic);
activities.setFundings(fundings);
// Set peer reviews
List<PeerReviewSummary> peerReviewSummaries = peerReviewManager.getPeerReviewSummaryList(orcid, lastModifiedTime);
PeerReviews peerReviews = peerReviewManager.groupPeerReviews(peerReviewSummaries, justPublic);
activities.setPeerReviews(peerReviews);
// Set works
List<WorkSummary> workSummaries = workManager.getWorksSummaryList(orcid, lastModifiedTime);
Works works = workManager.groupWorks(workSummaries, justPublic);
activities.setWorks(works);
return activities;
}
use of org.orcid.jaxb.model.record.summary_rc2.EducationSummary in project ORCID-Source by ORCID.
the class AffiliationsManagerTest method testGetAllEducations.
@Test
public void testGetAllEducations() {
String orcid = "0000-0000-0000-0003";
List<EducationSummary> elements = affiliationsManager.getEducationSummaryList(orcid, System.currentTimeMillis());
assertNotNull(elements);
assertEquals(5, elements.size());
boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
for (EducationSummary element : elements) {
if (20 == element.getPutCode()) {
found1 = true;
} else if (21 == element.getPutCode()) {
found2 = true;
} else if (22 == element.getPutCode()) {
found3 = true;
} else if (25 == element.getPutCode()) {
found4 = true;
} else if (26 == element.getPutCode()) {
found5 = true;
} else {
fail("Invalid element found: " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
assertTrue(found5);
}
use of org.orcid.jaxb.model.record.summary_rc2.EducationSummary 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);
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);
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));
orcidSecurityManager.checkAndFilter(ORCID_1, as);
// 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)));
}
use of org.orcid.jaxb.model.record.summary_rc2.EducationSummary in project ORCID-Source by ORCID.
the class OrcidSecurityManager_ActivitiesSummaryTest method testActivitiesSummary_When_AllPrivate_NoSource_ReadPublicToken.
@Test
public void testActivitiesSummary_When_AllPrivate_NoSource_ReadPublicToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
EducationSummary e1 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
EducationSummary e2 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
EducationSummary e3 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
EmploymentSummary em1 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
EmploymentSummary em2 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
EmploymentSummary em3 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
FundingSummary f1 = createFundingSummary(Visibility.PRIVATE, 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.PRIVATE, 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.PRIVATE, 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));
orcidSecurityManager.checkAndFilter(ORCID_1, as);
assertNotNull(as);
// Check educations
assertEquals(0, as.getEducations().getSummaries().size());
// Check employments
assertEquals(0, as.getEmployments().getSummaries().size());
// Check fundings
assertEquals(0, as.getFundings().getFundingGroup().size());
// Check peer reviews
assertEquals(0, as.getPeerReviews().getPeerReviewGroup().size());
// Check works
assertEquals(0, as.getWorks().getWorkGroup().size());
}
Aggregations