Search in sources :

Example 1 with InterventionBean

use of org.akaza.openclinica.bean.managestudy.InterventionBean in project OpenClinica by OpenClinica.

the class UpdateStudyServletNew method updateStudy3.

private void updateStudy3(boolean isInterventional, FormProcessor fp) {
    study.setPurpose(fp.getString("purpose"));
    ArrayList interventionArray = new ArrayList();
    if (isInterventional) {
        study.setAllocation(fp.getString("allocation"));
        study.setMasking(fp.getString("masking"));
        study.setControl(fp.getString("control"));
        study.setAssignment(fp.getString("assignment"));
        study.setEndpoint(fp.getString("endpoint"));
        StringBuffer interventions = new StringBuffer();
        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)) {
                InterventionBean ib = new InterventionBean(fp.getString("interType" + i), fp.getString("interName" + i));
                interventionArray.add(ib);
                interventions.append(ib.toString()).append(",");
            }
        }
        study.setInterventions(interventions.toString());
    } else {
        // type = observational
        study.setDuration(fp.getString("duration"));
        study.setSelection(fp.getString("selection"));
        study.setTiming(fp.getString("timing"));
    }
    request.setAttribute("interventions", interventionArray);
}
Also used : InterventionBean(org.akaza.openclinica.bean.managestudy.InterventionBean) ArrayList(java.util.ArrayList)

Example 2 with InterventionBean

use of org.akaza.openclinica.bean.managestudy.InterventionBean in project OpenClinica by OpenClinica.

the class CreateStudyServlet method updateStudy3.

/**
     * Updates the study bean with inputs from the third section
     *
     * @param isInterventional
     *            if the study type is internventional
     */
private void updateStudy3(boolean isInterventional) {
    FormProcessor fp = new FormProcessor(request);
    StudyBean newStudy = (StudyBean) session.getAttribute("newStudy");
    newStudy.setPurpose(fp.getString("purpose"));
    if (isInterventional) {
        newStudy.setAllocation(fp.getString("allocation"));
        newStudy.setMasking(fp.getString("masking"));
        newStudy.setControl(fp.getString("control"));
        newStudy.setAssignment(fp.getString("assignment"));
        newStudy.setEndpoint(fp.getString("endpoint"));
        // Handle Interventions-type and name
        // repeat 10 times for each pair on the web page
        StringBuffer interventions = new StringBuffer();
        ArrayList interventionArray = new ArrayList();
        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)) {
                InterventionBean ib = new InterventionBean(fp.getString("interType" + i), fp.getString("interName" + i));
                interventionArray.add(ib);
                interventions.append(ib.toString()).append(",");
            }
        }
        newStudy.setInterventions(interventions.toString());
        session.setAttribute("interventionArray", interventionArray);
    } else {
        // type = observational
        newStudy.setDuration(fp.getString("duration"));
        newStudy.setSelection(fp.getString("selection"));
        newStudy.setTiming(fp.getString("timing"));
    }
    session.setAttribute("newStudy", newStudy);
}
Also used : InterventionBean(org.akaza.openclinica.bean.managestudy.InterventionBean) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList)

Example 3 with InterventionBean

use of org.akaza.openclinica.bean.managestudy.InterventionBean in project OpenClinica by OpenClinica.

the class UpdateStudyServlet method updateStudy3.

private void updateStudy3(boolean isInterventional) {
    FormProcessor fp = new FormProcessor(request);
    StudyBean study = (StudyBean) session.getAttribute("newStudy");
    study.setPurpose(fp.getString("purpose"));
    ArrayList interventionArray = new ArrayList();
    if (isInterventional) {
        study.setAllocation(fp.getString("allocation"));
        study.setMasking(fp.getString("masking"));
        study.setControl(fp.getString("control"));
        study.setAssignment(fp.getString("assignment"));
        study.setEndpoint(fp.getString("endpoint"));
        // Handle Interventions-type and name
        // repeat 10 times for each pair on the web page
        StringBuffer interventions = new StringBuffer();
        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)) {
                InterventionBean ib = new InterventionBean(fp.getString("interType" + i), fp.getString("interName" + i));
                interventionArray.add(ib);
                interventions.append(ib.toString()).append(",");
            }
        }
        study.setInterventions(interventions.toString());
    } else {
        // type = observational
        study.setDuration(fp.getString("duration"));
        study.setSelection(fp.getString("selection"));
        study.setTiming(fp.getString("timing"));
    }
    session.setAttribute("newStudy", study);
    session.setAttribute("interventions", interventionArray);
}
Also used : InterventionBean(org.akaza.openclinica.bean.managestudy.InterventionBean) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList)

Example 4 with InterventionBean

use of org.akaza.openclinica.bean.managestudy.InterventionBean in project OpenClinica by OpenClinica.

the class UpdateStudyServletNew method parseInterventions.

private ArrayList parseInterventions(StudyBean sb) {
    ArrayList inters = new ArrayList();
    String interventions = sb.getInterventions();
    try {
        if (!StringUtil.isBlank(interventions)) {
            StringTokenizer st = new StringTokenizer(interventions, ",");
            while (st.hasMoreTokens()) {
                String s = st.nextToken();
                StringTokenizer st1 = new StringTokenizer(s, "/");
                String type = st1.nextToken();
                String name = st1.nextToken();
                InterventionBean ib = new InterventionBean(type, name);
                inters.add(ib);
            }
        }
    } catch (NoSuchElementException nse) {
        return new ArrayList();
    }
    return inters;
}
Also used : InterventionBean(org.akaza.openclinica.bean.managestudy.InterventionBean) StringTokenizer(java.util.StringTokenizer) ArrayList(java.util.ArrayList) NoSuchElementException(java.util.NoSuchElementException)

Example 5 with InterventionBean

use of org.akaza.openclinica.bean.managestudy.InterventionBean in project OpenClinica by OpenClinica.

the class UpdateStudyServlet method parseInterventions.

/**
     * Parses the intetventions of a study and divides it into different type
     * and name pairs type and name are separated by '/', and interventions are
     * separated by ',' examples: type1/name1,type2/name2,type3/name3,
     * 
     * @param sb
     * @return
     */
private ArrayList parseInterventions(StudyBean sb) {
    ArrayList inters = new ArrayList();
    String interventions = sb.getInterventions();
    try {
        if (!StringUtil.isBlank(interventions)) {
            StringTokenizer st = new StringTokenizer(interventions, ",");
            while (st.hasMoreTokens()) {
                String s = st.nextToken();
                StringTokenizer st1 = new StringTokenizer(s, "/");
                String type = st1.nextToken();
                String name = st1.nextToken();
                InterventionBean ib = new InterventionBean(type, name);
                inters.add(ib);
            }
        }
    } catch (NoSuchElementException nse) {
        return new ArrayList();
    }
    return inters;
}
Also used : InterventionBean(org.akaza.openclinica.bean.managestudy.InterventionBean) StringTokenizer(java.util.StringTokenizer) ArrayList(java.util.ArrayList) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

ArrayList (java.util.ArrayList)5 InterventionBean (org.akaza.openclinica.bean.managestudy.InterventionBean)5 NoSuchElementException (java.util.NoSuchElementException)2 StringTokenizer (java.util.StringTokenizer)2 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)2 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)2