jericho     2002/09/12 04:44:02

  Modified:    src/webdav/client/src/org/apache/webdav/lib/methods
                        LabelMethod.java
  Log:
  - Code cleanup  :)
  
  Revision  Changes    Path
  1.6       +92 -39    
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/LabelMethod.java
  
  Index: LabelMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/LabelMethod.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LabelMethod.java  4 Sep 2002 05:07:12 -0000       1.5
  +++ LabelMethod.java  12 Sep 2002 11:44:02 -0000      1.6
  @@ -60,7 +60,7 @@
    * [Additional notices, if required by prior licensing conditions]
    *
    */
  - 
  +
   package org.apache.webdav.lib.methods;
   
   import java.io.InputStream;
  @@ -82,7 +82,7 @@
    * LABEL /files/testfile.xml HTTP/1.1
    * Host: www.webdav.org
    * Content-Type: text/xml; charset="utf-8"
  - * 
  + *
    * <?xml version="1.0" encoding="utf-8"?>
    * <D:label xmlns:D="DAV:">
    *   <D:set>
  @@ -99,101 +99,154 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Michael Smith</a>
    */
  -public class LabelMethod
  -    extends XMLResponseMethodBase  {
  -    
  -    /** Constant for setting a label */    
  +public class LabelMethod extends XMLResponseMethodBase {
  +
  +    // ----------------------------------------------------- Instance Variables
  +
  +    /**
  +     * The constant for setting a label.
  +     */
       public static final int LABEL_SET = 1;
  -    /** Constant for adding a label */
  +
  +
  +    /**
  +     * The constant for adding a label.
  +     */
       public static final int LABEL_ADD = 2;
  -    /** Constant for removing a label */
  +
  +
  +    /**
  +     * The constant for removing a label.
  +     */
       public static final int LABEL_REMOVE = 3;
   
  -    String labelname = null;
  -    int type = 0;
  -    
  +
  +    /**
  +     * The label name.
  +     */
  +    private String labelName = null;
  +
  +
  +    /**
  +     * The lable type.
  +     */
  +    private int type = 0;
  +
       // ----------------------------------------------------------- Constructors
  -    
  -    
  +
       /**
  -     * Method constructor.
  +     * The default constructor.
        */
       public LabelMethod() {
           name = "LABEL";
       }
  -    
  -    
  +
  +
       /**
  -     * Method constructor.
  +     * The label method constructor.
  +     *
  +     * @param path the path
  +     * @param action the action
  +     * @param labelName the label name
        */
  -    public LabelMethod(String path, int action, String labelname) {
  +    public LabelMethod(String path, int action, String labelName) {
           super(path);
           name = "LABEL";
  -        this.labelname = labelname;
  +        this.labelName = labelName;
           this.type = action;
       }
   
  -    /** Set the type of label action to take */
  +
  +    /**
  +     * Set the type of label action to take.
  +     *
  +     * @param type the type of the label action
  +     */
       public void setType(int type) {
           this.type = type;
       }
   
  -    /** Get the label type which has been set */
  +
  +    /**
  +     * Get the label type which has been set.
  +     *
  +     * @return the type
  +     */
       public int getType() {
           return type;
       }
   
  -    /** Set the label-name this action will manipulate */
  -    public void setLabelName(String labelname) {
  -        this.labelname = labelname;
  +
  +    /**
  +     * Set the label-name this action will manipulate.
  +     *
  +     * @param labelName the label name
  +     */
  +    public void setLabelName(String labelName) {
  +        this.labelName = labelName;
       }
   
  -    /** Get the label-name this action will manipulate */
  +
  +    /**
  +     * Get the label-name this action will manipulate.
  +     *
  +     * @return the label-name
  +     */
       public String getLabelName() {
  -        return labelname;
  +        return labelName;
       }
   
  +
  +    /**
  +     * Generate the protocol headers.
  +     *
  +     * @param host the host
  +     * @param state the state
  +     */
       public void generateHeaders(String host, State state) {
           super.generateHeaders(host, state);
           super.setHeader("Content-Type", "text/xml; charset=utf-8");
       }
   
  +
       /**
        * Generate the query body.
        *
  -     * @return String query
  +     * @return the query
        */
       public String generateQuery() {
  -        if(type <= 0 || labelname == null)
  +
  +        if (type <= 0 || labelName == null)
               throw new IllegalStateException
  -                ("Action type and label name must be set before "+
  +                ("Action type and label name must be set before " +
                    "calling this function");
   
           XMLPrinter printer = new XMLPrinter();
           printer.writeXMLHeader();
           printer.writeElement("D", "DAV:", "label", XMLPrinter.OPENING);
   
  -        String typeelement = null;    
  +        String typeElement = null;
           switch (type) {
               case LABEL_SET:
  -                typeelement = "set";
  +                typeElement = "set";
                   break;
               case LABEL_REMOVE:
  -                typeelement = "remove";
  +                typeElement = "remove";
                   break;
               case LABEL_ADD:
  -                typeelement = "add";
  +                typeElement = "add";
                   break;
           }
   
  -        printer.writeElement("D", typeelement, XMLPrinter.OPENING);
  +        printer.writeElement("D", typeElement, XMLPrinter.OPENING);
           printer.writeElement("D", "label-name", XMLPrinter.OPENING);
  -        printer.writeText(labelname);
  +        printer.writeText(labelName);
           printer.writeElement("D", "label-name", XMLPrinter.CLOSING);
  -        printer.writeElement("D", typeelement, XMLPrinter.CLOSING);
  +        printer.writeElement("D", typeElement, XMLPrinter.CLOSING);
           printer.writeElement("D", "label", XMLPrinter.CLOSING);
   
           return printer.toString();
       }
   
   }
  +
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to