use of org.orcid.jaxb.model.v3.dev1.common.Visibility in project ORCID-Source by ORCID.
the class ManageProfileController method setProfileCountryJson.
@RequestMapping(value = "/countryForm.json", method = RequestMethod.POST)
@ResponseBody
public AddressesForm setProfileCountryJson(HttpServletRequest request, @RequestBody AddressesForm addressesForm) throws NoSuchRequestHandlingMethodException {
addressesForm.setErrors(new ArrayList<String>());
Map<String, String> countries = retrieveIsoCountries();
if (addressesForm != null) {
if (addressesForm.getAddresses() != null) {
for (AddressForm form : addressesForm.getAddresses()) {
if (form.getIso2Country() == null || form.getIso2Country().getValue() == null) {
form.getErrors().add(getMessage("common.invalid_country"));
} else {
form.setCountryName(countries.get(form.getIso2Country().getValue().name()));
}
// Validate visibility is not null
validateVisibility(form);
copyErrors(form, addressesForm);
copyErrors(form.getVisibility(), addressesForm);
}
}
if (!addressesForm.getErrors().isEmpty()) {
return addressesForm;
}
Addresses addresses = addressesForm.toAddresses();
addressManager.updateAddresses(getCurrentUserOrcid(), addresses);
}
return addressesForm;
}
use of org.orcid.jaxb.model.v3.dev1.common.Visibility in project ORCID-Source by ORCID.
the class ManageProfileController method setNameFormJson.
@RequestMapping(value = "/nameForm.json", method = RequestMethod.POST)
@ResponseBody
public NamesForm setNameFormJson(@RequestBody NamesForm nf) throws NoSuchRequestHandlingMethodException {
nf.setErrors(new ArrayList<String>());
// Strip any html code from names before validating them
if (!PojoUtil.isEmpty(nf.getFamilyName())) {
nf.getFamilyName().setValue(OrcidStringUtils.stripHtml(nf.getFamilyName().getValue()));
}
if (!PojoUtil.isEmpty(nf.getGivenNames())) {
nf.getGivenNames().setValue(OrcidStringUtils.stripHtml(nf.getGivenNames().getValue()));
}
if (!PojoUtil.isEmpty(nf.getCreditName())) {
nf.getCreditName().setValue(OrcidStringUtils.stripHtml(nf.getCreditName().getValue()));
}
// Validate visibility is not null
validateVisibility(nf);
if (nf.getGivenNames() == null)
nf.setGivenNames(new Text());
givenNameValidate(nf.getGivenNames());
copyErrors(nf.getGivenNames(), nf);
copyErrors(nf.getVisibility(), nf);
if (nf.getErrors().size() > 0)
return nf;
Name name = nf.toName();
String orcid = getCurrentUserOrcid();
if (recordNameManager.exists(orcid)) {
recordNameManager.updateRecordName(orcid, name);
} else {
recordNameManager.createRecordName(orcid, name);
}
return nf;
}
use of org.orcid.jaxb.model.v3.dev1.common.Visibility in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV3Test method getFundings.
private Fundings getFundings(Visibility... vs) {
Fundings fundings = new Fundings();
for (Visibility v : vs) {
FundingGroup g = new FundingGroup();
FundingSummary s = new FundingSummary();
s.setVisibility(v);
g.getFundingSummary().add(s);
fundings.getFundingGroup().add(g);
}
return fundings;
}
use of org.orcid.jaxb.model.v3.dev1.common.Visibility in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV3Test method getPeerReviews.
private PeerReviews getPeerReviews(Visibility... vs) {
PeerReviews peerReviews = new PeerReviews();
for (Visibility v : vs) {
PeerReviewGroup g = new PeerReviewGroup();
PeerReviewSummary s = new PeerReviewSummary();
s.setVisibility(v);
g.getPeerReviewSummary().add(s);
peerReviews.getPeerReviewGroup().add(g);
}
return peerReviews;
}
use of org.orcid.jaxb.model.v3.dev1.common.Visibility in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV3Test method getWorks.
private Works getWorks(Visibility... vs) {
Works works = new Works();
for (Visibility v : vs) {
WorkGroup g = new WorkGroup();
WorkSummary s = new WorkSummary();
s.setVisibility(v);
g.getWorkSummary().add(s);
works.getWorkGroup().add(g);
}
return works;
}
Aggregations