super.init(cfg);
final ServletContext application = getServletConfig().getServletContext();
final Datastore ds = MongoConnectionHelper.ds;
//Get History Values
final MapReduceHistoryMinMax datesHisotry = ds.find(MapReduceHistoryMinMax.class).get();
if (datesHisotry != null) {
application.setAttribute("history", datesHisotry);
}
final List<Date> datesResult = ds.getDB().getCollection("Meteolog").distinct("time");
application.setAttribute("totRecord", ds.find(Meteolog.class).countAll());
if (datesResult == null || datesResult.isEmpty()) {
application.setAttribute("from", DateTimeUtil.getDate("yyyy-MM-dd", "1970-01-01"));
application.setAttribute("to", DateTimeUtil.getDate("yyyy-MM-dd", "2030-01-01"));
application.setAttribute("lastUpdate", DateTimeUtil.getDate("yyyy-MM-dd", "1970-01-01"));