@Override public List<String> getRecipesForToday() { String dayOfWeek = getDayAsRegex(); return dsl.select(NEWS_SOURCES.RECIPE_FILE) .from(NEWS_SOURCES) .where(NEWS_SOURCES.CONTENT_DAYS.like(dayOfWeek)) .fetch() .map(x -> x.getValue(0, String.class)); }
@Override public List<MailTask> getMailTasksForToday() { String dayOfWeek = getDayAsRegex(); return dsl.select(NEWS_SOURCES.RECIPE_FILE, USERS.KINDLE_EMAIL) .from( NEWS_SOURCES .join(SUBSCRIPTIONS) .on(SUBSCRIPTIONS.NEWS_SOURCE_ID.eq(NEWS_SOURCES.ID)) .join(USERS) .on(SUBSCRIPTIONS.USER_ID.eq(USERS.ID))) .where(NEWS_SOURCES.CONTENT_DAYS.like(dayOfWeek)) .fetch() .map( x -> new MailTask( x.getValue(USERS.KINDLE_EMAIL, String.class), x.getValue(NEWS_SOURCES.RECIPE_FILE, String.class))); }