use of org.akaza.openclinica.ws.bean.BaseStudyDefinitionBean in project OpenClinica by OpenClinica.
the class StudyEndpoint method unMarshallRequest.
//private StudyMetadataRequestBean unMarshallRequest(Element studyEventDefinitionListAll) {
private BaseStudyDefinitionBean unMarshallRequest(Element studyEventDefinitionListAll) {
Element studyIdentifierElement = DomUtils.getChildElementByTagName(studyEventDefinitionListAll, "identifier");
String studyIdentifier = studyIdentifierElement == null ? null : DomUtils.getTextValue(studyIdentifierElement).trim();
BaseStudyDefinitionBean studyMetadataRequest = new BaseStudyDefinitionBean(studyIdentifier, getUserAccount());
return studyMetadataRequest;
}
use of org.akaza.openclinica.ws.bean.BaseStudyDefinitionBean 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));
}
}
use of org.akaza.openclinica.ws.bean.BaseStudyDefinitionBean in project OpenClinica by OpenClinica.
the class StudyMetadataRequestValidator method validate.
public void validate(Object obj, Errors e) {
BaseStudyDefinitionBean studyMetadataRequest = (BaseStudyDefinitionBean) obj;
if (studyMetadataRequest.getStudyUniqueId() == null) {
//&& studyMetadataRequest.getSiteUniqueId() == null) {
e.reject("studyEventDefinitionRequestValidator.study_does_not_exist");
return;
}
StudyBean study = helper.verifyStudy(getStudyDAO(), studyMetadataRequest.getStudyUniqueId(), null, e);
if (study == null)
return;
int site_id = -1;
StudyBean site;
if (studyMetadataRequest.getSiteUniqueId() != null) {
site = helper.verifySite(getStudyDAO(), studyMetadataRequest.getStudyUniqueId(), studyMetadataRequest.getSiteUniqueId(), null, e);
if (site != null) {
site_id = site.getId();
}
}
helper.verifyUser(studyMetadataRequest.getUser(), getUserAccountDAO(), study.getId(), site_id, e);
//
// StudyUserRoleBean studySur = getUserAccountDAO().findRoleByUserNameAndStudyId(studyMetadataRequest.getUser().getName(), study.getId());
// if (studySur.getStatus() != Status.AVAILABLE) {
// e.reject("studyEventDefinitionRequestValidator.insufficient_permissions",
// "You do not have sufficient privileges to proceed with this operation.");
// return;
// }
// if (studyMetadataRequest.getStudyUniqueId() != null && studyMetadataRequest.getSiteUniqueId() == null) {
// StudyBean study = getStudyDAO().findByUniqueIdentifier(studyMetadataRequest.getStudyUniqueId());
// if (study == null) {
// e.reject("subjectTransferValidator.study_does_not_exist", new Object[] { studyMetadataRequest.getStudyUniqueId() }, "Study identifier you specified "
// + studyMetadataRequest.getStudyUniqueId() + " does not correspond to a valid study.");
// return;
// }
//
// StudyUserRoleBean studySur = getUserAccountDAO().findRoleByUserNameAndStudyId(studyMetadataRequest.getUser().getName(), study.getId());
// if (studySur.getStatus() != Status.AVAILABLE) {
// e.reject("studyEventDefinitionRequestValidator.insufficient_permissions",
// "You do not have sufficient privileges to proceed with this operation.");
// return;
// }
// }
// if (studyMetadataRequest.getStudyUniqueId() != null && studyMetadataRequest.getSiteUniqueId() != null) {
// StudyBean study = getStudyDAO().findByUniqueIdentifier(studyMetadataRequest.getStudyUniqueId());
// StudyBean site = getStudyDAO().findByUniqueIdentifier(studyMetadataRequest.getSiteUniqueId());
// if (study == null || site == null || site.getParentStudyId() != study.getId()) {
// e.reject("studyEventDefinitionRequestValidator.invalid_study_identifier_site_identifier");
// return;
// }
// StudyUserRoleBean siteSur = getUserAccountDAO().findRoleByUserNameAndStudyId(studyMetadataRequest.getUser().getName(), site.getId());
// if (siteSur.getStatus() != Status.AVAILABLE) {
// e.reject("studyEventDefinitionRequestValidator.insufficient_permissions",
// "You do not have sufficient privileges to proceed with this operation.");
// return;
// }
// }
}
Aggregations