Search in sources :

Example 1 with StudyParameterValueBean

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);
    }
}
Also used : StudyParamsConfig(org.akaza.openclinica.bean.service.StudyParamsConfig) StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) Date(java.util.Date)

Example 2 with StudyParameterValueBean

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;
}
Also used : StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) ArrayList(java.util.ArrayList)

Example 3 with StudyParameterValueBean

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;
}
Also used : StudyParamsConfig(org.akaza.openclinica.bean.service.StudyParamsConfig) StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) HashMap(java.util.HashMap) StudyParameter(org.akaza.openclinica.bean.service.StudyParameter) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 4 with StudyParameterValueBean

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;
}
Also used : StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 5 with StudyParameterValueBean

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;
}
Also used : StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Aggregations

StudyParameterValueBean (org.akaza.openclinica.bean.service.StudyParameterValueBean)46 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)31 StudyParameterValueDAO (org.akaza.openclinica.dao.service.StudyParameterValueDAO)27 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)18 ArrayList (java.util.ArrayList)16 Date (java.util.Date)9 HashMap (java.util.HashMap)9 ParticipantPortalRegistrar (org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar)9 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)6 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 Iterator (java.util.Iterator)5 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)4 StudyParamsConfig (org.akaza.openclinica.bean.service.StudyParamsConfig)4 ParseException (java.text.ParseException)3 SimpleDateFormat (java.text.SimpleDateFormat)3 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)3 StudyParameter (org.akaza.openclinica.bean.service.StudyParameter)3 RandomizationRegistrar (org.akaza.openclinica.service.pmanage.RandomizationRegistrar)3 IOException (java.io.IOException)2