1 17 18 19 20 package org.apache.lenya.cms.ant; 21 22 import org.apache.lenya.cms.publication.SiteTree; 23 import org.apache.lenya.cms.publication.SiteTreeException; 24 import org.apache.lenya.cms.publication.SiteTreeNode; 25 import org.apache.tools.ant.BuildException; 26 27 28 31 public class DeleteNodeTask extends PublicationTask { 32 private String area; 33 private String documentid; 34 35 38 public DeleteNodeTask() { 39 super(); 40 } 41 42 47 public String getArea() { 48 return area; 49 } 50 51 56 public void setArea(String area) { 57 this.area = area; 58 } 59 60 64 protected String getDocumentid() { 65 return documentid; 66 } 67 68 73 public void setDocumentid(String string) { 74 documentid = string; 75 } 76 77 85 public void deleteNode(String documentid, String area) 86 throws SiteTreeException { 87 SiteTree tree = null; 88 89 try { 90 tree = getPublication().getTree(area); 91 tree.deleteNode(documentid); 92 tree.save(); 93 } catch (Exception e) { 94 throw new SiteTreeException(e); 95 } 96 } 97 100 public void execute() throws BuildException { 101 try { 102 log("document-id corresponding to the node: " + getDocumentid()); 103 log("area: " + getArea()); 104 deleteNode(getDocumentid(), getArea()); 105 } catch (Exception e) { 106 throw new BuildException(e); 107 } 108 } 109 } 110 | Popular Tags |