Search in sources :

Example 1 with WebContext

use of org.jmesa.web.WebContext 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 WebContext

use of org.jmesa.web.WebContext in project OpenClinica by OpenClinica.

the class SDVUtil method setDataAndLimitVariables.

public void setDataAndLimitVariables(TableFacade tableFacade, int studyId, HttpServletRequest request) {
    Limit limit = tableFacade.getLimit();
    EventCRFSDVFilter eventCRFSDVFilter = getEventCRFSDVFilter(limit, studyId);
    WebContext context = tableFacade.getWebContext();
    String restore = request.getAttribute(limit.getId() + "_restore") + "";
    if (!limit.isComplete()) {
        int totalRows = getTotalRowCount(eventCRFSDVFilter, studyId);
        tableFacade.setTotalRows(totalRows);
    } else if (restore != null && "true".equalsIgnoreCase(restore)) {
        int totalRows = getTotalRowCount(eventCRFSDVFilter, studyId);
        int pageNum = limit.getRowSelect().getPage();
        int maxRows = limit.getRowSelect().getMaxRows();
        tableFacade.setMaxRows(maxRows);
        tableFacade.setTotalRows(totalRows);
        limit.getRowSelect().setPage(pageNum);
    }
    EventCRFSDVSort eventCRFSDVSort = getEventCRFSDVSort(limit);
    int rowStart = limit.getRowSelect().getRowStart();
    int rowEnd = limit.getRowSelect().getRowEnd();
    // Collection<StudySubjectBean> items = getStudySubjectDAO().getWithFilterAndSort(getStudyBean(),
    // studySubjectSDVFilter, subjectSort, rowStart, rowEnd);
    Collection<SubjectSDVContainer> items = getFilteredItems(eventCRFSDVFilter, eventCRFSDVSort, rowStart, rowEnd, studyId, request);
    tableFacade.setItems(items);
/*
         * Limit limit = tableFacade.getLimit();
         * FilterSet filterSet = limit.getFilterSet();
         * int totalRows = getTotalRowCount(filterSet, studyId);
         * 
         * tableFacade.setTotalRows(totalRows);
         * SortSet sortSet = limit.getSortSet();
         * int rowStart = limit.getRowSelect().getRowStart();
         * int rowEnd = limit.getRowSelect().getRowEnd();
         * Collection<SubjectSDVContainer> items = getFilteredItems(filterSet, sortSet, rowStart, rowEnd, studyId,
         * request);
         * 
         * tableFacade.setItems(items);
         */
}
Also used : WebContext(org.jmesa.web.WebContext) EventCRFSDVSort(org.akaza.openclinica.dao.EventCRFSDVSort) Limit(org.jmesa.limit.Limit) EventCRFSDVFilter(org.akaza.openclinica.dao.EventCRFSDVFilter) SubjectSDVContainer(org.akaza.openclinica.controller.helper.table.SubjectSDVContainer)

Example 3 with WebContext

use of org.jmesa.web.WebContext in project OpenClinica by OpenClinica.

the class ScheduledJobTableFactory method setDataAndLimitVariables.

public void setDataAndLimitVariables(TableFacade tableFacade, List<ScheduledJobs> jobs) {
    Limit limit = tableFacade.getLimit();
    WebContext context = tableFacade.getWebContext();
    if (context != null) {
        studyId = Integer.parseInt(context.getParameter("studyId"));
        contextPath = context.getContextPath();
    }
    ScheduledJobSort scheduledJobSort = getScheduledJobSort(limit);
    int rowStart = limit.getRowSelect().getRowStart();
    int rowEnd = limit.getRowSelect().getRowEnd();
    Collection<ScheduledJobs> items = getFilteredItems(jobs, scheduledJobSort, rowStart, rowEnd);
}
Also used : ScheduledJobSort(org.akaza.openclinica.dao.ScheduledJobSort) WebContext(org.jmesa.web.WebContext) Limit(org.jmesa.limit.Limit)

Aggregations

Limit (org.jmesa.limit.Limit)3 WebContext (org.jmesa.web.WebContext)3 SubjectAggregateContainer (org.akaza.openclinica.controller.helper.table.SubjectAggregateContainer)1 SubjectSDVContainer (org.akaza.openclinica.controller.helper.table.SubjectSDVContainer)1 EventCRFSDVFilter (org.akaza.openclinica.dao.EventCRFSDVFilter)1 EventCRFSDVSort (org.akaza.openclinica.dao.EventCRFSDVSort)1 ScheduledJobSort (org.akaza.openclinica.dao.ScheduledJobSort)1 StudySubjectSDVFilter (org.akaza.openclinica.dao.StudySubjectSDVFilter)1 StudySubjectSDVSort (org.akaza.openclinica.dao.StudySubjectSDVSort)1