1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  package org.abstracthorizon.danube.webdav.xml.dav.request;
14  
15  import org.abstracthorizon.danube.webdav.xml.XMLParserHandler;
16  import org.abstracthorizon.danube.webdav.xml.dav.DAVAbstractXMLParser;
17  import org.abstracthorizon.danube.webdav.xml.dav.DAVFactory;
18  import org.abstracthorizon.danube.webdav.xml.dav.RequestProp;
19  
20  import org.xml.sax.Attributes;
21  import org.xml.sax.SAXException;
22  
23  
24  
25  
26  
27  
28  public class PropFind extends DAVAbstractXMLParser {
29  
30      
31      protected boolean allprop = false;
32  
33      
34      protected boolean propname = false;
35  
36      
37      protected RequestProp prop;
38  
39      
40  
41  
42  
43  
44      public PropFind(XMLParserHandler parent, DAVFactory davFactory) {
45          super(parent, davFactory);
46      }
47  
48      @Override
49      public Object start(Object current, String tag, Attributes attributes) throws SAXException {
50          if ("allprop".equals(tag)) {
51              allprop = true;
52              return this;
53          } else if ("propname".equals(tag)) {
54              propname = true;
55              return this;
56          } else if ("prop".equals(tag)) {
57              prop = davFactory.newProp(this);
58              return prop;
59          } else {
60              return super.start(current, tag, attributes);
61          }
62      }
63  
64      @Override
65      public Object end(Object current, String tag, String value) throws SAXException {
66          return current;
67      }
68  
69      
70  
71  
72  
73      public void setAllprop(boolean allprop) {
74          this.allprop = allprop;
75      }
76  
77      
78  
79  
80  
81      public boolean isAllprop() {
82          return allprop || (!allprop && !propname && (prop == null));
83      }
84  
85      
86  
87  
88  
89      public void setPropname(boolean propname) {
90          this.propname = propname;
91      }
92  
93      
94  
95  
96  
97      public boolean isPropname() {
98          return propname;
99      }
100 
101     
102 
103 
104 
105     public RequestProp getProp() {
106         return prop;
107     }
108 
109     @Override
110     public String toString() {
111         if (isAllprop()) {
112             return "PropFind[allprop]";
113         } else if (isPropname()) {
114             return "PropFind[propname]";
115         } else {
116             return "PropFind[" + prop + "]";
117         }
118     }
119 }