Search in sources :

Example 1 with IActivityStreamSearchBean

use of org.entando.entando.aps.system.services.actionlog.model.IActivityStreamSearchBean in project entando-core by entando.

the class ActionLogDAO method createFilters.

protected FieldSearchFilter[] createFilters(IActionLogRecordSearchBean searchBean) {
    FieldSearchFilter[] filters = new FieldSearchFilter[0];
    if (null != searchBean) {
        String username = searchBean.getUsername();
        if (null != username && username.trim().length() > 0) {
            FieldSearchFilter filter = new FieldSearchFilter("username", this.extractSearchValues(username), true);
            filters = super.addFilter(filters, filter);
        }
        String namespace = searchBean.getNamespace();
        if (null != namespace && namespace.trim().length() > 0) {
            FieldSearchFilter filter = new FieldSearchFilter("namespace", this.extractSearchValues(namespace), true);
            filters = super.addFilter(filters, filter);
        }
        String actionName = searchBean.getActionName();
        if (null != actionName && actionName.trim().length() > 0) {
            FieldSearchFilter filter = new FieldSearchFilter("actionname", this.extractSearchValues(actionName), true);
            filters = super.addFilter(filters, filter);
        }
        String parameters = searchBean.getParams();
        if (null != parameters && parameters.trim().length() > 0) {
            FieldSearchFilter filter = new FieldSearchFilter("parameters", this.extractSearchValues(parameters), true);
            filters = super.addFilter(filters, filter);
        }
        Date startCreation = searchBean.getStartCreation();
        Date endCreation = searchBean.getEndCreation();
        if (null != startCreation || null != endCreation) {
            Timestamp tsStart = (null != startCreation) ? new Timestamp(startCreation.getTime()) : null;
            Timestamp tsEnd = (null != endCreation) ? new Timestamp(endCreation.getTime()) : null;
            FieldSearchFilter filter = new FieldSearchFilter("actiondate", tsStart, tsEnd);
            filter.setOrder(FieldSearchFilter.Order.DESC);
            filters = super.addFilter(filters, filter);
        }
        Date startUpdate = searchBean.getStartUpdate();
        Date endUpdate = searchBean.getEndUpdate();
        if (null != startUpdate || null != endUpdate) {
            Timestamp tsStart = (null != startUpdate) ? new Timestamp(startUpdate.getTime()) : null;
            Timestamp tsEnd = (null != endUpdate) ? new Timestamp(endUpdate.getTime()) : null;
            FieldSearchFilter filter = new FieldSearchFilter("updatedate", tsStart, tsEnd);
            filter.setOrder(FieldSearchFilter.Order.DESC);
            filters = super.addFilter(filters, filter);
        }
        if (searchBean instanceof IActivityStreamSearchBean) {
            FieldSearchFilter filter = new FieldSearchFilter("activitystreaminfo");
            filters = super.addFilter(filters, filter);
        }
    }
    return filters;
}
Also used : IActivityStreamSearchBean(org.entando.entando.aps.system.services.actionlog.model.IActivityStreamSearchBean) FieldSearchFilter(com.agiletec.aps.system.common.FieldSearchFilter) Timestamp(java.sql.Timestamp) Date(java.util.Date)

Aggregations

FieldSearchFilter (com.agiletec.aps.system.common.FieldSearchFilter)1 Timestamp (java.sql.Timestamp)1 Date (java.util.Date)1 IActivityStreamSearchBean (org.entando.entando.aps.system.services.actionlog.model.IActivityStreamSearchBean)1