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