Search in sources :

Example 1 with StudyMetadataRequestValidator

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));
    }
}
Also used : Locale(java.util.Locale) Errors(org.springframework.validation.Errors) DOMSource(javax.xml.transform.dom.DOMSource) BaseStudyDefinitionBean(org.akaza.openclinica.ws.bean.BaseStudyDefinitionBean) Element(org.w3c.dom.Element) StudyMetadataRequestValidator(org.akaza.openclinica.ws.validator.StudyMetadataRequestValidator) DataBinder(org.springframework.validation.DataBinder) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Aggregations

Locale (java.util.Locale)1 DOMSource (javax.xml.transform.dom.DOMSource)1 BaseStudyDefinitionBean (org.akaza.openclinica.ws.bean.BaseStudyDefinitionBean)1 StudyMetadataRequestValidator (org.akaza.openclinica.ws.validator.StudyMetadataRequestValidator)1 DataBinder (org.springframework.validation.DataBinder)1 Errors (org.springframework.validation.Errors)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 Element (org.w3c.dom.Element)1