@Override public List<Event> getEventsByYear(int year) { try { List<Event> events = eventDao.getEventsByYear(year); filterAndEnrich(events); return events; } catch (Exception e) { EventException ee = new EventException("Error getting events for year " + year, e); logError(ee); throw ee; } }
@Override public List<Event> getFutureEvents(int pageSize) { try { List<Event> events = eventDao.getFutureEvents(pageSize); filterAndEnrich(events); return events; } catch (Exception e) { EventException ee = new EventException("Error getting future events", e); logError(ee); throw ee; } }
@Override public List<Event> getEvents(ContentSource contentSource, int pageSize) { try { List<Event> events = eventDao.getEvents(contentSource, pageSize); filterAndEnrich(events); return events; } catch (Exception e) { EventException ee = new EventException("Error getting events for content source with ID " + contentSource, e); logError(ee); throw ee; } }
@Override public List<Event> getEventsByMonth(int year, int month) { try { List<Event> events = eventDao.getEventsByMonth(year, month); filterAndEnrich(events); return events; } catch (Exception e) { EventException ee = new EventException("Error getting events for month " + year + "/" + month, e); logError(ee); throw ee; } }
@Override public Event getEvent(int id) { try { List<Event> events = new LinkedList<>(); Event event = eventDao.getEvent(id); events.add(event); filterAndEnrich(events); return event; } catch (Exception e) { EventException ee = new EventException("Error getting event with ID " + id, e); logError(ee); throw ee; } }
@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; } }