Search in sources :

Example 11 with Limit

use of org.jmesa.limit.Limit in project OpenClinica by OpenClinica.

the class ViewRuleAssignmentTableFactory method setDataAndLimitVariables.

@Override
public void setDataAndLimitVariables(TableFacade tableFacade) {
    // initialize i18n
    resword = ResourceBundleProvider.getWordsBundle(getLocale());
    Limit limit = tableFacade.getLimit();
    ViewRuleAssignmentFilter viewRuleAssignmentFilter = getViewRuleAssignmentFilter(limit);
    ViewRuleAssignmentSort viewRuleAssignmentSort = getViewRuleAssignmentSort(limit);
    viewRuleAssignmentFilter.addFilter("studyId", currentStudy.getId());
    if (viewRuleAssignmentSort.getSorts().size() == 0) {
        viewRuleAssignmentSort.addSort("itemName", "asc");
    }
    Boolean ruleSetRuleStatusFilterNotSelected = true;
    for (ViewRuleAssignmentFilter.Filter filter : viewRuleAssignmentFilter.getFilters()) {
        if (filter.getProperty().equals("ruleSetRuleStatus")) {
            ruleSetRuleStatusFilterNotSelected = false;
        }
    }
    if (ruleSetRuleStatusFilterNotSelected) {
        viewRuleAssignmentFilter.addFilter("ruleSetRuleStatus", "1");
    }
    /*
         * Because we are using the State feature (via stateAttr) we can do a check to see if we have a complete limit
         * already. See the State feature for more details Very important to set the totalRow before trying to get the row
         * start and row end variables. Very important to set the totalRow before trying to get the row start and row end
         * variables.
         */
    if (!limit.isComplete()) {
        int totalRows = getRuleSetService().getCountWithFilter(viewRuleAssignmentFilter);
        tableFacade.setTotalRows(totalRows);
    }
    int rowStart = limit.getRowSelect().getRowStart();
    int rowEnd = limit.getRowSelect().getRowEnd();
    Collection<RuleSetRuleBean> items = getRuleSetService().getWithFilterAndSort(viewRuleAssignmentFilter, viewRuleAssignmentSort, rowStart, rowEnd);
    HashMap<Integer, RuleSetBean> ruleSets = new HashMap<Integer, RuleSetBean>();
    Collection<HashMap<Object, Object>> theItems = new ArrayList<HashMap<Object, Object>>();
    ruleSetRuleIds = new ArrayList<Integer>();
    for (RuleSetRuleBean ruleSetRuleBean : items) {
        RuleSetBean ruleSetBean = null;
        ruleSetRuleIds.add(ruleSetRuleBean.getId());
        if (ruleSets.containsKey(ruleSetRuleBean.getRuleSetBean().getId())) {
            ruleSetBean = ruleSets.get(ruleSetRuleBean.getRuleSetBean().getId());
        } else {
            ruleSetBean = ruleSetRuleBean.getRuleSetBean();
            getRuleSetService().getObjects(ruleSetBean);
            ruleSets.put(ruleSetBean.getId(), ruleSetBean);
        }
        HashMap<Object, Object> theItem = new HashMap<Object, Object>();
        theItem.put("ruleSetRunSchedule", ruleSetBean.isRunSchedule());
        theItem.put("ruleSetRunTime", ruleSetBean.getRunTime());
        theItem.put("ruleSetId", ruleSetBean.getId());
        theItem.put("ruleSetRuleId", ruleSetRuleBean.getId());
        theItem.put("ruleId", ruleSetRuleBean.getRuleBean().getId());
        theItem.put("ruleSetRule", ruleSetRuleBean);
        theItem.put("targetValue", ruleSetBean.getTarget().getValue());
        theItem.put("studyEventDefinitionName", ruleSetBean.getStudyEventDefinitionName());
        theItem.put("crf", ruleSetBean.getCrf());
        theItem.put("crfVersion", ruleSetBean.getCrfVersion());
        theItem.put("item", ruleSetBean.getItem());
        theItem.put("crfName", ruleSetBean.getCrfName());
        theItem.put("crfVersionName", ruleSetBean.getCrfVersionName());
        theItem.put("groupLabel", ruleSetBean.getGroupLabel());
        theItem.put("itemName", ruleSetBean.getItemName());
        theItem.put("ruleSetRules", ruleSetBean.getRuleSetRules());
        theItem.put("ruleName", ruleSetRuleBean.getRuleBean().getName());
        theItem.put("ruleExpressionValue", ruleSetRuleBean.getRuleBean().getExpression().getValue());
        theItem.put("ruleOid", ruleSetRuleBean.getRuleBean().getOid());
        theItem.put("ruleDescription", ruleSetRuleBean.getRuleBean().getDescription());
        theItem.put("theActions", ruleSetRuleBean.getActions());
        theItem.put("ruleSetRuleStatus", "");
        theItem.put("validations", "");
        theItem.put("actionExecuteOn", "");
        theItem.put("actionType", "XXXXXXXXX");
        theItem.put("actionSummary", "");
        theItems.add(theItem);
    }
    // Do not forget to set the items back on the tableFacade.
    tableFacade.setItems(theItems);
}
Also used : RuleSetRuleBean(org.akaza.openclinica.domain.rule.RuleSetRuleBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ViewRuleAssignmentSort(org.akaza.openclinica.dao.hibernate.ViewRuleAssignmentSort) ViewRuleAssignmentFilter(org.akaza.openclinica.dao.hibernate.ViewRuleAssignmentFilter) Limit(org.jmesa.limit.Limit) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean)

Example 12 with Limit

use of org.jmesa.limit.Limit in project OpenClinica by OpenClinica.

the class SubjectIdSDVFactory method setDataAndLimitVariables.

@Override
public void setDataAndLimitVariables(TableFacade tableFacade) {
    Limit limit = tableFacade.getLimit();
    StudySubjectSDVFilter studySubjectSDVFilter = getStudySubjectSDVFilter(limit);
    WebContext context = tableFacade.getWebContext();
    if (context != null) {
        studyId = Integer.parseInt(context.getParameter("studyId"));
        contextPath = context.getContextPath();
    }
    String restore = context.getRequestAttribute(limit.getId() + "_restore") + "";
    if (!limit.isComplete()) {
        int totalRows = getTotalRowCount(studySubjectSDVFilter);
        tableFacade.setTotalRows(totalRows);
    } else if (restore != null && "true".equalsIgnoreCase(restore)) {
        int totalRows = getTotalRowCount(studySubjectSDVFilter);
        int pageNum = limit.getRowSelect().getPage();
        int maxRows = limit.getRowSelect().getMaxRows();
        tableFacade.setMaxRows(maxRows);
        tableFacade.setTotalRows(totalRows);
        limit.getRowSelect().setPage(pageNum);
    }
    StudySubjectSDVSort studySubjectSDVSort = getStudySubjectSDVSort(limit);
    int rowStart = limit.getRowSelect().getRowStart();
    int rowEnd = limit.getRowSelect().getRowEnd();
    //Collection<StudySubjectBean> items = getStudySubjectDAO().getWithFilterAndSort(getStudyBean(), studySubjectSDVFilter, subjectSort, rowStart, rowEnd);
    Collection<SubjectAggregateContainer> items = getFilteredItems(studySubjectSDVFilter, studySubjectSDVSort, rowStart, rowEnd);
    tableFacade.setItems(items);
/*
        

        Limit limit = tableFacade.getLimit();
        FilterSet filterSet = limit.getFilterSet();
        WebContext context = tableFacade.getWebContext();
        if (context != null) {
            studyId = Integer.parseInt(context.getParameter("studyId"));
            contextPath = context.getContextPath();
        }
        int totalRows = getTotalRowCount();

        tableFacade.setTotalRows(totalRows);
        SortSet sortSet = limit.getSortSet();
        int rowStart = limit.getRowSelect().getRowStart();
        int rowEnd = limit.getRowSelect().getRowEnd();
        Collection<SubjectAggregateContainer> items = getFilteredItems(filterSet, sortSet, rowStart, rowEnd);
        ;

        tableFacade.setItems(items);
        */
}
Also used : SubjectAggregateContainer(org.akaza.openclinica.controller.helper.table.SubjectAggregateContainer) WebContext(org.jmesa.web.WebContext) StudySubjectSDVSort(org.akaza.openclinica.dao.StudySubjectSDVSort) StudySubjectSDVFilter(org.akaza.openclinica.dao.StudySubjectSDVFilter) Limit(org.jmesa.limit.Limit)

Example 13 with Limit

use of org.jmesa.limit.Limit in project OpenClinica by OpenClinica.

the class SDVUtil method setDataAndLimitVariablesSubjects.

public int setDataAndLimitVariablesSubjects(TableFacade tableFacade, int studyId, int studySubjectId, HttpServletRequest request) {
    Limit limit = tableFacade.getLimit();
    FilterSet filterSet = limit.getFilterSet();
    int totalRows = getTotalRowCountSubjects(filterSet, studyId, studySubjectId);
    tableFacade.setTotalRows(totalRows);
    SortSet sortSet = limit.getSortSet();
    int rowStart = limit.getRowSelect().getRowStart();
    int rowEnd = limit.getRowSelect().getRowEnd();
    Collection<SubjectSDVContainer> items = getFilteredItemsSubject(filterSet, sortSet, rowStart, rowEnd, studyId, studySubjectId, request);
    tableFacade.setItems(items);
    return totalRows;
}
Also used : FilterSet(org.jmesa.limit.FilterSet) Limit(org.jmesa.limit.Limit) SubjectSDVContainer(org.akaza.openclinica.controller.helper.table.SubjectSDVContainer) SortSet(org.jmesa.limit.SortSet)

Example 14 with Limit

use of org.jmesa.limit.Limit in project OpenClinica by OpenClinica.

the class SDVUtil method updateLimitRowSelect.

private void updateLimitRowSelect(TableFacade tableFacade, HttpServletRequest request) {
    Limit limit = tableFacade.getLimit();
    String p = request.getParameter(limit.getId() + "_p_");
    int pn = p != null && p.length() > 0 ? Integer.parseInt(p) : 1;
}
Also used : Limit(org.jmesa.limit.Limit)

Example 15 with Limit

use of org.jmesa.limit.Limit in project OpenClinica by OpenClinica.

the class AbstractTableFactory method createLimits.

private ArrayList<Limit> createLimits() {
    Limit limit = new LimitImpl(getTableName());
    ArrayList<Limit> limits = new ArrayList<Limit>();
    int size = getSize(limit);
    for (RowSelect rowSelect : getRowSelects(size)) {
        Limit theLimit = new LimitImpl(getTableName());
        theLimit.setRowSelect(rowSelect);
        theLimit.setExportType(ExportType.CSV);
        limits.add(theLimit);
    }
    return limits;
}
Also used : RowSelect(org.jmesa.limit.RowSelect) ArrayList(java.util.ArrayList) Limit(org.jmesa.limit.Limit) LimitImpl(org.jmesa.limit.LimitImpl)

Aggregations

Limit (org.jmesa.limit.Limit)24 ArrayList (java.util.ArrayList)14 HashMap (java.util.HashMap)13 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)6 SubjectBean (org.akaza.openclinica.bean.submit.SubjectBean)5 List (java.util.List)4 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)4 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)4 SubjectEventStatus (org.akaza.openclinica.bean.core.SubjectEventStatus)3 DiscrepancyNoteBean (org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean)3 Date (java.util.Date)2 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)2 ResolutionStatus (org.akaza.openclinica.bean.core.ResolutionStatus)2 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)2 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)2 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)2 StudyGroupClassBean (org.akaza.openclinica.bean.managestudy.StudyGroupClassBean)2 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)2 SubjectGroupMapBean (org.akaza.openclinica.bean.submit.SubjectGroupMapBean)2 SubjectSDVContainer (org.akaza.openclinica.controller.helper.table.SubjectSDVContainer)2