All pastes #252219 Raw Edit

Something

public text v1 · immutable
#252219 ·published 2006-11-19 06:05 UTC
rendered paste body
 public Collection<OnmsOutage> currentOutagesByRange(Integer offset,
	    Integer limit, String orderProperty, String direction) {
        if (offset == null) {
            throw new IllegalArgumentException("argument offset cannot be null");
        }
        if (limit == null) {
            throw new IllegalArgumentException("argument limit cannot be null");
        }
        if (orderProperty == null) {
            throw new IllegalArgumentException("argument orderProperty cannot be null");
        }
        if (direction == null) {
            throw new IllegalArgumentException("argument direction cannot be null");
        }
	OnmsCriteria crit = new OnmsCriteria(OnmsOutage.class);

	Collection<OnmsOutage> outages = new LinkedList<OnmsOutage>();

	//Order order = null;
	//Order.asc(orderProperty);
	crit.add(Restrictions.between("id", offset, limit));
    crit.add(Restrictions.isNull("ifRegainedService"));
    Date now = new Date();
    crit.add(Restrictions.lt("suppressTime", now));
	//crit.addOrder(order);

	outages = findMatching(crit);
    return outages;

    }