Search in sources :

Example 1 with Config

use of com.publiccms.common.api.Config in project PublicCMS-preview by sanluan.

the class ConfigComponent method getConfigList.

/**
 * @param site
 * @param locale
 * @return config list
 */
public List<ConfigInfo> getConfigList(SysSite site, Locale locale) {
    List<ConfigInfo> configList = new ArrayList<>();
    List<String> configCodeList = new ArrayList<>();
    if (CommonUtils.notEmpty(configPluginList)) {
        for (Config config : configPluginList) {
            String code = config.getCode(site);
            if (!configCodeList.contains(code)) {
                configList.add(new ConfigInfo(config.getCode(site), config.getCodeDescription(site, locale)));
                configCodeList.add(code);
            }
        }
    }
    for (Entry<String, SysConfig> entry : getMap(site).entrySet()) {
        if (!configCodeList.contains(entry.getKey())) {
            ConfigInfo configInfo = new ConfigInfo(entry.getKey(), entry.getValue().getDescription());
            configInfo.setCustomed(true);
            configList.add(configInfo);
            configCodeList.add(entry.getKey());
        }
    }
    return configList;
}
Also used : SysConfig(com.publiccms.views.pojo.entities.SysConfig) Config(com.publiccms.common.api.Config) SysConfig(com.publiccms.views.pojo.entities.SysConfig) ArrayList(java.util.ArrayList)

Example 2 with Config

use of com.publiccms.common.api.Config in project PublicCMS-preview by sanluan.

the class ConfigComponent method getConfig.

/**
 * @param site
 * @param code
 * @param locale
 * @return config
 */
public ConfigInfo getConfig(SysSite site, String code, Locale locale) {
    Map<String, SysConfig> map = getMap(site);
    SysConfig entity = map.get(code);
    ConfigInfo configInfo = null;
    if (null != entity) {
        configInfo = new ConfigInfo(entity.getCode(), entity.getDescription());
        configInfo.setCustomed(true);
    }
    if (CommonUtils.notEmpty(configPluginList)) {
        for (Config configPlugin : configPluginList) {
            if (configPlugin.getCode(site).equals(code)) {
                configInfo = new ConfigInfo(code, configPlugin.getCodeDescription(site, locale));
            }
        }
    }
    return configInfo;
}
Also used : SysConfig(com.publiccms.views.pojo.entities.SysConfig) Config(com.publiccms.common.api.Config) SysConfig(com.publiccms.views.pojo.entities.SysConfig)

Aggregations

Config (com.publiccms.common.api.Config)2 SysConfig (com.publiccms.views.pojo.entities.SysConfig)2 ArrayList (java.util.ArrayList)1