Ejemplo n.º 1
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;
  }