Search in sources :

Example 16 with Limit

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

the class StudyStatisticsTableFactory method setDataAndLimitVariables.

@SuppressWarnings("unchecked")
@Override
public void setDataAndLimitVariables(TableFacade tableFacade) {
    Limit limit = tableFacade.getLimit();
    Collection<HashMap<Object, Object>> theItems = new ArrayList<HashMap<Object, Object>>();
    /*
         * 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 = 1;
        tableFacade.setTotalRows(totalRows);
    }
    int rowStart = limit.getRowSelect().getRowStart();
    int rowEnd = limit.getRowSelect().getRowEnd();
    // Get number of subjects enrolled at a specific study or site
    Integer countofStudySubjectsAtStudy = studySubjectDao.getCountofStudySubjectsAtStudy(currentStudy);
    Integer expectedTotalEnrollment = currentStudy.getExpectedTotalEnrollment();
    Long percentage = expectedTotalEnrollment == 0 ? 0 : Math.round((countofStudySubjectsAtStudy.doubleValue() / expectedTotalEnrollment.doubleValue()) * 100);
    HashMap<Object, Object> theItem = new HashMap<Object, Object>();
    theItem.put("name", currentStudy.getName());
    theItem.put("enrolled", countofStudySubjectsAtStudy);
    theItem.put("expectedTotalEnrollment", currentStudy.getExpectedTotalEnrollment());
    theItem.put("percentage", String.valueOf(percentage) + "%");
    theItems.add(theItem);
    tableFacade.setItems(theItems);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Limit(org.jmesa.limit.Limit)

Example 17 with Limit

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

the class ListNotesTableFactory method configureTableFacadePostColumnConfiguration.

@Override
public void configureTableFacadePostColumnConfiguration(TableFacade tableFacade) {
    ListNotesTableToolbar toolbar = new ListNotesTableToolbar(showMoreLink);
    toolbar.setStudyHasDiscNotes(studyHasDiscNotes);
    toolbar.setDiscNoteType(discNoteType);
    toolbar.setResolutionStatus(resolutionStatus);
    toolbar.setModule(module);
    toolbar.setResword(resword);
    Limit limit = tableFacade.getLimit();
    toolbar.setFilterSet(limit.getFilterSet());
    toolbar.setSortSet(limit.getSortSet());
    tableFacade.setToolbar(toolbar);
}
Also used : Limit(org.jmesa.limit.Limit)

Example 18 with Limit

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

the class ListNotesTableFactory method findAllNotes.

public List<DiscrepancyNoteBean> findAllNotes(TableFacade tableFacade) {
    Limit limit = tableFacade.getLimit();
    limit.setRowSelect(null);
    ViewNotesFilterCriteria filter = ViewNotesFilterCriteria.buildFilterCriteria(limit, getDateFormat(), discrepancyNoteTypeDropdown.getDecoder(), resolutionStatusDropdown.getDecoder());
    List<DiscrepancyNoteBean> items = getViewNotesService().listNotes(getCurrentStudy(), filter, ViewNotesSortCriteria.buildFilterCriteria(limit.getSortSet()));
    return items;
}
Also used : DiscrepancyNoteBean(org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean) ViewNotesFilterCriteria(org.akaza.openclinica.service.managestudy.ViewNotesFilterCriteria) Limit(org.jmesa.limit.Limit)

Example 19 with Limit

use of org.jmesa.limit.Limit 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 20 with Limit

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

the class ScheduledJobTableFactory method createTable.

/**
 * Creating table
 */
@Override
public TableFacade createTable(HttpServletRequest request, HttpServletResponse response) {
    locale = LocaleResolver.getLocale(request);
    TableFacade tableFacade = getTableFacadeImpl(request, response);
    tableFacade.setStateAttr("restore");
    int maxJobs = (Integer) request.getAttribute("totalJobs");
    tableFacade.setTotalRows(maxJobs);
    Limit limit = tableFacade.getLimit();
    List<ScheduledJobs> jobs = (List<ScheduledJobs>) request.getAttribute("jobs");
    int rowStart = limit.getRowSelect().getRowStart();
    int rowEnd = limit.getRowSelect().getRowEnd();
    // Collection<SubjectAggregateContainer> items =
    // getFilteredItems(studySubjectSDVFilter, studySubjectSDVSort,
    // rowStart, rowEnd);
    //  setDataAndLimitVariables(tableFacade, jobs);
    tableFacade.setItems(jobs);
    configureTableFacade(response, tableFacade);
    if (!tableFacade.getLimit().isExported()) {
        configureColumns(tableFacade, locale);
        tableFacade.setMaxRowsIncrements(getMaxRowIncrements());
        configureTableFacadePostColumnConfiguration(tableFacade);
        configureTableFacadeCustomView(tableFacade);
        configureUnexportedTable(tableFacade, locale);
    } else {
        configureExportColumns(tableFacade, locale);
    }
    return tableFacade;
}
Also used : TableFacade(org.jmesa.facade.TableFacade) List(java.util.List) Limit(org.jmesa.limit.Limit)

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