Search in sources :

Example 11 with FilterBean

use of org.akaza.openclinica.bean.extract.FilterBean in project OpenClinica by OpenClinica.

the class CreateFiltersTwoServlet method processRequest.

// < ResourceBundle restext,resword,respage,resexception;
@Override
public void processRequest() throws Exception {
    // we can't get to here without an action:
    // begin--takes us to specify parameters,
    // where the user will select CRF, then section,
    // then parameters of the section: a little tricky
    // to do entirely with javascript, but can be done.
    // possible to set up the CRF-section relationship,
    // and then have a screen 3.5 with the parameters?
    // criteria--takes us to specify criteria, that is,
    // to specify and, or, not and, etc. here we'll take the
    // list we just generated online and generate a chain
    // of filterobjectbeans, which will in turn,
    // generate the SQL add on for the dataset.
    String action = request.getParameter("action");
    StudyBean studyWithEventDefs = currentStudy;
    if (currentStudy.getParentStudyId() > 0) {
        studyWithEventDefs = new StudyBean();
        studyWithEventDefs.setId(currentStudy.getParentStudyId());
    }
    if (StringUtil.isBlank(action)) {
    // throw an error
    } else if ("begin".equalsIgnoreCase(action)) {
        StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
        HashMap events = sedao.findCRFsByStudy(studyWithEventDefs);
        // if events are empty -- resend to first filter page with message
        if (events.isEmpty()) {
            addPageMessage(respage.getString("no_CRF_assigned_pick_another"));
            FormProcessor fp = new FormProcessor(request);
            FilterDAO fdao = new FilterDAO(sm.getDataSource());
            EntityBeanTable table = fp.getEntityBeanTable();
            ArrayList filters = (ArrayList) fdao.findAll();
            ArrayList filterRows = FilterRow.generateRowsFromBeans(filters);
            String[] columns = { resword.getString("filter_name"), resword.getString("description"), resword.getString("created_by"), resword.getString("created_date"), resword.getString("status"), resword.getString("actions") };
            table.setColumns(new ArrayList(Arrays.asList(columns)));
            table.hideColumnLink(5);
            table.addLink(resword.getString("create_new_filter"), "CreateFiltersOne?action=begin");
            table.setQuery("CreateFiltersOne", new HashMap());
            table.setRows(filterRows);
            table.computeDisplay();
            request.setAttribute("table", table);
            forwardPage(Page.CREATE_FILTER_SCREEN_1);
        } else {
            // else, send to the following page:
            request.setAttribute("events", events);
            forwardPage(Page.CREATE_FILTER_SCREEN_3);
        }
    } else if ("crfselected".equalsIgnoreCase(action)) {
        // get the crf id, return to a new page with sections
        // and parameters attached, tbh
        FormProcessor fp = new FormProcessor(request);
        HashMap errors = new HashMap();
        int crfId = fp.getInt("crfId");
        if (crfId > 0) {
            CRFVersionDAO cvDAO = new CRFVersionDAO(sm.getDataSource());
            CRFDAO cDAO = new CRFDAO(sm.getDataSource());
            SectionDAO secDAO = new SectionDAO(sm.getDataSource());
            Collection sections = secDAO.findByVersionId(crfId);
            CRFVersionBean cvBean = (CRFVersionBean) cvDAO.findByPK(crfId);
            CRFBean cBean = (CRFBean) cDAO.findByPK(cvBean.getCrfId());
            request.setAttribute("sections", sections);
            session.setAttribute("cBean", cBean);
            // for further pages,
            session.setAttribute("cvBean", cvBean);
            // tbh
            forwardPage(Page.CREATE_FILTER_SCREEN_3_1);
        } else {
            addPageMessage(respage.getString("select_a_CRF_before_picking"));
            StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
            HashMap events = sedao.findCRFsByStudy(studyWithEventDefs);
            request.setAttribute("events", events);
            forwardPage(Page.CREATE_FILTER_SCREEN_3);
        }
    } else if ("sectionselected".equalsIgnoreCase(action)) {
        // TODO set the crf and the section into session,
        // allow for the user to go back and forth,
        // set up the questions to be picked,
        // allow the user to move on to create_filter_screen_4
        FormProcessor fp = new FormProcessor(request);
        int sectionId = fp.getInt("sectionId");
        if (sectionId > 0) {
            SectionDAO secDAO = new SectionDAO(sm.getDataSource());
            SectionBean secBean = (SectionBean) secDAO.findByPK(sectionId);
            session.setAttribute("secBean", secBean);
            ItemFormMetadataDAO ifmDAO = new ItemFormMetadataDAO(sm.getDataSource());
            Collection metadatas = ifmDAO.findAllBySectionId(sectionId);
            if (metadatas.size() > 0) {
                request.setAttribute("metadatas", metadatas);
                forwardPage(Page.CREATE_FILTER_SCREEN_3_2);
            } else {
                CRFVersionBean cvBean = (CRFVersionBean) session.getAttribute("cvBean");
                addPageMessage(respage.getString("section_not_have_questions_select_another"));
                // SectionDAO secDAO = new SectionDAO(sm.getDataSource());
                Collection sections = secDAO.findByVersionId(cvBean.getId());
                request.setAttribute("sections", sections);
                forwardPage(Page.CREATE_FILTER_SCREEN_3_1);
            }
        } else {
            CRFVersionBean cvBean = (CRFVersionBean) session.getAttribute("cvBean");
            addPageMessage(respage.getString("select_section_before_select_question"));
            SectionDAO secDAO = new SectionDAO(sm.getDataSource());
            Collection sections = secDAO.findByVersionId(cvBean.getId());
            request.setAttribute("sections", sections);
            forwardPage(Page.CREATE_FILTER_SCREEN_3_1);
        }
    } else if ("questionsselected".equalsIgnoreCase(action)) {
        ArrayList alist = this.extractIdsFromForm();
        // and send the user to create_filter_screen_4
        if (alist.size() > 0) {
            ItemFormMetadataDAO ifmDAO = new ItemFormMetadataDAO(sm.getDataSource());
            Collection questions = ifmDAO.findByMultiplePKs(alist);
            session.setAttribute("questions", questions);
            forwardPage(Page.CREATE_FILTER_SCREEN_4);
        } else {
            SectionBean secBean = (SectionBean) session.getAttribute("secBean");
            addPageMessage(respage.getString("select_questions_before_set_parameters"));
            ItemFormMetadataDAO ifmDAO = new ItemFormMetadataDAO(sm.getDataSource());
            Collection metadatas = ifmDAO.findAllBySectionId(secBean.getId());
            request.setAttribute("metadatas", metadatas);
            forwardPage(Page.CREATE_FILTER_SCREEN_3_2);
        }
    } else if ("validatecriteria".equalsIgnoreCase(action)) {
        // TODO look at the criteria and create a list of filterobjectdata
        // beans, so that we can create the SQL later on in
        // the process.
        // also, throw the user back to the process or throw
        // them forward into the createServletThree process
        FormProcessor fp = new FormProcessor(request);
        String logical = fp.getString("logical");
        ArrayList questions = (ArrayList) session.getAttribute("questions");
        ArrayList filterobjects = new ArrayList();
        // (ArrayList)session.getAttribute("filterobjects");
        Iterator q_it = questions.iterator();
        int arrCnt = 0;
        while (q_it.hasNext()) {
            ItemFormMetadataBean ifmBean = (ItemFormMetadataBean) q_it.next();
            String opString = "operator:" + ifmBean.getId();
            String valString = "value:" + ifmBean.getId();
            String remString = "remove:" + ifmBean.getId();
            if ("remove".equals(fp.getString(remString))) {
                logger.info("found the string: " + remString);
                // TODO remove the question from from the list,
                // redirect to that page again????? <--maybe not?
                // questions.remove(arrCnt);
                // shouldn't have to remove the above, just do nothing
                arrCnt++;
            } else {
                String operator = fp.getString(opString);
                String value = fp.getString(valString);
                FilterObjectBean fob = new FilterObjectBean();
                fob.setItemId(ifmBean.getId());
                fob.setItemName(ifmBean.getHeader() + " " + ifmBean.getLeftItemText() + " " + ifmBean.getRightItemText());
                // case operator:
                if ("equal to".equalsIgnoreCase(operator)) {
                    fob.setOperand("=");
                } else if ("greater than".equalsIgnoreCase(operator)) {
                    fob.setOperand(">");
                } else if ("less than".equalsIgnoreCase(operator)) {
                    fob.setOperand("<");
                } else if ("greater than or equal".equalsIgnoreCase(operator)) {
                    fob.setOperand(">=");
                } else if ("less than or equal".equalsIgnoreCase(operator)) {
                    fob.setOperand("<=");
                } else if ("like".equalsIgnoreCase(operator)) {
                    fob.setOperand(" like ");
                } else if ("not like".equalsIgnoreCase(operator)) {
                    fob.setOperand(" not like ");
                } else {
                    fob.setOperand("!=");
                }
                fob.setValue(value);
                filterobjects.add(fob);
            }
        // end else
        // 
        }
        // end while
        session.setAttribute("questions", questions);
        // TODO where does the connector come into play?
        // session.setAttribute("filterobjects",filterobjects);
        FilterDAO fDAO = new FilterDAO(sm.getDataSource());
        String newSQL = (String) session.getAttribute("newSQL");
        ArrayList newExp = (ArrayList) session.getAttribute("newExp");
        // human readable explanation
        String newNewSQL = fDAO.genSQLStatement(newSQL, logical, filterobjects);
        ArrayList newNewExp = fDAO.genExplanation(newExp, logical, filterobjects);
        if (arrCnt == questions.size()) {
            newNewSQL = newSQL;
            newNewExp = newExp;
        // don't change anything, if we've removed everything from this
        // list
        }
        logger.info("new SQL Generated: " + newNewSQL);
        String sub = fp.getString("submit");
        if ("Specify Filter Metadata".equals(sub)) {
            // add new params, create the filter object,
            // and go to create metadata
            FilterBean fb = new FilterBean();
            fb.setSQLStatement(newNewSQL + ")");
            // adding parens here to finish off other
            // statement--might add first part of statement here
            // for legibility's sake
            // tbh 06-02-2005
            session.removeAttribute("newSQL");
            // end of the road
            session.setAttribute("newFilter", fb);
            request.setAttribute("statuses", getStatuses());
            forwardPage(Page.CREATE_FILTER_SCREEN_5);
        } else {
            // replace the 'old' sql with the new sql gathered from the
            // session
            session.setAttribute("newSQL", newNewSQL);
            session.setAttribute("newExp", newNewExp);
            // add new params, and go back
            StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
            HashMap events = sedao.findCRFsByStudy(currentStudy);
            // 
            request.setAttribute("events", events);
            forwardPage(Page.CREATE_FILTER_SCREEN_3);
        }
    }
}
Also used : CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) HashMap(java.util.HashMap) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) EntityBeanTable(org.akaza.openclinica.web.bean.EntityBeanTable) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) SectionBean(org.akaza.openclinica.bean.submit.SectionBean) FilterDAO(org.akaza.openclinica.dao.extract.FilterDAO) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) Iterator(java.util.Iterator) FilterObjectBean(org.akaza.openclinica.bean.extract.FilterObjectBean) Collection(java.util.Collection) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) ItemFormMetadataDAO(org.akaza.openclinica.dao.submit.ItemFormMetadataDAO) ItemFormMetadataBean(org.akaza.openclinica.bean.submit.ItemFormMetadataBean) SectionDAO(org.akaza.openclinica.dao.submit.SectionDAO) FilterBean(org.akaza.openclinica.bean.extract.FilterBean)

Example 12 with FilterBean

use of org.akaza.openclinica.bean.extract.FilterBean in project OpenClinica by OpenClinica.

the class FilterRow method compareColumn.

@Override
protected int compareColumn(Object row, int sortingColumn) {
    if (!row.getClass().equals(FilterRow.class)) {
        return 0;
    }
    FilterBean thisAccount = (FilterBean) bean;
    FilterBean argAccount = (FilterBean) ((FilterRow) row).bean;
    int answer = 0;
    switch(sortingColumn) {
        case COL_FILTERNAME:
            answer = thisAccount.getName().toLowerCase().compareTo(argAccount.getName().toLowerCase());
            break;
        case COL_FILTERDESC:
            answer = thisAccount.getDescription().toLowerCase().compareTo(argAccount.getDescription().toLowerCase());
            break;
        case COL_FILTEROWNER:
            answer = thisAccount.getOwner().getName().toLowerCase().compareTo(argAccount.getOwner().getName().toLowerCase());
            break;
        case COL_STATUS:
            answer = thisAccount.getStatus().compareTo(argAccount.getStatus());
            break;
        case COL_FILTERCREATEDDATE:
            answer = thisAccount.getCreatedDate().compareTo(argAccount.getCreatedDate());
            break;
    }
    return answer;
}
Also used : FilterBean(org.akaza.openclinica.bean.extract.FilterBean)

Example 13 with FilterBean

use of org.akaza.openclinica.bean.extract.FilterBean in project OpenClinica by OpenClinica.

the class FilterTable method showRow.

@Override
public String showRow(EntityBean e) {
    FilterBean fb = (FilterBean) e;
    Status s = fb.getStatus();
    // do the first row, just the "flat" properties
    String row = "<tr>\n";
    // filter name
    String colorOn = s.equals(Status.AVAILABLE) ? "" : "<font color='gray'>";
    String colorOff = s.equals(Status.AVAILABLE) ? "" : "</font>";
    row += "<td>" + colorOn + fb.getName() + colorOff + "</td>\n";
    row += "<td>" + fb.getDescription() + "</td>\n";
    row += "<td>" + fb.getOwner().getName() + "</td>\n";
    // created date
    row += "<td>" + fb.getCreatedDate().toString() + "</td>\n";
    // status
    row += "<td>" + s.getName() + "</td>\n";
    // actions
    row += "<td>";
    if (!s.equals(Status.DELETED) && !s.equals(Status.AUTO_DELETED)) {
        String confirmQuestion = "Are you sure you want to delete " + fb.getName() + "?";
        String onClick = "onClick=\"return confirm('" + confirmQuestion + "');\"";
        row += "<a href='" + ApplyFilterServlet.getLink(fb.getId()) + "'>view</a>";
        row += " <a href='" + EditFilterServlet.getLink(fb.getId()) + "'>edit</a>";
        row += " <a href='" + RemoveFilterServlet.getLink(fb.getId()) + "'" + onClick + ">delete</a>";
    } else {
    // write the servlet to restore filters later, tbh 01-23-2005
    /*
             * String confirmQuestion = "Are you sure you want to restore " +
             * u.getName() + "?"; String onClick = "onClick=\"return confirm('" +
             * confirmQuestion + "');\""; row += " <a href='" +
             * DeleteUserServlet.getLink(u, EntityAction.RESTORE) + "'" +
             * onClick + ">restore</a>";
             */
    }
    row += "</td>\n";
    row += "</tr>\n";
    row += "<tr>\n";
    row += "</tr>\n";
    return row;
}
Also used : Status(org.akaza.openclinica.bean.core.Status) FilterBean(org.akaza.openclinica.bean.extract.FilterBean)

Example 14 with FilterBean

use of org.akaza.openclinica.bean.extract.FilterBean in project OpenClinica by OpenClinica.

the class StudyInfoPanel method setData.

/**
 * setData, the external function which creates data for the panel to
 * reflect.
 *
 * @param page
 * @param session
 * @param request
 */
public void setData(Page page, HttpSession session, HttpServletRequest request) {
    Locale locale = request.getLocale();
    resword = ResourceBundleProvider.getWordsBundle();
    local_sdf = new SimpleDateFormat(ResourceBundleProvider.getFormatBundle(locale).getString("date_format_string"));
    try {
        // defaults, can be reset by mistake by running through one page,
        // tbh
        this.setStudyInfoShown(true);
        this.setOrderedData(false);
        // try to avoid errors, tbh
        if (page.equals(Page.CREATE_DATASET_1)) {
            this.reset();
        // this.setData("Number of Steps", "5");
        } else if (page.equals(Page.CREATE_DATASET_2) || page.equals(Page.CREATE_DATASET_EVENT_ATTR) || page.equals(Page.CREATE_DATASET_SUB_ATTR) || page.equals(Page.CREATE_DATASET_CRF_ATTR) || page.equals(Page.CREATE_DATASET_GROUP_ATTR) || page.equals(Page.CREATE_DATASET_VIEW_SELECTED)) {
            HashMap eventlist = (HashMap) request.getAttribute("eventlist");
            ArrayList displayData = generateEventTree(eventlist);
            this.reset();
            this.setUserOrderedData(displayData);
            this.setStudyInfoShown(false);
            this.setOrderedData(true);
            this.setCreateDataset(true);
            this.setSubmitDataModule(false);
            this.setExtractData(false);
        } else if (page.equals(Page.CREATE_DATASET_3)) {
            this.reset();
            this.setStudyInfoShown(false);
            this.setOrderedData(false);
            this.setCreateDataset(true);
            this.setSubmitDataModule(false);
            this.setExtractData(false);
            DatasetBean dsb = (DatasetBean) session.getAttribute("newDataset");
            int ev_count = dsb.getItemIds().size();
            this.setData(resword.getString("items_selected"), new Integer(ev_count).toString());
        } else if (page.equals(Page.CREATE_DATASET_4)) {
            this.reset();
            this.setStudyInfoShown(false);
            this.setOrderedData(false);
            this.setCreateDataset(true);
            this.setSubmitDataModule(false);
            this.setExtractData(false);
            this.removeData(resword.getString("beginning_date"));
            this.removeData(resword.getString("ending_date"));
            DatasetBean dsb = (DatasetBean) session.getAttribute("newDataset");
            int ev_count = dsb.getItemIds().size();
            this.setData(resword.getString("items_selected"), new Integer(ev_count).toString());
            if ("01/01/1900".equals(english_sdf.format(dsb.getDateStart()))) {
                this.setData(resword.getString("beginning_date"), resword.getString("not_specified"));
            } else {
                this.setData(resword.getString("beginning_date"), local_sdf.format(dsb.getDateStart()));
            }
            if ("12/31/2100".equals(english_sdf.format(dsb.getDateEnd()))) {
                this.setData(resword.getString("ending_date"), resword.getString("not_specified"));
            } else {
                this.setData(resword.getString("ending_date"), local_sdf.format(dsb.getDateEnd()));
            }
            FilterBean fb = (FilterBean) session.getAttribute("newFilter");
            if (fb != null) {
                this.setData("Added Filter", fb.getName());
            }
        } else if (page.equals(Page.APPLY_FILTER)) {
            DatasetBean dsb = (DatasetBean) session.getAttribute("newDataset");
            this.setData(resword.getString("beginning_date"), local_sdf.format(dsb.getDateStart()));
            this.setData(resword.getString("ending_date"), local_sdf.format(dsb.getDateEnd()));
        } else if (page.equals(Page.CONFIRM_DATASET)) {
            this.reset();
            this.setStudyInfoShown(false);
            this.setOrderedData(false);
            this.setCreateDataset(true);
            this.setSubmitDataModule(false);
            this.setExtractData(false);
            DatasetBean dsb = (DatasetBean) session.getAttribute("newDataset");
            this.setData(resword.getString("dataset_name"), dsb.getName());
            this.setData(resword.getString("dataset_description"), dsb.getDescription());
            int ev_count = dsb.getItemIds().size();
            this.setData(resword.getString("items_selected"), new Integer(ev_count).toString());
            if ("01/01/1900".equals(english_sdf.format(dsb.getDateStart()))) {
                this.setData(resword.getString("beginning_date"), resword.getString("not_specified"));
            } else {
                this.setData(resword.getString("beginning_date"), local_sdf.format(dsb.getDateStart()));
            }
            if ("12/31/2100".equals(english_sdf.format(dsb.getDateEnd()))) {
                this.setData(resword.getString("ending_date"), resword.getString("not_specified"));
            } else {
                this.setData(resword.getString("ending_date"), local_sdf.format(dsb.getDateEnd()));
            }
            FilterBean fb = (FilterBean) session.getAttribute("newFilter");
            if (fb != null) {
                this.setData(resword.getString("added_filter"), fb.getName());
            }
        } else if (page.equals(Page.CREATE_FILTER_SCREEN_3_1)) {
            CRFVersionBean cvBean = (CRFVersionBean) session.getAttribute("cvBean");
            this.setData(resword.getString("CRF_version_selected"), cvBean.getName());
        } else if (page.equals(Page.CREATE_FILTER_SCREEN_3_2)) {
            SectionBean secBean = (SectionBean) session.getAttribute("secBean");
            this.setData(resword.getString("section_selected"), secBean.getName());
            Collection metadatas = (Collection) request.getAttribute("metadatas");
            this.setData(resword.getString("number_of_questions"), new Integer(metadatas.size()).toString());
        } else if (page.equals(Page.CREATE_FILTER_SCREEN_4)) {
        } else if (page.equals(Page.CREATE_FILTER_SCREEN_5)) {
        // blank here to prevent data reset, tbh
        } else if (page.equals(Page.ADMIN_SYSTEM)) {
        // blank here , info set in servlet itself
        } else if (page.equals(Page.VIEW_STUDY_SUBJECT) || page.equals(Page.LIST_EVENTS_FOR_SUBJECT)) {
            // special case, unlocks study name, subject name, and
            // visits
            // TODO set all this up, tbh
            /*
                 * set up the side info panel to create the following upon entry
                 * from the ViewStudyServlet Study X Subject Y StudyEventDef Z1
                 * StudyEventDef Z2 <status-tag> CRF A1 <status-tag> CRF A2 Z1
                 * should be collapsible/expandible, etc.
                 *
                 * We can pull things from the session and the request:
                 */
            /*
                 * StudyBean study = (StudyBean) request.getAttribute("study");
                 * StudySubjectBean studySubject = (StudySubjectBean)
                 * request.getAttribute("studySub"); EntityBeanTable table =
                 * (EntityBeanTable) request.getAttribute("table"); EventCRFBean
                 * ecb = (EventCRFBean)request.getAttribute("eventCRF");
                 * this.reset(); ArrayList rows = table.getRows(); ArrayList
                 * beans = DisplayStudyEventBean.generateBeansFromRows(rows);
                 *
                 *
                 * addStudyEventTree(study, studySubject, beans, ecb);
                 */
            // this.setIconInfoShown(false);
            // this.setManageSubject(true);
            this.reset();
            this.setStudyInfoShown(true);
            this.setOrderedData(true);
            this.setExtractData(false);
            this.setSubmitDataModule(false);
            this.setCreateDataset(false);
            this.setIconInfoShown(false);
            this.setManageSubject(true);
            request.setAttribute("showDDEIcon", Boolean.TRUE);
        } else if (page.equals(Page.ENTER_DATA_FOR_STUDY_EVENT) || page.equals(Page.ENTER_DATA_FOR_STUDY_EVENT_SERVLET)) {
            StudyBean study = (StudyBean) session.getAttribute("study");
            StudySubjectBean studySubject = (StudySubjectBean) request.getAttribute("studySubject");
            ArrayList beans = (ArrayList) request.getAttribute("beans");
            EventCRFBean ecb = (EventCRFBean) request.getAttribute("eventCRF");
            this.reset();
            addStudyEventTree(study, studySubject, beans, ecb, true);
            this.setStudyInfoShown(false);
            this.setOrderedData(true);
            this.setSubmitDataModule(true);
            this.setExtractData(false);
            this.setCreateDataset(false);
            this.setIconInfoShown(false);
        } else if (page.equals(Page.INTERVIEWER) || page.equals(Page.TABLE_OF_CONTENTS) || page.equals(Page.TABLE_OF_CONTENTS_SERVLET) || page.equals(Page.INITIAL_DATA_ENTRY) || page.equals(Page.INITIAL_DATA_ENTRY_SERVLET) || page.equals(Page.DOUBLE_DATA_ENTRY) || page.equals(Page.DOUBLE_DATA_ENTRY_SERVLET) || page.equals(Page.ADMIN_EDIT) || page.equals(Page.ADMIN_EDIT_SERVLET)) {
            /*
                 * pages designed to also follow the above format; check to see
                 * if they are in the session already, and does not refresh.
                 * TODO refine and test
                 */
            StudyBean study = (StudyBean) session.getAttribute("study");
            StudySubjectBean studySubject = (StudySubjectBean) request.getAttribute("studySubject");
            ArrayList beans = (ArrayList) request.getAttribute("beans");
            EventCRFBean ecb = (EventCRFBean) request.getAttribute("eventCRF");
            this.reset();
            addStudyEventTree(study, studySubject, beans, ecb, false);
            this.setStudyInfoShown(false);
            this.setOrderedData(true);
            this.setSubmitDataModule(true);
            this.setExtractData(false);
            this.setCreateDataset(false);
            this.setIconInfoShown(true);
        } else if (page.equals(Page.EDIT_DATASET)) {
            this.reset();
            // HashMap eventlist = (HashMap)
            // request.getAttribute("eventlist");
            HashMap eventlist = (LinkedHashMap) session.getAttribute("eventsForCreateDataset");
            ArrayList displayData = generateEventTree(eventlist);
            this.setCreateDataset(true);
            this.setOrderedData(true);
            this.setUserOrderedData(displayData);
            this.setStudyInfoShown(true);
            this.setSubmitDataModule(false);
            this.setExtractData(false);
            DatasetBean dsb = (DatasetBean) request.getAttribute("dataset");
            this.setData(resword.getString("dataset_name"), dsb.getName());
            this.setData(resword.getString("date_created"), local_sdf.format(dsb.getCreatedDate()));
            this.setData(resword.getString("dataset_owner"), dsb.getOwner().getName());
            this.setData(resword.getString("date_last_run"), local_sdf.format(dsb.getDateLastRun()));
        } else if (page.equals(Page.EXPORT_DATASETS)) {
            this.setCreateDataset(false);
        } else if (page.equals(Page.GENERATE_DATASET_HTML)) {
            DatasetBean db = (DatasetBean) request.getAttribute("dataset");
            ExtractBean exbean = (ExtractBean) request.getAttribute("extractBean");
            this.reset();
            ArrayList displayData = new ArrayList();
            displayData = generateDatasetTree(exbean, db);
            this.setUserOrderedData(displayData);
            this.setStudyInfoShown(false);
            this.setOrderedData(true);
            this.setExtractData(true);
            this.setSubmitDataModule(false);
            this.setCreateDataset(false);
        } else if (page.equals(Page.LIST_STUDY_SUBJECT) || page.equals(Page.LIST_STUDY_SUBJECTS) || page.equals(Page.SUBMIT_DATA) || page.equals(Page.SUBMIT_DATA_SERVLET)) {
            this.reset();
            this.setStudyInfoShown(true);
            this.setOrderedData(true);
            this.setExtractData(false);
            this.setSubmitDataModule(false);
            this.setCreateDataset(false);
            this.setIconInfoShown(false);
            this.setManageSubject(true);
            // don't want to show DDE icon key for subject matrix page
            request.setAttribute("showDDEIcon", Boolean.FALSE);
        } else if (page.equals(Page.VIEW_SECTION_DATA_ENTRY) || page.equals(Page.VIEW_SECTION_DATA_ENTRY_SERVLET)) {
            this.reset();
            this.setStudyInfoShown(true);
            this.setOrderedData(true);
            this.setExtractData(false);
            this.setSubmitDataModule(false);
            this.setCreateDataset(false);
            this.setIconInfoShown(true);
            this.setManageSubject(false);
        } else if (page.equals(Page.CREATE_SUBJECT_GROUP_CLASS) || page.equals(Page.CREATE_SUBJECT_GROUP_CLASS_CONFIRM) || page.equals(Page.UPDATE_SUBJECT_GROUP_CLASS) || page.equals(Page.UPDATE_SUBJECT_GROUP_CLASS_CONFIRM)) {
            this.reset();
            this.setStudyInfoShown(true);
            this.setOrderedData(true);
            this.setExtractData(false);
            this.setSubmitDataModule(false);
            this.setCreateDataset(false);
            this.setIconInfoShown(true);
            this.setManageSubject(false);
        } else {
            // automatically reset if we don't know what's happening
            this.reset();
            this.setStudyInfoShown(true);
            this.setOrderedData(true);
            this.setExtractData(false);
            this.setSubmitDataModule(false);
            this.setCreateDataset(false);
            this.setIconInfoShown(true);
            this.setManageSubject(false);
        }
    } catch (Exception e) {
        this.reset();
    }
}
Also used : Locale(java.util.Locale) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) DatasetBean(org.akaza.openclinica.bean.extract.DatasetBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) SectionBean(org.akaza.openclinica.bean.submit.SectionBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) ExtractBean(org.akaza.openclinica.bean.extract.ExtractBean) Collection(java.util.Collection) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) SimpleDateFormat(java.text.SimpleDateFormat) FilterBean(org.akaza.openclinica.bean.extract.FilterBean)

Aggregations

FilterBean (org.akaza.openclinica.bean.extract.FilterBean)14 HashMap (java.util.HashMap)10 ArrayList (java.util.ArrayList)7 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)5 EntityBeanTable (org.akaza.openclinica.web.bean.EntityBeanTable)5 Iterator (java.util.Iterator)4 FilterDAO (org.akaza.openclinica.dao.extract.FilterDAO)4 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)3 SimpleDateFormat (java.text.SimpleDateFormat)2 Collection (java.util.Collection)2 LinkedHashMap (java.util.LinkedHashMap)2 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)2 DatasetBean (org.akaza.openclinica.bean.extract.DatasetBean)2 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)2 SectionBean (org.akaza.openclinica.bean.submit.SectionBean)2 Validator (org.akaza.openclinica.control.form.Validator)2 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)2 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)2 Date (java.util.Date)1 Locale (java.util.Locale)1