use of org.akaza.openclinica.dao.managestudy.StudyAuditLogFilter in project OpenClinica by OpenClinica.
the class StudyAuditLogTableFactory method getAuditLogStudyFilter.
/**
* A very custom way to filter the items. The AuditUserLoginFilter acts as a
* command for the Hibernate criteria object. Take the Limit information and
* filter the rows.
*
* @param limit
* The Limit to use.
*/
protected StudyAuditLogFilter getAuditLogStudyFilter(Limit limit) {
StudyAuditLogFilter auditLogStudyFilter = new StudyAuditLogFilter(getDateFormat());
FilterSet filterSet = limit.getFilterSet();
Collection<Filter> filters = filterSet.getFilters();
for (Filter filter : filters) {
String property = filter.getProperty();
String value = filter.getValue();
if ("studySubject.status".equalsIgnoreCase(property)) {
value = Status.getByName(value).getId() + "";
}
auditLogStudyFilter.addFilter(property, value);
}
return auditLogStudyFilter;
}
use of org.akaza.openclinica.dao.managestudy.StudyAuditLogFilter 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);
}
Aggregations