1 17 18 19 20 package org.apache.lenya.cms.ant; 21 22 import org.apache.lenya.cms.publication.Publication; 23 import org.apache.lenya.cms.publication.SiteTree; 24 import org.apache.lenya.cms.publication.SiteTreeNode; 25 import org.apache.tools.ant.BuildException; 26 27 30 public class SiteTreeResetTask extends PublicationTask { 31 private String area; 32 33 36 public SiteTreeResetTask() { 37 super(); 38 } 39 40 43 public String getArea() { 44 return area; 45 } 46 47 50 public void setArea(String string) { 51 area = string; 52 } 53 54 57 public void execute() throws BuildException { 58 try { 59 log("area : " + this.getArea()); 60 Publication publication= getPublication(); 61 SiteTree tree = publication.getTree(getArea()); 62 63 SiteTreeNode node = tree.getNode("/"); 64 node.deleteChildren(); 65 tree.save(); 66 } catch ( 67 Exception e) { 68 throw new BuildException(e); 69 } 70 } 71 72 } 73 | Popular Tags |