Search in sources :

Example 1 with ActionType

use of org.akaza.openclinica.domain.rule.action.ActionType in project OpenClinica by OpenClinica.

the class ViewRuleAssignmentTableFactory method getViewRuleAssignmentFilter.

/**
     * 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 ViewRuleAssignmentFilter getViewRuleAssignmentFilter(Limit limit) {
    ViewRuleAssignmentFilter viewRuleAssignmentFilter = new ViewRuleAssignmentFilter();
    FilterSet filterSet = limit.getFilterSet();
    Collection<Filter> filters = filterSet.getFilters();
    for (Filter filter : filters) {
        String property = filter.getProperty();
        String value = filter.getValue();
        if ("ruleSetRuleStatus".equals(property)) {
            Status s = Status.getByI18nDescription(value, locale);
            int code = s != null ? s.getCode() : -1;
            value = code > 0 ? Status.getByCode(code).getCode() + "" : "0";
        } else if ("actionType".equals(property)) {
            ActionType a = ActionType.getByDescription(value);
            value = a != null ? a.getCode() + "" : value;
        }
        viewRuleAssignmentFilter.addFilter(property, value);
    }
    return viewRuleAssignmentFilter;
}
Also used : Status(org.akaza.openclinica.domain.Status) LoginStatus(org.akaza.openclinica.domain.technicaladmin.LoginStatus) FilterSet(org.jmesa.limit.FilterSet) ActionType(org.akaza.openclinica.domain.rule.action.ActionType) Filter(org.jmesa.limit.Filter) ViewRuleAssignmentFilter(org.akaza.openclinica.dao.hibernate.ViewRuleAssignmentFilter) ViewRuleAssignmentFilter(org.akaza.openclinica.dao.hibernate.ViewRuleAssignmentFilter)

Aggregations

ViewRuleAssignmentFilter (org.akaza.openclinica.dao.hibernate.ViewRuleAssignmentFilter)1 Status (org.akaza.openclinica.domain.Status)1 ActionType (org.akaza.openclinica.domain.rule.action.ActionType)1 LoginStatus (org.akaza.openclinica.domain.technicaladmin.LoginStatus)1 Filter (org.jmesa.limit.Filter)1 FilterSet (org.jmesa.limit.FilterSet)1