use of org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecords in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_GroupIdTest method testGetGroupIdRecords.
@Test
public void testGetGroupIdRecords() {
SecurityContextTestUtils.setUpSecurityContextForGroupIdClientOnly();
/*
* At this point there should be at least 3 group ids and no more than
* 5, since we are not sure if testDeleteGroupIdRecord and
* testCreateGroupIdRecord have ran or not
*/
// So, get a page with all
Response response = serviceDelegator.viewGroupIdRecords("5", "1");
assertNotNull(response);
GroupIdRecords groupIdRecords1 = (GroupIdRecords) response.getEntity();
assertNotNull(groupIdRecords1);
assertNotNull(groupIdRecords1.getGroupIdRecord());
int total = groupIdRecords1.getTotal();
if (total < 3 || total > 5) {
fail("There are more group ids than the expected, we are expecting between 3 and 5, total: " + total);
}
}
use of org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecords in project ORCID-Source by ORCID.
the class GroupIdRecordManagerReadOnlyImpl method getGroupIdRecords.
@Override
public GroupIdRecords getGroupIdRecords(String pageSize, String pageNum) {
int pageNumInt = convertToInteger(pageNum);
int pageSizeInt = convertToInteger(pageSize);
GroupIdRecords records = new GroupIdRecords();
records.setPage(pageNumInt);
records.setPageSize(pageSizeInt);
List<GroupIdRecordEntity> recordEntities = groupIdRecordDao.getGroupIdRecords(pageSizeInt, pageNumInt);
List<GroupIdRecord> recordsReturned = jpaJaxbGroupIdRecordAdapter.toGroupIdRecords(recordEntities);
if (recordsReturned != null) {
records.setTotal(recordsReturned.size());
records.getGroupIdRecord().addAll(recordsReturned);
} else {
records.setTotal(0);
}
return records;
}
use of org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecords in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorImpl method viewGroupIdRecords.
@Override
public Response viewGroupIdRecords(String pageSize, String pageNum) {
GroupIdRecords records = groupIdRecordManagerReadOnly.getGroupIdRecords(pageSize, pageNum);
Api3_0_Dev1LastModifiedDatesHelper.calculateLastModified(records);
return Response.ok(records).build();
}
use of org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecords in project ORCID-Source by ORCID.
the class Api3_0_Dev1LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(GroupIdRecords groupIdRecords) {
if (groupIdRecords != null && groupIdRecords.getGroupIdRecord() != null && !groupIdRecords.getGroupIdRecord().isEmpty()) {
LastModifiedDate latest = null;
for (GroupIdRecord groupid : groupIdRecords.getGroupIdRecord()) {
if (groupid.getLastModifiedDate() != null && groupid.getLastModifiedDate().after(latest)) {
latest = groupid.getLastModifiedDate();
}
}
groupIdRecords.setLastModifiedDate(latest);
}
}
use of org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecords in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegatorImpl method viewGroupIdRecords.
@Override
public Response viewGroupIdRecords(String pageSize, String pageNum) {
orcidSecurityManager.checkScopes(ScopePathType.GROUP_ID_RECORD_READ);
GroupIdRecords records = groupIdRecordManagerReadOnly.getGroupIdRecords(pageSize, pageNum);
Api3_0_Dev1LastModifiedDatesHelper.calculateLastModified(records);
return Response.ok(records).build();
}
Aggregations