Search in sources :

Example 66 with RuleSetBean

use of org.akaza.openclinica.domain.rule.RuleSetBean in project OpenClinica by OpenClinica.

the class ViewRuleAssignmentRow method compareColumn.

/*
     * (non-Javadoc)
     *
     * @see org.akaza.openclinica.core.EntityBeanRow#compareColumn(java.lang.Object,
     *      int)
     */
@Override
protected int compareColumn(Object row, int sortingColumn) {
    if (!row.getClass().equals(ViewRuleAssignmentRow.class)) {
        return 0;
    }
    RuleSetBean thisRuleSet = (RuleSetBean) bean;
    RuleSetBean argRuleSet = (RuleSetBean) ((ViewRuleAssignmentRow) row).bean;
    int answer = 0;
    switch(sortingColumn) {
        case COL_CRF:
            answer = thisRuleSet.getCrfWithVersionName().toLowerCase().compareTo(argRuleSet.getCrfWithVersionName().toLowerCase());
            break;
        case COL_GROUP:
            answer = thisRuleSet.getGroupLabel().toLowerCase().compareTo(argRuleSet.getGroupLabel().toLowerCase());
            break;
        case COL_ITEM:
            answer = thisRuleSet.getItemName().toLowerCase().compareTo(argRuleSet.getItemName().toLowerCase());
            break;
    }
    return answer;
}
Also used : RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean)

Example 67 with RuleSetBean

use of org.akaza.openclinica.domain.rule.RuleSetBean in project OpenClinica by OpenClinica.

the class ViewRuleAssignmentServlet method processRequest.

@Override
public void processRequest() throws Exception {
    FormProcessor fp = new FormProcessor(request);
    List<RuleSetBean> ruleSets = getRuleSetService().getRuleSetsByStudy(currentStudy);
    ruleSets = getRuleSetService().filterByStatusEqualsAvailableOnlyRuleSetRules(ruleSets);
    EntityBeanTable table = fp.getWebEntityBeanTable();
    ArrayList allRows = ViewRuleAssignmentRow.generateRowsFromBeans((ArrayList) ruleSets);
    String[] columns = { resword.getString("rule_study_event_definition"), resword.getString("CRF_name"), resword.getString("rule_group_label"), resword.getString("rule_item_name"), resword.getString("rule_rules"), resword.getString("rule_ref_oid"), resword.getString("rule_action_type"), resword.getString("actions") };
    table.setColumns(new ArrayList(Arrays.asList(columns)));
    table.hideColumnLink(4);
    table.hideColumnLink(5);
    table.hideColumnLink(6);
    table.setQuery("ViewRuleAssignment", new HashMap());
    // table.addLink(resword.getString("rule_import_rule"), "ImportRule");
    table.addLink(resword.getString("test_rule_title"), "TestRule");
    table.setRows(allRows);
    table.computeDisplay();
    request.setAttribute("table", table);
    if (request.getParameter("read") != null && request.getParameter("read").equals("true")) {
        request.setAttribute("readOnly", true);
    }
    forwardPage(Page.VIEW_RULE_SETS);
}
Also used : HashMap(java.util.HashMap) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) EntityBeanTable(org.akaza.openclinica.web.domain.EntityBeanTable) ArrayList(java.util.ArrayList) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean)

Aggregations

RuleSetBean (org.akaza.openclinica.domain.rule.RuleSetBean)67 ArrayList (java.util.ArrayList)28 RuleSetRuleBean (org.akaza.openclinica.domain.rule.RuleSetRuleBean)26 ExpressionBean (org.akaza.openclinica.domain.rule.expression.ExpressionBean)19 RuleBean (org.akaza.openclinica.domain.rule.RuleBean)15 HashMap (java.util.HashMap)13 ExpressionObjectWrapper (org.akaza.openclinica.domain.rule.expression.ExpressionObjectWrapper)11 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)9 RuleActionBean (org.akaza.openclinica.domain.rule.action.RuleActionBean)9 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)8 OpenClinicaSystemException (org.akaza.openclinica.exception.OpenClinicaSystemException)7 Map (java.util.Map)6 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)6 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)6 OpenClinicaExpressionParser (org.akaza.openclinica.logic.expressionTree.OpenClinicaExpressionParser)6 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)5 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)5 RulesPostImportContainer (org.akaza.openclinica.domain.rule.RulesPostImportContainer)5 RuleActionRunLogBean (org.akaza.openclinica.domain.rule.action.RuleActionRunLogBean)5 Locale (java.util.Locale)4