Search in sources :

Example 1 with LangDOM

use of com.agiletec.aps.system.services.lang.LangDOM in project entando-core by entando.

the class LangManagerCacheWrapper method initCache.

@Override
public void initCache(String xmlConfig) throws ApsSystemException {
    try {
        Cache cache = this.getCache();
        this.releaseCachedObjects(cache);
        LangDOM langDom = new LangDOM(xmlConfig);
        Map<String, Lang> langMap = new HashMap<>();
        List<Lang> systemLangs = langDom.getLangs();
        for (Lang lang : systemLangs) {
            if (lang.isDefault()) {
                cache.put(LANG_DEFAULT_CACHE_NAME, lang);
            }
            langMap.put(lang.getCode(), lang);
        }
        super.insertObjectsOnCache(cache, langMap);
    } catch (Throwable t) {
        logger.error("Error loading the system langs", t);
        throw new ApsSystemException("Error loading the system langs", t);
    }
}
Also used : HashMap(java.util.HashMap) LangDOM(com.agiletec.aps.system.services.lang.LangDOM) Lang(com.agiletec.aps.system.services.lang.Lang) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) Cache(org.springframework.cache.Cache)

Aggregations

ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)1 Lang (com.agiletec.aps.system.services.lang.Lang)1 LangDOM (com.agiletec.aps.system.services.lang.LangDOM)1 HashMap (java.util.HashMap)1 Cache (org.springframework.cache.Cache)1