private Smilie getSmilie(ResultSet rs) throws SQLException { Smilie s = new Smilie(); s.setId(rs.getInt("smilie_id")); s.setCode(rs.getString("code")); s.setUrl(rs.getString("url")); s.setDiskName(rs.getString("disk_name")); return s; }
public static List getSmilies() { List list = (List) cache.get(FQN, ENTRIES); if (!contexted) { String forumLink = SystemGlobals.getValue(ConfigKeys.FORUM_LINK); for (Iterator iter = list.iterator(); iter.hasNext(); ) { Smilie s = (Smilie) iter.next(); s.setUrl(s.getUrl().replaceAll("#CONTEXT#", forumLink).replaceAll("\\\\", "")); } cache.add(FQN, ENTRIES, list); contexted = true; } return list; }
/** @see net.jforum.dao.SmilieDAO#update(net.jforum.entities.Smilie) */ public void update(Smilie smilie) { PreparedStatement pstmt = null; try { pstmt = JForumExecutionContext.getConnection() .prepareStatement(SystemGlobals.getSql("SmiliesModel.update")); pstmt.setString(1, smilie.getCode()); pstmt.setString(2, smilie.getUrl()); pstmt.setString(3, smilie.getDiskName()); pstmt.setInt(4, smilie.getId()); pstmt.executeUpdate(); } catch (SQLException e) { throw new DatabaseException(e); } finally { DbUtils.close(pstmt); } }
/** @see net.jforum.dao.SmilieDAO#addNew(net.jforum.entities.Smilie) */ public int addNew(Smilie smilie) { PreparedStatement pstmt = null; try { pstmt = this.getStatementForAutoKeys("SmiliesModel.addNew"); pstmt.setString(1, smilie.getCode()); pstmt.setString(2, smilie.getUrl()); pstmt.setString(3, smilie.getDiskName()); this.setAutoGeneratedKeysQuery(SystemGlobals.getSql("SmiliesModel.lastGeneratedSmilieId")); return this.executeAutoKeysQuery(pstmt); } catch (SQLException e) { throw new DatabaseException(e); } finally { DbUtils.close(pstmt); } }