예제 #1
0
  @Transactional(readOnly = true)
  public int delete(Article article) {
    Assert.notNull(article);

    int deleteCount = 0;
    for (int pageNumber = 1; pageNumber <= article.getTotalPages() + 1000; pageNumber++) {
      article.setPageNumber(pageNumber);
      int count = delete(article.getPath());
      if (count < 1) {
        break;
      }
      deleteCount += count;
    }
    article.setPageNumber(null);
    return deleteCount;
  }
예제 #2
0
  @Transactional(readOnly = true)
  public int build(Article article) {
    Assert.notNull(article);

    delete(article);
    Template template = templateService.get("articleContent");
    int buildCount = 0;
    if (article.getIsPublication()) {
      Map<String, Object> model = new HashMap<String, Object>();
      model.put("article", article);
      for (int pageNumber = 1; pageNumber <= article.getTotalPages(); pageNumber++) {
        article.setPageNumber(pageNumber);
        buildCount += build(template.getTemplatePath(), article.getPath(), model);
      }
      article.setPageNumber(null);
    }
    return buildCount;
  }