use of org.orcid.pojo.ajaxForm.KeywordForm in project ORCID-Source by ORCID.
the class WorkspaceController method setKeywordsFormJson.
@RequestMapping(value = "/my-orcid/keywordsForms.json", method = RequestMethod.POST)
@ResponseBody
public KeywordsForm setKeywordsFormJson(HttpServletRequest request, @RequestBody KeywordsForm kf) throws NoSuchRequestHandlingMethodException {
kf.setErrors(new ArrayList<String>());
if (kf != null) {
Iterator<KeywordForm> it = kf.getKeywords().iterator();
while (it.hasNext()) {
KeywordForm k = it.next();
if (!PojoUtil.isEmpty(k.getContent())) {
if (k.getContent().length() > SiteConstants.KEYWORD_MAX_LENGTH) {
k.setContent(k.getContent().substring(0, SiteConstants.KEYWORD_MAX_LENGTH));
}
} else {
it.remove();
}
// Validate visibility is not null
validateVisibility(k);
copyErrors(k, kf);
copyErrors(k.getVisibility(), kf);
}
if (kf.getErrors().size() > 0) {
return kf;
}
Keywords updatedKeywords = kf.toKeywords();
profileKeywordManager.updateKeywords(getCurrentUserOrcid(), updatedKeywords);
}
return kf;
}
Aggregations