List of usage examples for org.springframework.jdbc.support.rowset SqlRowSet getTimestamp
Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException;
From source file:ru.org.linux.group.TopicsListItem.java
public TopicsListItem(User author, SqlRowSet rs, int messagesInPage, ImmutableList<String> tags) { this.author = author; this.tags = tags; subj = StringUtil.makeTitle(rs.getString("subj")); Timestamp lastmod = rs.getTimestamp("lastmod"); if (lastmod == null) { this.lastmod = new Timestamp(0); } else {/*www. jav a 2 s. com*/ this.lastmod = lastmod; } msgid = rs.getInt("msgid"); deleted = rs.getBoolean("deleted"); stat1 = rs.getInt("stat1"); stat3 = rs.getInt("stat3"); stat4 = rs.getInt("stat4"); sticky = rs.getBoolean("sticky"); resolved = rs.getBoolean("resolved"); pages = Topic.getPageCount(stat1, messagesInPage); }
From source file:org.jasig.cas.ticket.registry.support.JdbcLockingStrategy.java
/** * Determines whether this instance can acquire the lock. * * @param lockRow Row of lock data for this application ID. * * @return True if lock can be acquired, false otherwise. *//*w ww . j ava 2s. co m*/ private boolean canAcquire(final SqlRowSet lockRow) { if (lockRow.getString(this.uniqueIdColumnName) != null) { final Calendar expCal = Calendar.getInstance(); expCal.setTime(lockRow.getTimestamp(this.expirationDateColumnName)); return Calendar.getInstance().after(expCal); } return true; }
From source file:ru.org.linux.tracker.TrackerDao.java
public List<TrackerItem> getTrackAll(TrackerFilterEnum filter, User currentUser, Timestamp interval, int topics, int offset, final int messagesInPage) { MapSqlParameterSource parameter = new MapSqlParameterSource(); parameter.addValue("interval", interval); parameter.addValue("topics", topics); parameter.addValue("offset", offset); String partIgnored;//from ww w . jav a 2 s. c o m if (currentUser != null) { partIgnored = queryPartIgnored + queryPartTagIgnored; parameter.addValue("userid", currentUser.getId()); } else { partIgnored = ""; } String partFilter; String partWiki = queryPartWiki; switch (filter) { case ALL: partFilter = ""; break; case NOTALKS: partFilter = queryPartNoTalks; break; case TECH: partFilter = queryPartTech; break; case MINE: if (currentUser != null) { partFilter = queryPartMine; partWiki = queryPartWikiMine; } else { partFilter = ""; } break; default: partFilter = ""; } boolean showUncommited = currentUser != null && (currentUser.isModerator() || currentUser.isCorrector()); String partUncommited = showUncommited ? "" : noUncommited; String query; if (filter != TrackerFilterEnum.ZERO) { query = String.format(queryTrackerMain, partUncommited, partIgnored, partFilter, partUncommited, partIgnored, partFilter, partWiki); } else { query = String.format(queryTrackerZeroMain, partIgnored); } SqlRowSet resultSet = jdbcTemplate.queryForRowSet(query, parameter); List<TrackerItem> res = new ArrayList<>(topics); while (resultSet.next()) { User author; try { int author_id = resultSet.getInt("author"); if (author_id != 0) { author = userDao.getUserCached(author_id); } else { author = null; } } catch (UserNotFoundException e) { throw new RuntimeException(e); } int msgid = resultSet.getInt("id"); Timestamp lastmod = resultSet.getTimestamp("lastmod"); int stat1 = resultSet.getInt("stat1"); int groupId = resultSet.getInt("gid"); String groupTitle = resultSet.getString("gtitle"); String title = resultSet.getString("title"); int cid = resultSet.getInt("cid"); User lastCommentBy; try { int id = resultSet.getInt("last_comment_by"); if (id != 0) { lastCommentBy = userDao.getUserCached(id); } else { lastCommentBy = null; } } catch (UserNotFoundException e) { throw new RuntimeException(e); } boolean resolved = resultSet.getBoolean("resolved"); int section = resultSet.getInt("section"); String groupUrlName = resultSet.getString("urlname"); Timestamp postdate = resultSet.getTimestamp("postdate"); boolean uncommited = resultSet.getBoolean("smod") && !resultSet.getBoolean("moderate"); int pages = Topic.getPageCount(stat1, messagesInPage); ImmutableList<String> tags; if (msgid != 0) { tags = topicTagService.getMessageTagsForTitle(msgid); } else { tags = ImmutableList.of(); } res.add(new TrackerItem(author, msgid, lastmod, stat1, groupId, groupTitle, title, cid, lastCommentBy, resolved, section, groupUrlName, postdate, uncommited, pages, tags)); } return res; }