PageTreeMacroParameters.java

  1. /*
  2.  * Copyright (C) 2003-2010 eXo Platform SAS.
  3.  *
  4.  * This program is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Affero General Public License
  6.  * as published by the Free Software Foundation; either version 3
  7.  * of the License, or (at your option) any later version.
  8.  *
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, see<http://www.gnu.org/licenses/>.
  16.  */
  17. package org.exoplatform.wiki.rendering.macro.pagetree;

  18. import org.apache.commons.lang.StringUtils;
  19. import org.exoplatform.wiki.rendering.macro.MacroUtils;
  20. import org.xwiki.properties.annotation.PropertyDescription;
  21. import org.xwiki.rendering.macro.MacroExecutionException;

  22. public class PageTreeMacroParameters {

  23.   /**
  24.    * Title of root page
  25.    */
  26.   private String root       = StringUtils.EMPTY;

  27.   /**
  28.    * Depth of tree page
  29.    */
  30.   private String startDepth = StringUtils.EMPTY;

  31.   /**
  32.    * Show excerpt or not
  33.    */
  34.   private boolean excerpt = false;  

  35.   /**
  36.    * @return root page of children
  37.    */
  38.   public String getRoot() {
  39.     return root;
  40.   }

  41.   /**
  42.    * @param root root of page tree
  43.    */
  44.   @PropertyDescription("Root of page tree. If not specified, current page is applied")
  45.   public void setRoot(String root) {
  46.     this.root = root;
  47.   }

  48.   /**
  49.    * @return the depth of children
  50.    */
  51.   public String getStartDepth() {
  52.     return startDepth;
  53.   }

  54.   /**
  55.    * @param depth depth of children to set
  56.    * @throws MacroExecutionException if parameter is not empty and not a number
  57.    */
  58.   @PropertyDescription("Start depth of children. If not specified, first level is applied")
  59.   public void setStartDepth(String depth) throws MacroExecutionException {
  60.     MacroUtils.validateNumberParam(depth);
  61.     this.startDepth = depth;
  62.   }

  63.   /**
  64.    * @return the value allow hide excerpt or not
  65.    */
  66.   public boolean isExcerpt() {
  67.     return excerpt;
  68.   }

  69.   /**
  70.    * @param excerpt the value show excerpt to set
  71.    */
  72.   @PropertyDescription("Include Excerpts")
  73.   public void setExcerpt(boolean excerpt) {
  74.     this.excerpt = excerpt;
  75.   }
  76. }