Exemple #1
0
  /** 更新Conf */
  public Conf update(Conf conf) {
    cache.clear();
    Assert.notNull(conf, "'conf' must be not null");
    trimConf(conf);

    new ConfChecker().checkUpdateConf(conf);
    confDao.update(conf);
    return conf;
  }
Exemple #2
0
  /** 创建Conf */
  public Conf create(Conf conf) {
    cache.clear();
    Assert.notNull(conf, "'conf' must be not null");
    trimConf(conf);
    initDefaultValuesForCreate(conf);
    new ConfChecker().checkCreateConf(conf);

    confDao.insert(conf);
    return conf;
  }
Exemple #3
0
  private synchronized Properties getByGroup0(String confGroup) {
    ConfQuery query = new ConfQuery();
    query.setConfGroup(confGroup);
    List<Conf> confList = confDao.findByGroup(confGroup);

    Properties props = new Properties();
    for (Conf conf : confList) {
      String key = conf.getConfKey();
      String value = conf.getConfValue();
      if (StringUtils.isBlank(value)) {
        value = conf.getConfDefaultValue();
      }
      if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(value)) props.put(key, value);
    }
    return props;
  }
Exemple #4
0
 /** 分页查询: Conf */
 @Transactional(readOnly = true)
 public Page<Conf> findPage(ConfQuery query) {
   Assert.notNull(query, "'query' must be not null");
   return confDao.findPage(query);
 }
Exemple #5
0
 /** 根据ID得到Conf */
 public Conf getById(String confGroup, String confKey) {
   return confDao.getById(confGroup, confKey);
 }
Exemple #6
0
 /** 删除Conf */
 public void removeById(String confGroup, String confKey) {
   cache.clear();
   confDao.deleteById(confGroup, confKey);
 }
Exemple #7
0
 @Override
 public List<String> findAllGroup() {
   return confDao.findAllGroup();
 }