use of org.akaza.openclinica.dao.managestudy.StudyAuditLogSort in project OpenClinica by OpenClinica.
the class StudyAuditLogTableFactory method setDataAndLimitVariables.
@Override
public void setDataAndLimitVariables(TableFacade tableFacade) {
// initialize i18n
resword = ResourceBundleProvider.getWordsBundle(getLocale());
resformat = ResourceBundleProvider.getFormatBundle(getLocale());
Limit limit = tableFacade.getLimit();
StudyAuditLogFilter auditLogStudyFilter = getAuditLogStudyFilter(limit);
if (!limit.isComplete()) {
int totalRows = getStudySubjectDao().getCountWithFilter(auditLogStudyFilter, getCurrentStudy());
tableFacade.setTotalRows(totalRows);
}
StudyAuditLogSort auditLogStudySort = getAuditLogStudySort(limit);
/*
* if (auditLogStudySort.getSorts().size() == 0) {
* auditLogStudySort.addSort("loginAttemptDate", "desc"); }
*/
int rowStart = limit.getRowSelect().getRowStart();
int rowEnd = limit.getRowSelect().getRowEnd();
Collection<StudySubjectBean> items = getStudySubjectDao().getWithFilterAndSort(getCurrentStudy(), auditLogStudyFilter, auditLogStudySort, rowStart, rowEnd);
Collection<HashMap<Object, Object>> theItems = new ArrayList<HashMap<Object, Object>>();
for (StudySubjectBean studySubjectBean : items) {
SubjectBean subject = (SubjectBean) getSubjectDao().findByPK(studySubjectBean.getSubjectId());
UserAccountBean owner = (UserAccountBean) getUserAccountDao().findByPK(studySubjectBean.getOwnerId());
HashMap<Object, Object> h = new HashMap<Object, Object>();
h.put("studySubject", studySubjectBean);
h.put("studySubject.label", studySubjectBean.getLabel());
h.put("studySubject.secondaryLabel", studySubjectBean.getSecondaryLabel());
h.put("studySubject.oid", studySubjectBean.getOid());
h.put("studySubject.owner", owner);
h.put("studySubject.status", studySubjectBean.getStatus());
h.put("subject", subject);
h.put("subject.dateOfBirth", resolveBirthDay(subject.getDateOfBirth(), subject.isDobCollected(), getLocale()));
h.put("subject.uniqueIdentifier", subject.getUniqueIdentifier());
theItems.add(h);
}
tableFacade.setItems(theItems);
}
use of org.akaza.openclinica.dao.managestudy.StudyAuditLogSort in project OpenClinica by OpenClinica.
the class StudyAuditLogTableFactory method getAuditLogStudySort.
/**
* 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 StudyAuditLogSort getAuditLogStudySort(Limit limit) {
StudyAuditLogSort auditLogStudySort = new StudyAuditLogSort();
SortSet sortSet = limit.getSortSet();
Collection<Sort> sorts = sortSet.getSorts();
for (Sort sort : sorts) {
String property = sort.getProperty();
String order = sort.getOrder().toParam();
auditLogStudySort.addSort(property, order);
}
return auditLogStudySort;
}
Aggregations