Search in sources :

Example 6 with Ranking

use of net.jforum.entities.Ranking in project jforum2 by rafaelsteil.

the class GenericRankingDAO method selectAll.

/**
	 * @see net.jforum.dao.RankingDAO#selectAll()
	 */
public List selectAll() {
    List l = new ArrayList();
    PreparedStatement p = null;
    ResultSet rs = null;
    try {
        p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("RankingModel.selectAll"));
        rs = p.executeQuery();
        while (rs.next()) {
            Ranking ranking = buildRanking(rs);
            l.add(ranking);
        }
        return l;
    } catch (SQLException e) {
        throw new DatabaseException(e);
    } finally {
        DbUtils.close(rs, p);
    }
}
Also used : Ranking(net.jforum.entities.Ranking) SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) List(java.util.List) ArrayList(java.util.ArrayList) PreparedStatement(java.sql.PreparedStatement) DatabaseException(net.jforum.exceptions.DatabaseException)

Example 7 with Ranking

use of net.jforum.entities.Ranking in project jforum2 by rafaelsteil.

the class GenericRankingDAO method selectSpecials.

public List selectSpecials() {
    List l = new ArrayList();
    PreparedStatement p = null;
    ResultSet rs = null;
    try {
        p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("RankingModel.selectSpecials"));
        rs = p.executeQuery();
        while (rs.next()) {
            Ranking ranking = this.buildRanking(rs);
            l.add(ranking);
        }
    } catch (SQLException e) {
        throw new DatabaseException(e);
    } finally {
        DbUtils.close(rs, p);
    }
    return l;
}
Also used : Ranking(net.jforum.entities.Ranking) SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) List(java.util.List) ArrayList(java.util.ArrayList) PreparedStatement(java.sql.PreparedStatement) DatabaseException(net.jforum.exceptions.DatabaseException)

Example 8 with Ranking

use of net.jforum.entities.Ranking in project jforum2 by rafaelsteil.

the class RankingAction method insertSave.

// A new one
public void insertSave() {
    Ranking r = new Ranking();
    r.setTitle(this.request.getParameter("rank_title"));
    boolean special = "1".equals(this.request.getParameter("rank_special"));
    r.setSpecial(special);
    if (!special) {
        r.setMin(this.request.getIntParameter("rank_min"));
    }
    DataAccessDriver.getInstance().newRankingDAO().addNew(r);
    RankingRepository.loadRanks();
    this.list();
}
Also used : Ranking(net.jforum.entities.Ranking)

Aggregations

Ranking (net.jforum.entities.Ranking)8 List (java.util.List)4 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 DatabaseException (net.jforum.exceptions.DatabaseException)3 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)1