use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testValidateRecordUsingToken.
@Test
public void testValidateRecordUsingToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewRecord(ORCID);
assertNotNull(response);
Record record = (Record) response.getEntity();
validateRecord(record);
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV3Test method checkIsPublicRecordTest.
@Test
public void checkIsPublicRecordTest() {
Record r = getRecordElement();
publicAPISecurityManagerV3.filter(r);
// Verify activities - nothing filtered
ActivitiesSummary as = r.getActivitiesSummary();
assertEquals(3, as.getEducations().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getEducations());
assertEquals(3, as.getEmployments().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getEmployments());
assertEquals(3, as.getFundings().getFundingGroup().size());
assertGroupContainsOnlyPublicElements(as.getFundings());
assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
assertGroupContainsOnlyPublicElements(as.getPeerReviews());
assertEquals(3, as.getWorks().getWorkGroup().size());
assertGroupContainsOnlyPublicElements(as.getWorks());
assertEquals(3, as.getDistinctions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getDistinctions());
assertEquals(3, as.getInvitedPositions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getInvitedPositions());
assertEquals(3, as.getMemberships().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getMemberships());
assertEquals(3, as.getQualifications().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getQualifications());
assertEquals(3, as.getServices().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getServices());
// Verify bio sections - nothing filtered
Person p = r.getPerson();
assertEquals(3, p.getAddresses().getAddress().size());
assertAllArePublic(p.getAddresses().getAddress());
assertEquals(3, p.getEmails().getEmails().size());
assertAllArePublic(p.getEmails().getEmails());
assertEquals(3, p.getExternalIdentifiers().getExternalIdentifiers().size());
assertAllArePublic(p.getExternalIdentifiers().getExternalIdentifiers());
assertEquals(3, p.getKeywords().getKeywords().size());
assertAllArePublic(p.getKeywords().getKeywords());
assertEquals(3, p.getOtherNames().getOtherNames().size());
assertAllArePublic(p.getOtherNames().getOtherNames());
assertEquals(3, p.getResearcherUrls().getResearcherUrls().size());
assertAllArePublic(p.getResearcherUrls().getResearcherUrls());
assertNotNull(p.getBiography());
assertNotNull(p.getName());
// Filter biography, name, educations and funding
r = getRecordElement();
r.getPerson().getBiography().setVisibility(Visibility.LIMITED);
r.getPerson().getName().setVisibility(Visibility.LIMITED);
setVisibility(r.getActivitiesSummary().getEducations().getSummaries(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
setVisibility(r.getActivitiesSummary().getFundings(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
publicAPISecurityManagerV3.filter(r);
// Verify activities - educations and funding filtered
as = r.getActivitiesSummary();
assertNotNull(as.getEducations());
assertTrue(as.getEducations().getSummaries().isEmpty());
assertEquals(3, as.getEmployments().getSummaries().size());
assertTrue(as.getFundings().getFundingGroup().isEmpty());
assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
assertEquals(3, as.getWorks().getWorkGroup().size());
assertEquals(3, as.getDistinctions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getDistinctions());
assertEquals(3, as.getInvitedPositions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getInvitedPositions());
assertEquals(3, as.getMemberships().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getMemberships());
assertEquals(3, as.getQualifications().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getQualifications());
assertEquals(3, as.getServices().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getServices());
// Verify bio sections - bio and name filtered
p = r.getPerson();
assertEquals(3, p.getAddresses().getAddress().size());
assertEquals(3, p.getEmails().getEmails().size());
assertEquals(3, p.getExternalIdentifiers().getExternalIdentifiers().size());
assertEquals(3, p.getKeywords().getKeywords().size());
assertEquals(3, p.getOtherNames().getOtherNames().size());
assertEquals(3, p.getResearcherUrls().getResearcherUrls().size());
assertNull(p.getBiography());
assertNull(p.getName());
// Filter emails, external identifiers, peer reviews and works
r = getRecordElement();
setVisibility(r.getPerson().getEmails().getEmails(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
setVisibility(r.getPerson().getExternalIdentifiers().getExternalIdentifiers(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
setVisibility(r.getActivitiesSummary().getPeerReviews(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
setVisibility(r.getActivitiesSummary().getWorks(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
publicAPISecurityManagerV3.filter(r);
// Verify activities - peer reviews and works filtered
as = r.getActivitiesSummary();
assertEquals(3, as.getEducations().getSummaries().size());
assertEquals(3, as.getEmployments().getSummaries().size());
assertEquals(3, as.getFundings().getFundingGroup().size());
assertTrue(as.getPeerReviews().getPeerReviewGroup().isEmpty());
assertTrue(as.getWorks().getWorkGroup().isEmpty());
assertEquals(3, as.getDistinctions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getDistinctions());
assertEquals(3, as.getInvitedPositions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getInvitedPositions());
assertEquals(3, as.getMemberships().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getMemberships());
assertEquals(3, as.getQualifications().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getQualifications());
assertEquals(3, as.getServices().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getServices());
// Verify bio sections - emails, external identifiers filtered
p = r.getPerson();
assertEquals(3, p.getAddresses().getAddress().size());
assertNotNull(p.getEmails());
assertTrue(p.getEmails().getEmails().isEmpty());
assertNotNull(p.getExternalIdentifiers());
assertTrue(p.getExternalIdentifiers().getExternalIdentifiers().isEmpty());
assertEquals(3, p.getKeywords().getKeywords().size());
assertEquals(3, p.getOtherNames().getOtherNames().size());
assertEquals(3, p.getResearcherUrls().getResearcherUrls().size());
assertNotNull(p.getBiography());
assertNotNull(p.getName());
// Filter keywords and other names
r = getRecordElement();
setVisibility(r.getPerson().getOtherNames().getOtherNames(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
setVisibility(r.getPerson().getKeywords().getKeywords(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
publicAPISecurityManagerV3.filter(r);
// Verify activities - nothing filtered
as = r.getActivitiesSummary();
assertEquals(3, as.getEducations().getSummaries().size());
assertEquals(3, as.getEmployments().getSummaries().size());
assertEquals(3, as.getFundings().getFundingGroup().size());
assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
assertEquals(3, as.getWorks().getWorkGroup().size());
assertEquals(3, as.getDistinctions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getDistinctions());
assertEquals(3, as.getInvitedPositions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getInvitedPositions());
assertEquals(3, as.getMemberships().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getMemberships());
assertEquals(3, as.getQualifications().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getQualifications());
assertEquals(3, as.getServices().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getServices());
// Verify bio sections - keywords and other names filtered
p = r.getPerson();
assertEquals(3, p.getAddresses().getAddress().size());
assertEquals(3, p.getEmails().getEmails().size());
assertEquals(3, p.getExternalIdentifiers().getExternalIdentifiers().size());
assertNotNull(p.getKeywords());
assertTrue(p.getKeywords().getKeywords().isEmpty());
assertNotNull(p.getOtherNames());
assertTrue(p.getOtherNames().getOtherNames().isEmpty());
assertEquals(3, p.getResearcherUrls().getResearcherUrls().size());
assertNotNull(p.getBiography());
assertNotNull(p.getName());
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorImpl method viewRecord.
@Override
public Response viewRecord(String orcid) {
Record record = recordManagerReadOnly.getPublicRecord(orcid);
publicAPISecurityManagerV3.filter(record);
if (record.getPerson() != null) {
sourceUtilsReadOnly.setSourceName(record.getPerson());
}
if (record.getActivitiesSummary() != null) {
ActivityUtils.cleanEmptyFields(record.getActivitiesSummary());
sourceUtilsReadOnly.setSourceName(record.getActivitiesSummary());
}
ElementUtils.setPathToRecord(record, orcid);
Api3_0_Dev1LastModifiedDatesHelper.calculateLastModified(record);
return Response.ok(record).build();
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class RecordManagerReadOnlyImpl method getRecord.
@Override
public Record getRecord(String orcid) {
Record record = new Record();
record.setOrcidType(getOrcidType(orcid));
record.setHistory(getHistory(orcid));
record.setOrcidIdentifier(getOrcidIdentifier(orcid));
record.setPreferences(getPreferences(orcid));
record.setActivitiesSummary(activitiesSummaryManager.getActivitiesSummary(orcid));
record.setPerson(personDetailsManager.getPersonDetails(orcid));
return record;
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class ContributorUtilsTest method getFundingWithOrcidContributor.
private Funding getFundingWithOrcidContributor() {
Funding funding = new Funding();
FundingTitle fundingTitle = new FundingTitle();
fundingTitle.setTitle(new Title("work with contributor who has ORCID record"));
funding.setTitle(fundingTitle);
funding.setContributors(getFundingContributorWithOrcid());
return funding;
}
Aggregations