예제 #1
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);
  }
예제 #2
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);
      }
    }
  }