use of org.akaza.openclinica.dao.hibernate.AuditUserLoginSort in project OpenClinica by OpenClinica.
the class AuditUserLoginTableFactory method setDataAndLimitVariables.
@Override
public void setDataAndLimitVariables(TableFacade tableFacade) {
// initialize i18n
resword = ResourceBundleProvider.getWordsBundle(getLocale());
Limit limit = tableFacade.getLimit();
AuditUserLoginFilter auditUserLoginFilter = getAuditUserLoginFilter(limit);
/*
* 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 = getAuditUserLoginDao().getCountWithFilter(auditUserLoginFilter);
tableFacade.setTotalRows(totalRows);
}
AuditUserLoginSort auditUserLoginSort = getAuditUserLoginSort(limit);
if (auditUserLoginSort.getSorts().size() == 0) {
auditUserLoginSort.addSort("loginAttemptDate", "desc");
}
int rowStart = limit.getRowSelect().getRowStart();
int rowEnd = limit.getRowSelect().getRowEnd();
Collection<AuditUserLoginBean> items = getAuditUserLoginDao().getWithFilterAndSort(auditUserLoginFilter, auditUserLoginSort, rowStart, rowEnd);
// Do not forget to set the items back on
tableFacade.setItems(items);
// the tableFacade.
}
use of org.akaza.openclinica.dao.hibernate.AuditUserLoginSort in project OpenClinica by OpenClinica.
the class AuditUserLoginTableFactory method getAuditUserLoginSort.
/**
* A very custom way to sort the items. The AuditUserLoginSort acts as a
* command for the Hibernate criteria object. Take the Limit information and
* sort the rows.
*
* @param limit
* The Limit to use.
*/
protected AuditUserLoginSort getAuditUserLoginSort(Limit limit) {
AuditUserLoginSort auditUserLoginSort = new AuditUserLoginSort();
SortSet sortSet = limit.getSortSet();
if (sortSet != null) {
Collection<Sort> sorts = sortSet.getSorts();
for (Sort sort : sorts) {
String property = sort.getProperty();
String order = sort.getOrder().toParam();
auditUserLoginSort.addSort(property, order);
}
}
return auditUserLoginSort;
}
Aggregations