/** * Build a LocalPage from a database record representation. * Classes that extend class this should override this method. * * @param record a database record * @return a LocalPage representation of the given database record * @throws DaoException if the record is not a Page */ protected LocalPage buildLocalPage(Record record) throws DaoException { return buildLocalPage(record, new DaoFilter()); }
@Override public LocalPage transform(Record r) { try { return buildLocalPage(r, daoFilter); } catch (DaoException e) { LOG.warn(e.getMessage(), e); return null; } } };
@Override public LocalPage getById(Language language, int pageId) throws DaoException { DSLContext context = getJooq(); try { Record record = context.select(). from(Tables.LOCAL_PAGE). where(Tables.LOCAL_PAGE.PAGE_ID.eq(pageId)). and(Tables.LOCAL_PAGE.LANG_ID.eq(language.getId())). limit(1). fetchOne(); return buildLocalPage(record); } finally { freeJooq(context); } }
@Override public LocalPage getByTitle(Title title, NameSpace nameSpace) throws DaoException { DSLContext context = getJooq(); try { Record record = context.select(). from(Tables.LOCAL_PAGE). where(Tables.LOCAL_PAGE.TITLE.eq(title.getCanonicalTitle())). and(Tables.LOCAL_PAGE.LANG_ID.eq(title.getLanguage().getId())). and(Tables.LOCAL_PAGE.NAME_SPACE.eq(nameSpace.getArbitraryId())). limit(1). fetchOne(); return buildLocalPage(record); } finally { freeJooq(context); } }