private void buildRecord(ResultSet rs) throws SQLException { userId = rs.getInt("user_id"); linkModuleId = DatabaseUtils.getInt(rs, "link_module_id"); linkItemId = DatabaseUtils.getInt(rs, "link_item_id"); tag = rs.getString("tag"); tagDate = rs.getTimestamp("tag_date"); }
public boolean insert(Connection db) throws SQLException { StringBuffer sql = new StringBuffer(); sql.append("INSERT INTO project_msg_recipients (message_id, contact_id, "); if (id > -1) { sql.append("recipient_id, "); } sql.append("status_id, status, entered, enteredby) VALUES (?, ?, "); if (id > -1) { sql.append("?, "); } sql.append("?, ?, ?, ?) "); int i = 0; PreparedStatement pst = db.prepareStatement(sql.toString()); pst.setInt(++i, messageId); pst.setInt(++i, contactId); if (id > -1) { pst.setInt(++i, id); } pst.setInt(++i, statusId); pst.setString(++i, status); pst.setTimestamp(++i, entered); pst.setInt(++i, enteredBy); pst.execute(); pst.close(); id = DatabaseUtils.getCurrVal(db, "project_msg_recipients_recipient_id_seq", id); return true; }
public String doView(RenderRequest request, RenderResponse response) throws Exception { // The JSP to show upon success String defaultView = VIEW_PAGE; // Determine the project container to use Project project = findProject(request); // Check the user's permissions User user = PortalUtils.getUser(request); if (!ProjectUtils.hasAccess(project.getId(), user, "project-wiki-view")) { throw new PortletException("Unauthorized to view in this project"); } // Load the records Connection db = useConnection(request); WikiList wikiList = new WikiList(); wikiList.setProjectId(project.getId()); PagedListInfo pagedList = new PagedListInfo(); pagedList.setColumnToSortBy(DatabaseUtils.toLowerCase(db, "w.subject")); pagedList.setItemsPerPage(-1); wikiList.setPagedListInfo(pagedList); wikiList.buildList(db); request.setAttribute(WIKI_LIST, wikiList); // JSP view return defaultView; }
/** * Description of the Method * * @param db Description of the Parameter * @return Description of the Return Value * @throws SQLException Description of the Exception */ public boolean insert(Connection db) throws SQLException { if (!isValid()) { return false; } Exception errorMessage = null; boolean commit = db.getAutoCommit(); try { if (commit) { db.setAutoCommit(false); } StringBuffer sql = new StringBuffer(); sql.append( " INSERT INTO user_tag_log ( " + " user_id ," + " link_module_id , " + " link_item_id , " + " tag )" + " VALUES ( ?, ?, ?, ? ) "); int i = 0; PreparedStatement pst = db.prepareStatement(sql.toString()); DatabaseUtils.setInt(pst, ++i, userId); DatabaseUtils.setInt(pst, ++i, linkModuleId); DatabaseUtils.setInt(pst, ++i, linkItemId); pst.setString(++i, tag.trim().toLowerCase()); pst.execute(); } catch (Exception e) { errorMessage = e; if (commit) { db.rollback(); } } finally { if (commit) { db.setAutoCommit(true); } } if (errorMessage != null) { throw new SQLException(errorMessage.getMessage()); } return true; }
public void buildRecord(ResultSet rs) throws SQLException { id = rs.getInt("recipient_id"); messageId = rs.getInt("message_id"); contactId = rs.getInt("contact_id"); statusId = DatabaseUtils.getInt(rs, "status_id", 0); status = rs.getString("status"); entered = rs.getTimestamp("entered"); enteredBy = rs.getInt("enteredby"); // contact fields firstName = rs.getString("first_name"); lastName = rs.getString("last_name"); }
/** @param tagDate the tagDate to set */ public void setTagDate(String tagDate) { this.tagDate = DatabaseUtils.parseDateToTimestamp(tagDate); }
/** * Sets the value attribute of the HtmlSelectTime object * * @param tmp The new value value */ public void setValue(String tmp) { this.setValue(DatabaseUtils.parseTimestamp(tmp)); }
public void setEntered(String entered) { this.entered = DatabaseUtils.parseTimestamp(entered); }