use of org.akaza.openclinica.control.form.Validator in project OpenClinica by OpenClinica.
the class UpdateStudyServlet method confirmStudy3.
/**
* Confirms the third input block of study info
*
* @throws Exception
*/
private void confirmStudy3(boolean isInterventional) throws Exception {
Validator v = new Validator(request);
FormProcessor fp = new FormProcessor(request);
v.addValidation("purpose", Validator.NO_BLANKS);
for (int i = 0; i < 10; i++) {
String type = fp.getString("interType" + i);
String name = fp.getString("interName" + i);
if (!StringUtil.isBlank(type) && StringUtil.isBlank(name)) {
v.addValidation("interName", Validator.NO_BLANKS);
request.setAttribute("interventionError", respage.getString("name_cannot_be_blank_if_type"));
break;
}
if (!StringUtil.isBlank(name) && StringUtil.isBlank(type)) {
v.addValidation("interType", Validator.NO_BLANKS);
request.setAttribute("interventionError", respage.getString("name_cannot_be_blank_if_name"));
break;
}
}
errors = v.validate();
updateStudy3(isInterventional);
if (errors.isEmpty()) {
logger.info("no errors");
request.setAttribute("interventions", session.getAttribute("interventions"));
forwardPage(Page.UPDATE_STUDY5);
} else {
logger.info("has validation errors");
request.setAttribute("formMessages", errors);
setMaps(isInterventional, (ArrayList) session.getAttribute("interventions"));
if (isInterventional) {
forwardPage(Page.UPDATE_STUDY3);
} else {
forwardPage(Page.UPDATE_STUDY4);
}
}
}
use of org.akaza.openclinica.control.form.Validator in project OpenClinica by OpenClinica.
the class UpdateStudyServlet method confirmStudy6.
private void confirmStudy6() throws Exception {
FormProcessor fp = new FormProcessor(request);
Validator v = new Validator(request);
v.addValidation("medlineIdentifier", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 255);
v.addValidation("url", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 255);
v.addValidation("urlDescription", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 255);
errors = v.validate();
StudyBean newStudy = (StudyBean) session.getAttribute("newStudy");
newStudy.setMedlineIdentifier(fp.getString("medlineIdentifier"));
newStudy.setResultsReference(fp.getBoolean("resultsReference"));
newStudy.setUrl(fp.getString("url"));
newStudy.setUrlDescription(fp.getString("urlDescription"));
session.setAttribute("newStudy", newStudy);
// request.setAttribute("interventions",session.getAttribute("interventions"));
if (errors.isEmpty()) {
forwardPage(Page.UPDATE_STUDY8);
} else {
request.setAttribute("formMessages", errors);
forwardPage(Page.UPDATE_STUDY7);
}
}
use of org.akaza.openclinica.control.form.Validator in project OpenClinica by OpenClinica.
the class UpdateStudyServlet method confirmWholeStudy.
private void confirmWholeStudy() throws Exception {
FormProcessor fp = new FormProcessor(request);
Validator v = new Validator(request);
errors = v.validate();
StudyBean newStudy = (StudyBean) session.getAttribute("newStudy");
newStudy.getStudyParameterConfig().setCollectDob(fp.getString("collectDob"));
newStudy.getStudyParameterConfig().setDiscrepancyManagement(fp.getString("discrepancyManagement"));
newStudy.getStudyParameterConfig().setGenderRequired(fp.getString("genderRequired"));
newStudy.getStudyParameterConfig().setInterviewerNameRequired(fp.getString("interviewerNameRequired"));
newStudy.getStudyParameterConfig().setInterviewerNameDefault(fp.getString("interviewerNameDefault"));
newStudy.getStudyParameterConfig().setInterviewDateEditable(fp.getString("interviewDateEditable"));
newStudy.getStudyParameterConfig().setInterviewDateRequired(fp.getString("interviewDateRequired"));
newStudy.getStudyParameterConfig().setInterviewerNameEditable(fp.getString("interviewerNameEditable"));
newStudy.getStudyParameterConfig().setInterviewDateDefault(fp.getString("interviewDateDefault"));
newStudy.getStudyParameterConfig().setSubjectIdGeneration(fp.getString("subjectIdGeneration"));
newStudy.getStudyParameterConfig().setSubjectPersonIdRequired(fp.getString("subjectPersonIdRequired"));
newStudy.getStudyParameterConfig().setSubjectIdPrefixSuffix(fp.getString("subjectIdPrefixSuffix"));
newStudy.getStudyParameterConfig().setPersonIdShownOnCRF(fp.getString("personIdShownOnCRF"));
session.setAttribute("newStudy", newStudy);
if (errors.isEmpty()) {
forwardPage(Page.STUDY_UPDATE_CONFIRM);
} else {
request.setAttribute("formMessages", errors);
forwardPage(Page.UPDATE_STUDY8);
}
}
Aggregations