use of net.jforum.dao.ConfigDAO in project jforum2 by rafaelsteil.
the class ForumRepository method updateMostUsersEverOnline.
/**
* Update the value of most online users ever.
*
* @param m MostUsersEverOnline The new value to store. Generally it
* will be a bigger one.
*/
public static void updateMostUsersEverOnline(MostUsersEverOnline m) {
ConfigDAO cm = DataAccessDriver.getInstance().newConfigDAO();
Config config = cm.selectByName(ConfigKeys.MOST_USERS_EVER_ONLINE);
if (config == null) {
// Total
config = new Config();
config.setName(ConfigKeys.MOST_USERS_EVER_ONLINE);
config.setValue(Integer.toString(m.getTotal()));
cm.insert(config);
// Date
config.setName(ConfigKeys.MOST_USER_EVER_ONLINE_DATE);
config.setValue(Long.toString(m.getTimeInMillis()));
cm.insert(config);
} else {
// Total
config.setValue(Integer.toString(m.getTotal()));
cm.update(config);
// Date
config.setName(ConfigKeys.MOST_USER_EVER_ONLINE_DATE);
config.setValue(Long.toString(m.getTimeInMillis()));
cm.update(config);
}
cache.add(FQN, MOST_USERS_ONLINE, m);
}
use of net.jforum.dao.ConfigDAO in project jforum2 by rafaelsteil.
the class ForumStartup method startForumRepository.
/**
* Starts the cache control for forums and categories.
* @throws RepositoryStartupException is something were wrong.
*/
public static void startForumRepository() {
try {
ForumDAO fm = DataAccessDriver.getInstance().newForumDAO();
CategoryDAO cm = DataAccessDriver.getInstance().newCategoryDAO();
ConfigDAO configModel = DataAccessDriver.getInstance().newConfigDAO();
ForumRepository.start(fm, cm, configModel);
} catch (Exception e) {
log.error("Unable to bootstrap JForum repository.", e);
throw new RepositoryStartupException("Error while trying to start ForumRepository: " + e, e);
}
}
Aggregations