Search in sources :

Example 1 with StatisticsEnum

use of org.orcid.core.utils.statistics.StatisticsEnum in project ORCID-Source by ORCID.

the class StatisticsCacheManagerImpl method setLatestStatisticsTimeline.

@Override
public synchronized void setLatestStatisticsTimeline() {
    LOG.info("Getting the latest statistics timeline map");
    Map<StatisticsEnum, StatisticsTimeline> latestStatisticsTimelineMap = new HashMap<StatisticsEnum, StatisticsTimeline>();
    for (StatisticsEnum type : StatisticsEnum.values()) {
        StatisticsTimeline statisticsTimeline = statisticsManagerReadOnly.getStatisticsTimelineModel(type);
        latestStatisticsTimelineMap.put(type, statisticsTimeline);
    }
    if (statisticsCache.get(CACHE_TIMELINE_KEY) == null) {
        statisticsCache.put(new Element(CACHE_TIMELINE_KEY, latestStatisticsTimelineMap));
    } else {
        statisticsCache.replace(new Element(CACHE_TIMELINE_KEY, latestStatisticsTimelineMap));
    }
}
Also used : HashMap(java.util.HashMap) StatisticsEnum(org.orcid.core.utils.statistics.StatisticsEnum) Element(net.sf.ehcache.Element) StatisticsTimeline(org.orcid.jaxb.model.statistics.StatisticsTimeline)

Aggregations

HashMap (java.util.HashMap)1 Element (net.sf.ehcache.Element)1 StatisticsEnum (org.orcid.core.utils.statistics.StatisticsEnum)1 StatisticsTimeline (org.orcid.jaxb.model.statistics.StatisticsTimeline)1