Пример #1
0
  /**
   * 删除制定索引
   *
   * @param indexName
   */
  @Transactional
  public void deleteIndex(String indexName) {
    if (StringUtils.isBlank(indexName)) return;

    GmIndex index = dao.getByIndexName(indexName);
    if (index != null) dao.delete(index);
  }
Пример #2
0
  /**
   * 保存索引
   *
   * @param indexFile
   */
  @Transactional
  public void save(String indexName, String clause) {
    if (!checkIndexValueValid(indexName, clause)) return;

    GmIndex oldIndex = dao.getByIndexName(indexName);
    if (oldIndex != null && oldIndex.getIndexClause() != null) {
      if (oldIndex.getIndexClause().trim().equals(clause.trim())) return;
    }

    GmIndex gmIndex = new GmIndex();
    gmIndex.setIndexName(indexName);
    gmIndex.setIndexClause(clause);
    gmIndex.setUpload_time(new Date());
    dao.save(gmIndex);
  }
Пример #3
0
  /**
   * 保存索引
   *
   * @param indexFile
   */
  @Transactional
  public void save(GmIndex gmIndex) {

    if (!checkIndexValueValid(gmIndex.getIndexName(), gmIndex.getIndexClause())) return;

    GmIndex oldIndex = dao.getByIndexName(gmIndex.getIndexName());
    if (oldIndex != null
        && oldIndex.getIndexClause() != null
        && oldIndex.getIndexClause().equals(gmIndex.getIndexClause().trim())) return;

    if (gmIndex != null) {
      GmIndex old = dao.getByIndexName(gmIndex.getIndexName());
      if (old != null) {
        dao.save(gmIndex);
      }
    }
  }
Пример #4
0
  public boolean checkIndexExists(String indexName) {
    boolean result = false;
    if (dao.getByIndexName(indexName) != null) {
      result = true;
    }

    return result;
  }
Пример #5
0
 /**
  * find all index count
  *
  * @return
  */
 public int getAllIndexCount() {
   return dao.findAll().size();
 }
Пример #6
0
 /**
  * 获取所有index索引文件列表
  *
  * @param indexName
  * @return
  */
 public List<GmIndex> getAllIndexs() {
   List<GmIndex> indexList = dao.findAll();
   return indexList;
 }
Пример #7
0
 /** 清空表 */
 public void deleteAllIndex() {
   dao.deleteAll();
 }