use of net.jforum.dao.BanlistDAO in project jforum2 by rafaelsteil.
the class BanlistRepository method loadBanlist.
public static void loadBanlist() {
BanlistDAO dao = DataAccessDriver.getInstance().newBanlistDAO();
List banlist = dao.selectAll();
for (Iterator iter = banlist.iterator(); iter.hasNext(); ) {
BanlistRepository.add((Banlist) iter.next());
}
}
use of net.jforum.dao.BanlistDAO in project jforum2 by rafaelsteil.
the class BanlistAction method delete.
public void delete() {
String[] banlist = this.request.getParameterValues("banlist_id");
if (banlist != null && banlist.length > 0) {
BanlistDAO dao = DataAccessDriver.getInstance().newBanlistDAO();
for (int i = 0; i < banlist.length; i++) {
int current = Integer.parseInt(banlist[i]);
dao.delete(current);
BanlistRepository.remove(current);
}
}
this.list();
}
use of net.jforum.dao.BanlistDAO in project jforum2 by rafaelsteil.
the class BanlistAction method insertSave.
public void insertSave() {
String type = this.request.getParameter("type");
String value = this.request.getParameter("value");
if (!StringUtils.isEmpty(type) && !StringUtils.isEmpty(value)) {
Banlist b = new Banlist();
if ("email".equals(type)) {
b.setEmail(value);
} else if ("user".equals(type)) {
b.setUserId(Integer.parseInt(value));
} else if ("ip".equals(type)) {
b.setIp(value);
} else {
throw new ForumException("Unknown banlist type");
}
BanlistDAO dao = DataAccessDriver.getInstance().newBanlistDAO();
dao.insert(b);
BanlistRepository.add(b);
}
this.list();
}
Aggregations