use of org.jmesa.limit.FilterSet 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.jmesa.limit.FilterSet in project OpenClinica by OpenClinica.
the class ViewNotesFilterCriteria method buildFilterCriteria.
public static ViewNotesFilterCriteria buildFilterCriteria(Limit limit, String datePattern, Map<String, String> discrepancyNoteTypeDecoder, Map<String, String> resolutionTypeDecoder) {
ViewNotesFilterCriteria criteria = new ViewNotesFilterCriteria();
FilterSet filterSet = limit.getFilterSet();
if (filterSet != null) {
DateFormat df = new SimpleDateFormat(datePattern);
for (Filter filter : filterSet.getFilters()) {
String columnName = filter.getProperty();
String filterName = FILTER_BY_TABLE_COLUMN.get(columnName);
if (filterName == null) {
throw new IllegalArgumentException("No query fragment available for column '" + columnName + "'");
}
String value = filter.getValue();
if (filterName.equals("discrepancy_note_type_id")) {
value = discrepancyNoteTypeDecoder.get(value);
} else if (filterName.equals("resolution_status_id")) {
value = resolutionTypeDecoder.get(value);
}
criteria.getFilters().put(filterName, processValue(filterName, value, df));
}
}
RowSelect rowSelect = limit.getRowSelect();
if (rowSelect != null) {
criteria.pageNumber = rowSelect.getPage();
criteria.pageSize = rowSelect.getMaxRows();
}
return criteria;
}
use of org.jmesa.limit.FilterSet in project OpenClinica by OpenClinica.
the class AuditUserLoginTableFactory method getAuditUserLoginFilter.
/**
* 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 AuditUserLoginFilter getAuditUserLoginFilter(Limit limit) {
AuditUserLoginFilter auditUserLoginFilter = new AuditUserLoginFilter();
FilterSet filterSet = limit.getFilterSet();
if (filterSet != null) {
Collection<Filter> filters = filterSet.getFilters();
for (Filter filter : filters) {
String property = filter.getProperty();
String value = filter.getValue();
auditUserLoginFilter.addFilter(property, value);
}
}
return auditUserLoginFilter;
}
use of org.jmesa.limit.FilterSet in project OpenClinica by OpenClinica.
the class ListEventsForSubjectTableFactory method getListEventsForSubjectFilter.
protected ListEventsForSubjectFilter getListEventsForSubjectFilter(Limit limit) {
ListEventsForSubjectFilter listEventsForSubjectFilter = new ListEventsForSubjectFilter(selectedStudyEventDefinition.getId());
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() + "";
} else if ("event.status".equalsIgnoreCase(property)) {
value = SubjectEventStatus.getByName(value).getId() + "";
} else if (property.startsWith("sgc_")) {
int studyGroupClassId = property.endsWith("_") ? 0 : Integer.valueOf(property.split("_")[1]);
value = studyGroupDAO.findByNameAndGroupClassID(value, studyGroupClassId).getId() + "";
} else if (property.startsWith("crf_")) {
value = DataEntryStage.getByName(value).getId() + "";
}
listEventsForSubjectFilter.addFilter(property, value);
}
return listEventsForSubjectFilter;
}
use of org.jmesa.limit.FilterSet in project OpenClinica by OpenClinica.
the class ListNotesTableFactory method getListNoteFilter.
/**
* 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.
*/
public ListNotesFilter getListNoteFilter(Limit limit) {
ListNotesFilter listNotesFilter = new ListNotesFilter();
FilterSet filterSet = limit.getFilterSet();
Collection<Filter> filters = filterSet.getFilters();
for (Filter filter : filters) {
String property = filter.getProperty();
String value = filter.getValue();
//Checking if the given date format is valid
if ("discrepancyNoteBean.createdDate".equalsIgnoreCase(property) || "discrepancyNoteBean.updatedDate".equalsIgnoreCase(property)) {
try {
String date = formatDate(new Date(value));
value = date;
} catch (Exception ex) {
value = "01-Jan-1700";
}
} else if ("discrepancyNoteBean.disType".equalsIgnoreCase(property)) {
ResourceBundle reterm = ResourceBundleProvider.getTermsBundle();
if (reterm.getString("Query_and_Failed_Validation_Check").equals(value)) {
value = 31 + "";
} else {
value = DiscrepancyNoteType.getByName(value).getId() + "";
}
} else if ("discrepancyNoteBean.resolutionStatus".equalsIgnoreCase(property)) {
ResourceBundle reterm = ResourceBundleProvider.getTermsBundle();
if (reterm.getString("New_and_Updated").equalsIgnoreCase(value)) {
value = 21 + "";
} else {
value = ResolutionStatus.getByName(value).getId() + "";
}
}
//
listNotesFilter.addFilter(property, value);
}
return listNotesFilter;
}
Aggregations