Search in sources :

Example 1 with ExternalIdentifierForm

use of org.orcid.pojo.ajaxForm.ExternalIdentifierForm in project ORCID-Source by ORCID.

the class WorkspaceController method updateExternalIdentifierJson.

/**
 * Update the visibility of the given external identifeirs
 */
@RequestMapping(value = "/my-orcid/externalIdentifiers.json", method = RequestMethod.POST)
@ResponseBody
public ExternalIdentifiersForm updateExternalIdentifierJson(HttpServletRequest request, @RequestBody ExternalIdentifiersForm externalIdentifiersForm) {
    externalIdentifiersForm.setErrors(new ArrayList<String>());
    // Validate visibility is not null
    if (externalIdentifiersForm != null && externalIdentifiersForm.getExternalIdentifiers() != null) {
        for (ExternalIdentifierForm extId : externalIdentifiersForm.getExternalIdentifiers()) {
            // Validate visibility is not null
            validateVisibility(extId);
            copyErrors(extId, externalIdentifiersForm);
        }
    }
    if (!externalIdentifiersForm.getErrors().isEmpty()) {
        return externalIdentifiersForm;
    }
    PersonExternalIdentifiers externalIdentifiers = externalIdentifiersForm.toPersonExternalIdentifiers();
    externalIdentifiers = externalIdentifierManager.updateExternalIdentifiers(getCurrentUserOrcid(), externalIdentifiers);
    return externalIdentifiersForm;
}
Also used : PersonExternalIdentifiers(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers) ExternalIdentifierForm(org.orcid.pojo.ajaxForm.ExternalIdentifierForm) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

PersonExternalIdentifiers (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers)1 ExternalIdentifierForm (org.orcid.pojo.ajaxForm.ExternalIdentifierForm)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1