Search in sources :

Example 6 with EntityBeanTable

use of org.akaza.openclinica.web.bean.EntityBeanTable in project OpenClinica by OpenClinica.

the class ApplyFilterServlet method getFilterTable.

private EntityBeanTable getFilterTable() {
    FormProcessor fp = new FormProcessor(request);
    FilterDAO fdao = new FilterDAO(sm.getDataSource());
    EntityBeanTable table = fp.getEntityBeanTable();
    ArrayList filters = new ArrayList();
    if (ub.isSysAdmin()) {
        filters = (ArrayList) fdao.findAllAdmin();
    } else {
        filters = (ArrayList) fdao.findAll();
    }
    // TODO make findAllByProject????
    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.setQuery("ApplyFilter", new HashMap());
    table.setRows(filterRows);
    table.computeDisplay();
    return table;
}
Also used : FilterDAO(org.akaza.openclinica.dao.extract.FilterDAO) HashMap(java.util.HashMap) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) EntityBeanTable(org.akaza.openclinica.web.bean.EntityBeanTable) ArrayList(java.util.ArrayList)

Example 7 with EntityBeanTable

use of org.akaza.openclinica.web.bean.EntityBeanTable in project OpenClinica by OpenClinica.

the class CreateDatasetServlet method getFilterTable.

private EntityBeanTable getFilterTable() {
    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.setQuery("ApplyFilter", new HashMap());
    table.setRows(filterRows);
    table.computeDisplay();
    return table;
}
Also used : FilterDAO(org.akaza.openclinica.dao.extract.FilterDAO) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) EntityBeanTable(org.akaza.openclinica.web.bean.EntityBeanTable) ArrayList(java.util.ArrayList)

Example 8 with EntityBeanTable

use of org.akaza.openclinica.web.bean.EntityBeanTable in project OpenClinica by OpenClinica.

the class RemoveFilterServlet method getFilterTable.

private EntityBeanTable getFilterTable() {
    FormProcessor fp = new FormProcessor(request);
    FilterDAO fdao = new FilterDAO(sm.getDataSource());
    EntityBeanTable table = fp.getEntityBeanTable();
    ArrayList filters = (ArrayList) fdao.findAll();
    // TODO make findAllByProject
    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.setQuery("CreateFiltersOne", new HashMap());
    table.setRows(filterRows);
    table.computeDisplay();
    return table;
}
Also used : FilterDAO(org.akaza.openclinica.dao.extract.FilterDAO) HashMap(java.util.HashMap) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) EntityBeanTable(org.akaza.openclinica.web.bean.EntityBeanTable) ArrayList(java.util.ArrayList)

Example 9 with EntityBeanTable

use of org.akaza.openclinica.web.bean.EntityBeanTable in project OpenClinica by OpenClinica.

the class RemoveFilterServlet method processRequest.

@Override
public void processRequest() throws Exception {
    FormProcessor fp = new FormProcessor(request);
    int filterId = fp.getInt("filterId");
    FilterDAO fDAO = new FilterDAO(sm.getDataSource());
    FilterBean filter = (FilterBean) fDAO.findByPK(filterId);
    String action = request.getParameter("action");
    if (resword.getString("remove_this_filter").equalsIgnoreCase(action)) {
        filter.setStatus(Status.DELETED);
        fDAO.update(filter);
        addPageMessage(respage.getString("filter_removed_admin_can_access_and_reverse"));
        EntityBeanTable table = getFilterTable();
        request.setAttribute("table", table);
        forwardPage(Page.CREATE_FILTER_SCREEN_1);
    } else if (resword.getString("cancel").equalsIgnoreCase(action)) {
        EntityBeanTable table = getFilterTable();
        request.setAttribute("table", table);
        forwardPage(Page.CREATE_FILTER_SCREEN_1);
    } else {
        request.setAttribute("filter", filter);
        forwardPage(Page.REMOVE_FILTER);
    }
}
Also used : FilterDAO(org.akaza.openclinica.dao.extract.FilterDAO) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) EntityBeanTable(org.akaza.openclinica.web.bean.EntityBeanTable) FilterBean(org.akaza.openclinica.bean.extract.FilterBean)

Example 10 with EntityBeanTable

use of org.akaza.openclinica.web.bean.EntityBeanTable in project OpenClinica by OpenClinica.

the class FormProcessor method getEntityBeanTable.

public EntityBeanTable getEntityBeanTable() {
    EntityBeanTable answer = new EntityBeanTable();
    String sortingColumn = request.getParameter(EBL_SORT_COLUMN);
    if (sortingColumn != null && !"".equals(sortingColumn)) {
        answer.setSortingColumnExplicitlySet(true);
    }
    answer.setCurrPageNumber(getInt(EBL_PAGE));
    answer.setSortingColumnInd(getInt(EBL_SORT_COLUMN));
    answer.setKeywordFilter(getString(EBL_FILTER_KEYWORD));
    // this code says that for each of the boolean properties of the table,
    // if no value was speified on the form or in the GET query, then
    // keep the default value for that bit
    // otherwise, the bits will just be forced to false
    String[] blnFields = { EBL_SORT_ORDER, EBL_FILTERED, EBL_PAGINATED };
    for (int i = 0; i < blnFields.length; i++) {
        String value = getString(blnFields[i]);
        boolean b = getBoolean(blnFields[i]);
        if (!"".equals(value)) {
            if (i == 0) {
                answer.setAscendingSort(b);
            } else if (i == 1) {
                answer.setFiltered(b);
            } else {
                answer.setPaginated(b);
            }
        }
    }
    return answer;
}
Also used : EntityBeanTable(org.akaza.openclinica.web.bean.EntityBeanTable)

Aggregations

EntityBeanTable (org.akaza.openclinica.web.bean.EntityBeanTable)37 ArrayList (java.util.ArrayList)34 HashMap (java.util.HashMap)34 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)34 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)11 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)10 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)10 DatasetDAO (org.akaza.openclinica.dao.extract.DatasetDAO)9 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)9 FilterDAO (org.akaza.openclinica.dao.extract.FilterDAO)8 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)7 UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)7 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)7 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)6 DatasetBean (org.akaza.openclinica.bean.extract.DatasetBean)6 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)6 Date (java.util.Date)5 Iterator (java.util.Iterator)5 Map (java.util.Map)5 FilterBean (org.akaza.openclinica.bean.extract.FilterBean)5