@Override public void endLoad() throws DaoException { sync(); super.endLoad(); wpDs.optimize(Tables.META_INFO); }
@Override public LanguageSet getLoadedLanguages(Class component) throws DaoException { sync(component); DSLContext context = getJooq(); try { if (!tableExists(context)) { return new LanguageSet(); } Set<Language> langs = new HashSet<Language>(); Result<Record1<Short>> records = context.select(Tables.META_INFO.LANG_ID) .from(Tables.META_INFO) .where(Tables.META_INFO.COMPONENT.eq(component.getSimpleName())) .and(Tables.META_INFO.LANG_ID.isNotNull()) .fetch(); for (Record1<Short> record : records) { langs.add(Language.getById(record.value1())); } return new LanguageSet(langs); } catch (Exception e) { throw new DaoException("Error when getting loaded languages, check if the database exists / has been initialized\n" + e.toString()); } finally { freeJooq(context); } }
@Override public Map<String, MetaInfo> getAllCummulativeInfo() throws DaoException { sync(); DSLContext context = getJooq(); try {
@Override public MetaInfo getInfo(Class component) throws DaoException { sync(component); MetaInfo accumulated = new MetaInfo(component); DSLContext context = getJooq(); try { if (!tableExists(context)) { return accumulated; } Result<Record3<Integer, Integer, Timestamp>> records = context.select(Tables.META_INFO.NUM_RECORDS, Tables.META_INFO.NUM_ERRORS, Tables.META_INFO.LAST_UPDATED) .from(Tables.META_INFO) .where(Tables.META_INFO.COMPONENT.eq(component.getSimpleName())) .fetch(); for (Record3<Integer, Integer, Timestamp> record : records) { MetaInfo info = new MetaInfo(component, null, record.value1(), record.value2(), record.value3()); accumulated.merge(info); } return accumulated; } finally { freeJooq(context); } }