use of org.orcid.pojo.ajaxForm.OtherNameForm in project ORCID-Source by ORCID.
the class WorkspaceController method setOtherNamesFormJson.
@RequestMapping(value = "/my-orcid/otherNamesForms.json", method = RequestMethod.POST)
@ResponseBody
public OtherNamesForm setOtherNamesFormJson(@RequestBody OtherNamesForm onf) throws NoSuchRequestHandlingMethodException {
onf.setErrors(new ArrayList<String>());
if (onf != null) {
Iterator<OtherNameForm> it = onf.getOtherNames().iterator();
while (it.hasNext()) {
OtherNameForm form = it.next();
if (PojoUtil.isEmpty(form.getContent())) {
it.remove();
continue;
}
if (form.getContent().length() > SiteConstants.MAX_LENGTH_255) {
form.setContent(form.getContent().substring(0, SiteConstants.MAX_LENGTH_255));
}
// Validate visibility is not null
validateVisibility(form);
copyErrors(form, onf);
copyErrors(form.getVisibility(), onf);
}
if (onf.getErrors().size() > 0) {
return onf;
}
OtherNames otherNames = onf.toOtherNames();
otherNameManager.updateOtherNames(getEffectiveUserOrcid(), otherNames);
}
return onf;
}
Aggregations