public List<UnscheduledEvent> getUnscheduledEventList(Date cutoffTime, int maxRows) throws SQLException {
        StringBuffer query = new StringBuffer();
        query.append("select EVENT_NAME,CREATE_DT,AUXDATA,REFERENCE,COMMENTS ");
        query.append("from EVENT_INSTANCE ");
        query.append("where STATUS_CD = " + EventInstance.STATUS_INTERNAL_EVENT + " ");
        query.append("and CREATE_DT < ? ");
        query.append("and CONSUME_DT is null ");
        if(!db.isMySQL())
            query.append("and ROWNUM <= " + maxRows + " ");
        query.append("order by CREATE_DT");
        if (db.isMySQL())
            query.append(" LIMIT " + maxRows + " ");
        List<UnscheduledEvent> ret = new ArrayList<UnscheduledEvent>();
        ResultSet rs = db.runSelect(query.toString(), cutoffTime);
        while (rs.next()) {
            UnscheduledEvent ue = new UnscheduledEvent();
            ue.setName(rs.getString("EVENT_NAME"));
            ue.setCreateTime(rs.getTimestamp("CREATE_DT"));
            ue.setMessage(rs.getString("AUXDATA"));
            ue.setReference(rs.getString("REFERENCE"));
            if (ue.getMessage() == null)
                ue.setMessage(rs.getString("COMMENTS"));
            ret.add(ue);
        }
        return ret;
    }
public List < UnscheduledEvent > getUnscheduledEventList ( Date cutoffTime , int maxRows ) throws SQLException { StringBuffer query = new StringBuffer ( ) ; query . append ( "select EVENT_NAME,CREATE_DT,AUXDATA,REFERENCE,COMMENTS " ) ; query . append ( "from EVENT_INSTANCE " ) ; query . append ( "where STATUS_CD = " + EventInstance . STATUS_INTERNAL_EVENT + " " ) ; query . append ( "and CREATE_DT < ? " ) ; query . append ( "and CONSUME_DT is null " ) ; if ( ! db . isMySQL ( ) ) query . append ( "and ROWNUM <= " + maxRows + " " ) ; query . append ( "order by CREATE_DT" ) ; if ( db . isMySQL ( ) ) query . append ( " LIMIT " + maxRows + " " ) ; List < UnscheduledEvent > ret = new ArrayList < UnscheduledEvent > ( ) ; ResultSet rs = db . runSelect ( query . toString ( ) , cutoffTime ) ; while ( rs . next ( ) ) { UnscheduledEvent ue = new UnscheduledEvent ( ) ; ue . setName ( rs . getString ( "EVENT_NAME" ) ) ; ue . setCreateTime ( rs . getTimestamp ( "CREATE_DT" ) ) ; ue . setMessage ( rs . getString ( "AUXDATA" ) ) ; ue . setReference ( rs . getString ( "REFERENCE" ) ) ; if ( ue . getMessage ( ) == null ) ue . setMessage ( rs . getString ( "COMMENTS" ) ) ; ret . add ( ue ) ; } return ret ; }
Load all internal events start at the specified age and scheduled jobs before cutoff time.
If cutoff time is null, load only unscheduled events
@param cutoffTime a date or null
@return
@throws SQLException