use of org.orcid.jaxb.model.record.summary_rc4.EmploymentSummary in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method getEmployments.
private Employments getEmployments(Visibility... vs) {
Employments e = new Employments();
for (Visibility v : vs) {
EmploymentSummary s = new EmploymentSummary();
s.setVisibility(v);
e.getSummaries().add(s);
}
return e;
}
use of org.orcid.jaxb.model.record.summary_rc4.EmploymentSummary in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorImpl method viewEmploymentSummary.
@Override
public Response viewEmploymentSummary(String orcid, Long putCode) {
EmploymentSummary es = affiliationsManagerReadOnly.getEmploymentSummary(orcid, putCode);
publicAPISecurityManagerV2.checkIsPublic(es);
ActivityUtils.setPathToActivity(es, orcid);
sourceUtilsReadOnly.setSourceName(es);
return Response.ok(es).build();
}
use of org.orcid.jaxb.model.record.summary_rc4.EmploymentSummary in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorImpl method viewEmployments.
@Override
public Response viewEmployments(String orcid) {
List<EmploymentSummary> employments = affiliationsManagerReadOnly.getEmploymentSummaryList(orcid, getLastModifiedTime(orcid));
Employments publicEmployments = new Employments();
for (EmploymentSummary summary : employments) {
if (Visibility.PUBLIC.equals(summary.getVisibility())) {
ActivityUtils.setPathToActivity(summary, orcid);
sourceUtilsReadOnly.setSourceName(summary);
publicEmployments.getSummaries().add(summary);
}
}
Api2_0_LastModifiedDatesHelper.calculateLastModified(publicEmployments);
ActivityUtils.setPathToEmployments(publicEmployments, orcid);
return Response.ok(publicEmployments).build();
}
use of org.orcid.jaxb.model.record.summary_rc4.EmploymentSummary in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method viewEmploymentSummary.
@Override
public Response viewEmploymentSummary(String orcid, Long putCode) {
EmploymentSummary es = affiliationsManagerReadOnly.getEmploymentSummary(orcid, putCode);
orcidSecurityManager.checkAndFilter(orcid, es, ScopePathType.AFFILIATIONS_READ_LIMITED);
ActivityUtils.setPathToActivity(es, orcid);
sourceUtils.setSourceName(es);
return Response.ok(es).build();
}
use of org.orcid.jaxb.model.record.summary_rc4.EmploymentSummary in project ORCID-Source by ORCID.
the class AffiliationsManagerTest method testGetAllEmployments.
@Test
public void testGetAllEmployments() {
String orcid = "0000-0000-0000-0003";
List<EmploymentSummary> elements = affiliationsManager.getEmploymentSummaryList(orcid, System.currentTimeMillis());
assertNotNull(elements);
assertEquals(5, elements.size());
boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
for (EmploymentSummary element : elements) {
if (17 == element.getPutCode()) {
found1 = true;
} else if (18 == element.getPutCode()) {
found2 = true;
} else if (19 == element.getPutCode()) {
found3 = true;
} else if (23 == element.getPutCode()) {
found4 = true;
} else if (24 == element.getPutCode()) {
found5 = true;
} else {
fail("Invalid element found: " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
assertTrue(found5);
}
Aggregations