Search in sources :

Example 1 with SmilieDAO

use of net.jforum.dao.SmilieDAO in project jforum2 by rafaelsteil.

the class SmiliesAction method delete.

public void delete() {
    String[] ids = this.request.getParameterValues("id");
    if (ids != null) {
        SmilieDAO dao = DataAccessDriver.getInstance().newSmilieDAO();
        for (int i = 0; i < ids.length; i++) {
            int id = Integer.parseInt(ids[i]);
            Smilie s = dao.selectById(id);
            dao.delete(id);
            File smilieFile = new File(s.getDiskName());
            File fileToDelete = new File(SystemGlobals.getApplicationPath() + "/" + SystemGlobals.getValue(ConfigKeys.SMILIE_IMAGE_DIR) + "/" + smilieFile.getName());
            if (fileToDelete.exists()) {
                fileToDelete.delete();
            }
        }
    }
    SmiliesRepository.loadSmilies();
    this.list();
}
Also used : SmilieDAO(net.jforum.dao.SmilieDAO) Smilie(net.jforum.entities.Smilie) File(java.io.File)

Aggregations

File (java.io.File)1 SmilieDAO (net.jforum.dao.SmilieDAO)1 Smilie (net.jforum.entities.Smilie)1