use of org.akaza.openclinica.ws.validator.StudyMetadataRequestValidator in project OpenClinica by OpenClinica.
the class StudyEndpoint method getStudyMetadata.
/**
* if NAMESPACE_URI_V1:getStudyListRequest execute this method
*
* @return
* @throws Exception
*/
@PayloadRoot(localPart = "getMetadataRequest", namespace = NAMESPACE_URI_V1)
public Source getStudyMetadata(@XPathParam("//study:studyMetadata") NodeList studyNodeList) throws Exception {
ResourceBundleProvider.updateLocale(new Locale("en_US"));
Element studyRefElement = (Element) studyNodeList.item(0);
//StudyMetadataRequestBean studyMetadataRequestBean = unMarshallRequest(studyRefElement);
BaseStudyDefinitionBean studyMetadataRequestBean = unMarshallRequest(studyRefElement);
DataBinder dataBinder = new DataBinder((studyMetadataRequestBean));
Errors errors = dataBinder.getBindingResult();
StudyMetadataRequestValidator studyMetadataRequestValidator = new StudyMetadataRequestValidator(dataSource);
studyMetadataRequestValidator.validate((studyMetadataRequestBean), errors);
if (!errors.hasErrors()) {
return new DOMSource(mapSuccessConfirmation(getStudy(studyMetadataRequestBean), messages.getMessage("studyEndpoint.success", null, "Success", locale)));
} else {
return new DOMSource(mapConfirmation(messages.getMessage("studyEndpoint.fail", null, "Fail", locale), errors));
}
}
Aggregations