use of org.akaza.openclinica.bean.service.StudyParameterValueBean in project OpenClinica by OpenClinica.
the class UpdateSubStudyServlet method submitStudy.
/**
* Inserts the new study into databa *
*
* @throws MalformedURLException
* *
*/
private void submitStudy() throws MalformedURLException {
StudyDAO sdao = new StudyDAO(sm.getDataSource());
StudyBean study = (StudyBean) session.getAttribute("newStudy");
ArrayList parameters = study.getStudyParameters();
/*
* logger.info("study bean to be updated:\n");
* logger.info(study.getName()+ "\n" + study.getCreatedDate() + "\n" +
* study.getIdentifier() + "\n" + study.getParentStudyId()+ "\n" +
* study.getSummary()+ "\n" + study.getPrincipalInvestigator()+ "\n" +
* study.getDatePlannedStart()+ "\n" + study.getDatePlannedEnd()+ "\n" +
* study.getFacilityName()+ "\n" + study.getFacilityCity()+ "\n" +
* study.getFacilityState()+ "\n" + study.getFacilityZip()+ "\n" +
* study.getFacilityCountry()+ "\n" +
* study.getFacilityRecruitmentStatus()+ "\n" +
* study.getFacilityContactName()+ "\n" +
* study.getFacilityContactEmail()+ "\n" +
* study.getFacilityContactPhone()+ "\n" +
* study.getFacilityContactDegree());
*/
// study.setCreatedDate(new Date());
study.setUpdatedDate(new Date());
study.setUpdater(ub);
sdao.update(study);
StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource());
for (int i = 0; i < parameters.size(); i++) {
StudyParamsConfig config = (StudyParamsConfig) parameters.get(i);
StudyParameterValueBean spv = config.getValue();
StudyParameterValueBean spv1 = spvdao.findByHandleAndStudy(spv.getStudyId(), spv.getParameter());
if (spv1.getId() > 0) {
spv = (StudyParameterValueBean) spvdao.update(spv);
} else {
spv = (StudyParameterValueBean) spvdao.create(spv);
}
// spv = (StudyParameterValueBean)spvdao.update(config.getValue());
}
submitSiteEventDefinitions(study);
// session.removeAttribute("newStudy");
// session.removeAttribute("parentName");
// session.removeAttribute("definitions");
// session.removeAttribute("sdvOptions");
addPageMessage(respage.getString("the_site_has_been_updated_succesfully"));
String fromListSite = (String) session.getAttribute("fromListSite");
if (fromListSite != null && fromListSite.equals("yes")) {
// session.removeAttribute("fromListSite");
forwardPage(Page.SITE_LIST_SERVLET);
} else {
// session.removeAttribute("fromListSite");
forwardPage(Page.STUDY_LIST_SERVLET);
}
}
use of org.akaza.openclinica.bean.service.StudyParameterValueBean in project OpenClinica by OpenClinica.
the class StudyConfigService method setParameterValuesForStudy.
public StudyBean setParameterValuesForStudy(StudyBean study) {
StudyParameterValueDAO spvdao = new StudyParameterValueDAO(ds);
ArrayList theParameters = spvdao.findParamConfigByStudy(study);
study.setStudyParameters(theParameters);
ArrayList parameters = spvdao.findAllParameterValuesByStudy(study);
for (int i = 0; i < parameters.size(); i++) {
StudyParameterValueBean spvb = (StudyParameterValueBean) parameters.get(i);
String parameter = spvb.getParameter();
if (parameter.equalsIgnoreCase("collectDob")) {
study.getStudyParameterConfig().setCollectDob(spvb.getValue());
} else if (parameter.equalsIgnoreCase("genderRequired")) {
study.getStudyParameterConfig().setGenderRequired(spvb.getValue());
} else if (parameter.equalsIgnoreCase("subjectPersonIdRequired")) {
study.getStudyParameterConfig().setSubjectPersonIdRequired(spvb.getValue());
} else if (parameter.equalsIgnoreCase("discrepancyManagement")) {
study.getStudyParameterConfig().setDiscrepancyManagement(spvb.getValue());
} else if (parameter.equalsIgnoreCase("subjectIdGeneration")) {
study.getStudyParameterConfig().setSubjectIdGeneration(spvb.getValue());
} else if (parameter.equalsIgnoreCase("subjectIdPrefixSuffix")) {
study.getStudyParameterConfig().setSubjectIdPrefixSuffix(spvb.getValue());
} else if (parameter.equalsIgnoreCase("interviewerNameRequired")) {
study.getStudyParameterConfig().setInterviewerNameRequired(spvb.getValue());
} else if (parameter.equalsIgnoreCase("interviewerNameDefault")) {
study.getStudyParameterConfig().setInterviewerNameDefault(spvb.getValue());
} else if (parameter.equalsIgnoreCase("interviewerNameEditable")) {
study.getStudyParameterConfig().setInterviewerNameEditable(spvb.getValue());
} else if (parameter.equalsIgnoreCase("interviewDateRequired")) {
study.getStudyParameterConfig().setInterviewDateRequired(spvb.getValue());
} else if (parameter.equalsIgnoreCase("interviewDateDefault")) {
study.getStudyParameterConfig().setInterviewDateDefault(spvb.getValue());
} else if (parameter.equalsIgnoreCase("interviewDateEditable")) {
study.getStudyParameterConfig().setInterviewDateEditable(spvb.getValue());
} else if (parameter.equalsIgnoreCase("personIdShownOnCRF")) {
study.getStudyParameterConfig().setPersonIdShownOnCRF(spvb.getValue());
} else if (parameter.equalsIgnoreCase("adminForcedReasonForChange")) {
study.getStudyParameterConfig().setAdminForcedReasonForChange(spvb.getValue());
}
}
return study;
}
use of org.akaza.openclinica.bean.service.StudyParameterValueBean in project OpenClinica by OpenClinica.
the class StudyParameterValueDAO method findParamConfigByStudy.
public ArrayList findParamConfigByStudy(StudyBean study) {
this.unsetTypeExpected();
this.setTypeExpected(1, TypeNames.INT);
this.setTypeExpected(2, TypeNames.INT);
this.setTypeExpected(3, TypeNames.STRING);
this.setTypeExpected(4, TypeNames.STRING);
this.setTypeExpected(5, TypeNames.INT);
this.setTypeExpected(6, TypeNames.STRING);
this.setTypeExpected(7, TypeNames.STRING);
this.setTypeExpected(8, TypeNames.STRING);
this.setTypeExpected(9, TypeNames.STRING);
this.setTypeExpected(10, TypeNames.BOOL);
this.setTypeExpected(11, TypeNames.BOOL);
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(study.getId()));
ArrayList alist = this.select(digester.getQuery("findParamConfigByStudy"), variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
HashMap hm = (HashMap) it.next();
StudyParameterValueBean spvb = new StudyParameterValueBean();
spvb.setValue((String) hm.get("value"));
spvb.setStudyId(((Integer) hm.get("study_id")).intValue());
spvb.setId(((Integer) hm.get("study_parameter_value_id")).intValue());
StudyParameter sp = new StudyParameter();
sp.setId(((Integer) hm.get("study_parameter_id")).intValue());
sp.setHandle((String) hm.get("handle"));
sp.setName((String) hm.get("name"));
sp.setDescription((String) hm.get("description"));
sp.setDefaultValue((String) hm.get("default_value"));
sp.setInheritable(((Boolean) hm.get("inheritable")).booleanValue());
sp.setOverridable(((Boolean) hm.get("overridable")).booleanValue());
StudyParamsConfig config = new StudyParamsConfig();
config.setParameter(sp);
config.setValue(spvb);
al.add(config);
}
return al;
}
use of org.akaza.openclinica.bean.service.StudyParameterValueBean in project OpenClinica by OpenClinica.
the class StudyParameterValueDAO method findAllParameterValuesByStudy.
public ArrayList findAllParameterValuesByStudy(StudyBean study) {
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(study.getId()));
ArrayList alist = this.select(digester.getQuery("findAllParameterValuesByStudy"), variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
StudyParameterValueBean eb = (StudyParameterValueBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.service.StudyParameterValueBean in project OpenClinica by OpenClinica.
the class StudyParameterValueDAO method findByHandleAndStudy.
public StudyParameterValueBean findByHandleAndStudy(int studyId, String handle) {
StudyParameterValueBean spvb = new StudyParameterValueBean();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(studyId));
variables.put(new Integer(2), handle);
String sql = digester.getQuery("findByStudyAndHandle");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
spvb = (StudyParameterValueBean) this.getEntityFromHashMap((HashMap) it.next());
}
return spvb;
}
Aggregations