예제 #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;
  }
예제 #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;
  }
예제 #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;
  }
예제 #4
0
 /** 分页查询: Conf */
 @Transactional(readOnly = true)
 public Page<Conf> findPage(ConfQuery query) {
   Assert.notNull(query, "'query' must be not null");
   return confDao.findPage(query);
 }
예제 #5
0
 /** 根据ID得到Conf */
 public Conf getById(String confGroup, String confKey) {
   return confDao.getById(confGroup, confKey);
 }
예제 #6
0
 /** 删除Conf */
 public void removeById(String confGroup, String confKey) {
   cache.clear();
   confDao.deleteById(confGroup, confKey);
 }
예제 #7
0
 @Override
 public List<String> findAllGroup() {
   return confDao.findAllGroup();
 }