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);
}
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);
}
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;
}
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);
*/
}
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;
}
Aggregations