Search in sources :

Example 1 with StudyEventDefinitionRequestValidator

use of org.akaza.openclinica.ws.validator.StudyEventDefinitionRequestValidator in project OpenClinica by OpenClinica.

the class StudyEventDefinitionEndpoint method getStudyList.

/**
     * if NAMESPACE_URI_V1:getStudyListRequest execute this method
     * 
     * @return
     * @throws Exception
     */
@PayloadRoot(localPart = "listAllRequest", namespace = NAMESPACE_URI_V1)
public Source getStudyList(@XPathParam("//sed:studyEventDefinitionListAll") NodeList studyNodeList) throws Exception {
    ResourceBundleProvider.updateLocale(new Locale("en_US"));
    Element studyRefElement = (Element) studyNodeList.item(0);
    // StudyEventDefinitionRequestBean studyEventDefinitionRequestBean = unMarshallRequest(studyRefElement);
    BaseStudyDefinitionBean studyEventDefinitionRequestBean = unMarshallRequest(studyRefElement);
    DataBinder dataBinder = new DataBinder((studyEventDefinitionRequestBean));
    Errors errors = dataBinder.getBindingResult();
    StudyEventDefinitionRequestValidator studyEventDefinitionRequestValidator = new StudyEventDefinitionRequestValidator(dataSource);
    studyEventDefinitionRequestValidator.validate((studyEventDefinitionRequestBean), errors);
    if (!errors.hasErrors()) {
        return new DOMSource(mapConfirmation(getStudy(studyEventDefinitionRequestBean), messages.getMessage("studyEventDefinitionEndpoint.success", null, "Success", locale)));
    } else {
        return new DOMSource(mapFailConfirmation(messages.getMessage("studyEventDefinitionEndpoint.fail", null, "Fail", locale), errors));
    }
}
Also used : Locale(java.util.Locale) Errors(org.springframework.validation.Errors) StudyEventDefinitionRequestValidator(org.akaza.openclinica.ws.validator.StudyEventDefinitionRequestValidator) DOMSource(javax.xml.transform.dom.DOMSource) BaseStudyDefinitionBean(org.akaza.openclinica.ws.bean.BaseStudyDefinitionBean) Element(org.w3c.dom.Element) 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 StudyEventDefinitionRequestValidator (org.akaza.openclinica.ws.validator.StudyEventDefinitionRequestValidator)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