class DBAlertManager extends DBManager<Alert> implements AlertManager {

    @Override
    @SuppressWarnings("checkstyle:parameternumber")
    public final FilteredRecordsList<Alert> getOrderedAlertList(
            final String reportId, final String columnToOrder, final boolean ascending,
            final int firstResult, final int maxResults, final String search,
            final AlertListType listType,
            final Map<String, Boolean> searchableColumns, final Date beginDate, final Date endDate)
            throws AlertManagerException {

        if (columnToOrder == null) {
            LOGGER.debug("null object argument");
            throw new NullPointerException("object");
        }

        // verify that the report ID is a legit UUID
        if (StringUtils.isNotEmpty(reportId)) {
            try {
                UUID.fromString(reportId);
            } catch (IllegalArgumentException iae) {
                throw new AlertManagerException(reportId + " is not a valid UUID", iae);
            }
        }

        final FilteredRecordsList<Alert> alerts;

        // check that the alert is not archived and that it is in the specified report
        CriteriaModifier modifier = new CriteriaModifier() {
            @Override
            public void modify(final Criteria criteria) {
                if (listType == AlertListType.RESOLVED_ALERTS) {
                    criteria.add(Restrictions.isNotNull("archivedTime"));
                } else {
                    criteria.add(Restrictions.isNull("archivedTime"));
                }

                // filter by date, if specified
                if (null != beginDate) {
                    criteria.add(Restrictions.ge("createTime", beginDate));
                }

                if (null != endDate) {
                    criteria.add(Restrictions.le("createTime", endDate));
                }

                if (StringUtils.isNotEmpty(reportId)) {
                    // creating a separate criteria associated with the report field is necessary
                    // for this to work in HSQL and MySQL to avoid column ambiguity.
                    Criteria reportCriteria = criteria.createCriteria("report");
                    reportCriteria.add(Restrictions.eq("id", UUID.fromString(reportId)));
                }
            }
        };

        try {
            LOGGER.debug("querying db for alerts");
            alerts = super.getOrderedList(Alert.class, columnToOrder, ascending, firstResult,
                    maxResults, search, searchableColumns, modifier);
        } catch (DBManagerException e) {
            throw new AlertManagerException(e);
        }
        return alerts;
    }

    public  DBAlertManager(final SessionFactory factory);

}