use of org.orcid.jaxb.model.groupid_rc2.GroupIdRecord 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.groupid_rc2.GroupIdRecord in project ORCID-Source by ORCID.
the class OrcidInfo method getPeerReviewsJson.
@RequestMapping(value = "/{orcid:(?:\\d{4}-){3,}\\d{3}[\\dX]}/peer-reviews.json")
@ResponseBody
public List<PeerReviewForm> getPeerReviewsJson(HttpServletRequest request, @PathVariable("orcid") String orcid, @RequestParam(value = "peerReviewIds") String peerReviewIdsStr) {
Map<String, String> languages = lm.buildLanguageMap(localeManager.getLocale(), false);
List<PeerReviewForm> peerReviews = new ArrayList<PeerReviewForm>();
Map<Long, PeerReview> peerReviewMap = peerReviewMap(orcid, getLastModifiedTime(orcid));
String[] peerReviewIds = peerReviewIdsStr.split(",");
for (String id : peerReviewIds) {
PeerReview peerReview = peerReviewMap.get(Long.valueOf(id));
validateVisibility(peerReview.getVisibility());
sourceUtils.setSourceName(peerReview);
PeerReviewForm form = PeerReviewForm.valueOf(peerReview);
// Set language name
form.setCountryForDisplay(getMessage(buildInternationalizationKey(CountryIsoEntity.class, peerReview.getOrganization().getAddress().getCountry().name())));
if (!PojoUtil.isEmpty(form.getTranslatedSubjectName())) {
// Set translated title language name
if (!StringUtils.isEmpty(form.getTranslatedSubjectName().getLanguageCode())) {
String languageName = languages.get(form.getTranslatedSubjectName().getLanguageCode());
form.getTranslatedSubjectName().setLanguageName(languageName);
}
}
// the group id
if (form.getGroupId() != null && !PojoUtil.isEmpty(form.getGroupId().getValue())) {
GroupIdRecord groupId = groupIdRecordManager.findByGroupId(form.getGroupId().getValue()).get();
form.setGroupIdPutCode(Text.valueOf(groupId.getPutCode()));
}
peerReviews.add(form);
}
return peerReviews;
}
use of org.orcid.jaxb.model.groupid_rc2.GroupIdRecord in project ORCID-Source by ORCID.
the class ActivityValidatorTest method getGroupIdRecord.
public GroupIdRecord getGroupIdRecord() {
GroupIdRecord g = new GroupIdRecord();
g.setDescription("description");
g.setGroupId("orcid-generated:0123456789");
g.setName("group-name");
g.setType("group-type");
return g;
}
use of org.orcid.jaxb.model.groupid_rc2.GroupIdRecord in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateGroupId_invalidGroupIdTest.
@Test(expected = OrcidValidationException.class)
public void validateGroupId_invalidGroupIdTest() {
SourceEntity source = mock(SourceEntity.class);
when(source.getSourceName()).thenReturn("source name");
GroupIdRecord g = getGroupIdRecord();
g.setGroupId("invalid");
activityValidator.validateGroupIdRecord(g, true, source);
}
use of org.orcid.jaxb.model.groupid_rc2.GroupIdRecord in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getGroupIdRecordMapperFacade.
public MapperFacade getGroupIdRecordMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<GroupIdRecord, GroupIdRecordEntity> classMap = mapperFactory.classMap(GroupIdRecord.class, GroupIdRecordEntity.class);
addV2CommonFields(classMap);
registerSourceConverters(mapperFactory, classMap);
classMap.field("name", "groupName");
classMap.field("groupId", "groupId");
classMap.field("description", "groupDescription");
classMap.field("type", "groupType");
classMap.register();
return mapperFactory.getMapperFacade();
}
Aggregations