lenya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/ant InsertLabelTask.java
Date Fri, 08 Aug 2003 14:19:47 GMT
egli        2003/08/08 07:19:47

  Modified:    src/java/org/apache/lenya/cms/ant InsertLabelTask.java
  Log:
  This task is now derived from PublicationTask and no longer
  needs the path of the site tree. Instead you can pass the
  area in and it will find the associated site tree.
  
  Revision  Changes    Path
  1.2       +18 -18    cocoon-lenya/src/java/org/apache/lenya/cms/ant/InsertLabelTask.java
  
  Index: InsertLabelTask.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ant/InsertLabelTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InsertLabelTask.java	7 Aug 2003 17:06:56 -0000	1.1
  +++ InsertLabelTask.java	8 Aug 2003 14:19:47 -0000	1.2
  @@ -59,17 +59,16 @@
   import org.apache.lenya.cms.publication.Label;
   import org.apache.lenya.cms.publication.SiteTreeException;
   import org.apache.tools.ant.BuildException;
  -import org.apache.tools.ant.Task;
   
   /**
    * Ant task to insert a label into an existing node in a tree.
    * 
    * @author egli
    */
  -public class InsertLabelTask extends Task {
  -    private String absolutetreepath;
  +public class InsertLabelTask extends PublicationTask {
       private String documentid;
       private String labelName;
  +    private String area;
       private String language;
   
       /**
  @@ -80,21 +79,21 @@
       }
   
       /**
  -     * Get the absolute path to the site tree.
  +     * Get the area of the site tree.
        * 
  -     * @return absolutetreepath The absolute path of the tree.
  +     * @return  the area of the tree.
        */
  -    protected String getAbsolutetreepath() {
  -        return absolutetreepath;
  +    protected String getArea() {
  +        return area;
       }
   
       /**
  -     * Set the value of the absolute path of the tree.
  +     * Set the value of the area of the tree.
        * 
  -     * @param string The absolute path of the tree.
  +     * @param area the area of the tree.
        */
  -    public void setAbsolutetreepath(String string) {
  -        absolutetreepath = string;
  +    public void setAbsolutetreepath(String area) {
  +        this.area = area;
       }
   
       /**
  @@ -157,7 +156,7 @@
        * @param documentid the document-id of the document.
        * @param labelName the name of the label that is to be inserted.
        * @param language the language of the label that is to be inserted.
  -     * @param absolutetreepath The absolute path of the tree
  +     * @param area determines in which sitetree the label is to be inserted
        * 
        * @throws SiteTreeException if an error occurs
        */
  @@ -165,13 +164,13 @@
           String documentid,
           String labelName,
           String language,
  -        String absolutetreepath)
  +        String area)
           throws SiteTreeException {
   
           DefaultSiteTree tree = null;
           Label label = null;
           try {
  -            tree = new DefaultSiteTree(absolutetreepath);
  +            tree = getPublication().getSiteTree(area);
               label = new Label(labelName, language);
               tree.addLabel(documentid, label);
               tree.save();
  @@ -180,11 +179,12 @@
                   "Cannot insert label "
                       + label
                       + " into tree "
  -                    + absolutetreepath,
  +                    + area,
                   e);
           }
   
       }
  +
       /** (non-Javadoc)
        * @see org.apache.tools.ant.Task#execute()
        */
  @@ -193,12 +193,12 @@
               log("document-id corresponding to the node: " + getDocumentid());
               log("label name: " + getLabelName());
               log("language: " + getLanguage());
  -            log("Absolute Tree Path: " + getAbsolutetreepath());
  +            log("area: " + getArea());
               insertLabel(
                   getDocumentid(),
                   getLabelName(),
                   getLanguage(),
  -                getAbsolutetreepath());
  +                getArea());
           } catch (Exception e) {
               throw new BuildException(e);
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org


Mime
View raw message