@Override public List<Event> getEvents(ContentSource contentSource, int pageSize) { JdbcTemplate select = new JdbcTemplate(dataSource); return select.query( "select id, title, description, island, location, content_source_id, url, start_datetime, end_datetime from event where content_source_id = ? order by start_datetime desc limit 0,?", new Object[] {contentSource.getId(), pageSize}, new EventRowMapper()); }
@Override public List<Talk> getTalks(ContentSource contentSource) { JdbcTemplate select = new JdbcTemplate(dataSource); return select.query( "select id, name, description, type, event_name, city, country, content_source_id, url, talk_date, slides_url, video_url from talk where content_source_id = ? order by talk_date desc", new Object[] {contentSource.getId()}, new TalkRowMapper()); }
@Override public long getNumberOfEvents(ContentSource contentSource, Date start, Date end) { JdbcTemplate select = new JdbcTemplate(dataSource); return select.queryForLong( "select count(*) from event where content_source_id = ? and start_datetime between ? and ?", contentSource.getId(), start, end); }
@Override public List<Job> getRecentJobs( ContentSource contentSource, int pageSize, boolean includeExpiredJobs) { try { List<Job> jobs = jobDao.getRecentJobs(contentSource, pageSize, includeExpiredJobs); filterAndEnrich(jobs); return jobs; } catch (Exception e) { JobException jce = new JobException( "Error getting recent jobs for content source with ID " + contentSource.getId(), e); logError(jce); throw jce; } }
@Override public long getNumberOfEvents(ContentSource contentSource, Date start, Date end) { try { return eventDao.getNumberOfEvents(contentSource, start, end); } catch (Exception e) { EventException ee = new EventException( "Error getting number of events for content source with ID " + contentSource.getId() + " between " + start + " and " + end, e); logError(ee); throw ee; } }