Search in sources :

Example 1 with StudySubjectSDVSort

use of org.akaza.openclinica.dao.StudySubjectSDVSort 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 2 with StudySubjectSDVSort

use of org.akaza.openclinica.dao.StudySubjectSDVSort in project OpenClinica by OpenClinica.

the class SubjectIdSDVFactory method getStudySubjectSDVSort.

protected StudySubjectSDVSort getStudySubjectSDVSort(Limit limit) {
    StudySubjectSDVSort studySubjectSDVSort = new StudySubjectSDVSort();
    SortSet sortSet = limit.getSortSet();
    Collection<Sort> sorts = sortSet.getSorts();
    for (Sort sort : sorts) {
        String property = sort.getProperty();
        String order = sort.getOrder().toParam();
        studySubjectSDVSort.addSort(property, order);
    }
    return studySubjectSDVSort;
}
Also used : StudySubjectSDVSort(org.akaza.openclinica.dao.StudySubjectSDVSort) StudySubjectSDVSort(org.akaza.openclinica.dao.StudySubjectSDVSort) Sort(org.jmesa.limit.Sort) SortSet(org.jmesa.limit.SortSet)

Aggregations

StudySubjectSDVSort (org.akaza.openclinica.dao.StudySubjectSDVSort)2 SubjectAggregateContainer (org.akaza.openclinica.controller.helper.table.SubjectAggregateContainer)1 StudySubjectSDVFilter (org.akaza.openclinica.dao.StudySubjectSDVFilter)1 Limit (org.jmesa.limit.Limit)1 Sort (org.jmesa.limit.Sort)1 SortSet (org.jmesa.limit.SortSet)1 WebContext (org.jmesa.web.WebContext)1