use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method viewFundings.
@Override
public Response viewFundings(String orcid) {
List<FundingSummary> fundingSummaries = profileFundingManagerReadOnly.getFundingSummaryList(orcid);
// Lets copy the list so we don't modify the cached collection
List<FundingSummary> filteredList = null;
if (fundingSummaries != null) {
filteredList = new ArrayList<FundingSummary>(fundingSummaries);
}
fundingSummaries = filteredList;
orcidSecurityManager.checkAndFilter(orcid, fundingSummaries, ScopePathType.FUNDING_READ_LIMITED);
Fundings fundings = profileFundingManager.groupFundings(fundingSummaries, false);
ActivityUtils.setPathToFundings(fundings, orcid);
Api2_0_LastModifiedDatesHelper.calculateLastModified(fundings);
sourceUtils.setSourceName(fundings);
return Response.ok(fundings).build();
}
use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.
the class SourceUtils method setSourceName.
public void setSourceName(ActivitiesSummary as) {
if (as == null) {
return;
}
if (as.getEducations() != null) {
Educations educations = as.getEducations();
List<EducationSummary> list = educations.getSummaries();
if (list != null) {
for (EducationSummary summary : list) {
setSourceName(summary);
}
}
}
if (as.getEmployments() != null) {
Employments employments = as.getEmployments();
List<EmploymentSummary> list = employments.getSummaries();
if (list != null) {
for (EmploymentSummary summary : list) {
setSourceName(summary);
}
}
}
if (as.getFundings() != null) {
Fundings fundings = as.getFundings();
List<FundingGroup> groups = fundings.getFundingGroup();
if (groups != null) {
for (FundingGroup group : groups) {
List<FundingSummary> summaryList = group.getFundingSummary();
if (summaryList != null) {
for (FundingSummary summary : summaryList) {
setSourceName(summary);
}
}
}
}
}
if (as.getPeerReviews() != null) {
PeerReviews peerReviews = as.getPeerReviews();
List<PeerReviewGroup> groups = peerReviews.getPeerReviewGroup();
if (groups != null) {
for (PeerReviewGroup group : groups) {
List<PeerReviewSummary> summaryList = group.getPeerReviewSummary();
if (summaryList != null) {
for (PeerReviewSummary summary : summaryList) {
setSourceName(summary);
}
}
}
}
}
if (as.getWorks() != null) {
Works works = as.getWorks();
List<WorkGroup> groups = works.getWorkGroup();
if (groups != null) {
for (WorkGroup group : groups) {
List<WorkSummary> summaryList = group.getWorkSummary();
if (summaryList != null) {
for (WorkSummary summary : summaryList) {
setSourceName(summary);
}
}
}
}
}
}
use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testGetPublicFundingsUsingToken.
@Test
public void testGetPublicFundingsUsingToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewFundings(ORCID);
assertNotNull(r);
Fundings fundings = (Fundings) r.getEntity();
assertNotNull(fundings);
assertNotNull(fundings.getLastModifiedDate());
assertNotNull(fundings.getLastModifiedDate().getValue());
assertNotNull(fundings.getFundingGroup());
assertEquals(1, fundings.getFundingGroup().size());
assertNotNull(fundings.getFundingGroup().get(0).getIdentifiers());
assertEquals(1, fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().size());
assertEquals("http://test.orcid.org/1.com", fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getUrl().getValue());
assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary());
assertEquals(1, fundings.getFundingGroup().get(0).getFundingSummary().size());
assertEquals(Long.valueOf(10), fundings.getFundingGroup().get(0).getFundingSummary().get(0).getPutCode());
assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary().get(0).getLastModifiedDate());
assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary().get(0).getLastModifiedDate().getValue());
}
use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testGetPublicFundings.
@Test
public void testGetPublicFundings() {
Response r = serviceDelegator.viewFundings(ORCID);
assertNotNull(r);
Fundings fundings = (Fundings) r.getEntity();
assertNotNull(fundings);
assertNotNull(fundings.getLastModifiedDate());
assertNotNull(fundings.getLastModifiedDate().getValue());
assertNotNull(fundings.getFundingGroup());
assertEquals(1, fundings.getFundingGroup().size());
assertNotNull(fundings.getFundingGroup().get(0).getIdentifiers());
assertEquals(1, fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().size());
assertEquals("http://test.orcid.org/1.com", fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getUrl().getValue());
assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary());
assertEquals(1, fundings.getFundingGroup().get(0).getFundingSummary().size());
assertEquals(Long.valueOf(10), fundings.getFundingGroup().get(0).getFundingSummary().get(0).getPutCode());
assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary().get(0).getLastModifiedDate());
assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary().get(0).getLastModifiedDate().getValue());
}
use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testViewFundings.
@Test
public void testViewFundings() {
Response response = serviceDelegator.viewFundings(ORCID);
assertNotNull(response);
Fundings fundings = (Fundings) response.getEntity();
assertNotNull(fundings);
assertEquals("/0000-0000-0000-0003/fundings", fundings.getPath());
assertNotNull(fundings.getLastModifiedDate());
assertNotNull(fundings.getLastModifiedDate().getValue());
assertEquals(1, fundings.getFundingGroup().size());
assertEquals(1, fundings.getFundingGroup().get(0).getFundingSummary().size());
FundingSummary funding = fundings.getFundingGroup().get(0).getFundingSummary().get(0);
assertNotNull(funding.getTitle());
assertNotNull(funding.getTitle().getTitle());
assertEquals(Long.valueOf(10), funding.getPutCode());
assertNotNull(funding.getLastModifiedDate());
assertNotNull(funding.getLastModifiedDate().getValue());
assertEquals("/0000-0000-0000-0003/funding/10", funding.getPath());
assertEquals("PUBLIC", funding.getTitle().getTitle().getContent());
assertEquals(Visibility.PUBLIC.value(), funding.getVisibility().value());
assertEquals("APP-5555555555555555", funding.getSource().retrieveSourcePath());
}
Aggregations