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.lenya.cms.publication.SiteTreeNodeVisitor; 26 import org.apache.tools.ant.BuildException; 27 28 33 public abstract class DocumentOperationTask extends PublicationTask implements SiteTreeNodeVisitor { 34 35 private String firstarea; 36 private String firstdocumentid; 37 38 41 public DocumentOperationTask() { 42 super(); 43 } 44 45 46 49 public String getFirstarea() { 50 return firstarea; 51 } 52 53 56 public String getFirstdocumentid() { 57 return firstdocumentid; 58 } 59 60 63 public void setFirstarea(String string) { 64 firstarea = string; 65 } 66 67 70 public void setFirstdocumentid(String string) { 71 firstdocumentid = string; 72 } 73 74 78 public abstract void visitSiteTreeNode(SiteTreeNode node); 79 80 83 public void execute() throws BuildException { 84 try { 85 log("document-id for the source" + this.getFirstdocumentid()); 86 log("area for the source" + this.getFirstarea()); 87 88 Publication publication= getPublication(); 89 SiteTree tree = publication.getTree(getFirstarea()); 90 SiteTreeNode node = tree.getNode(getFirstdocumentid()); 91 92 node.acceptSubtree(this); 93 } catch (Exception e) { 94 throw new BuildException(e); 95 } 96 } 97 98 99 } 100 | Popular Tags |