1 23 package org.apache.webdav.lib.properties; 24 25 import org.apache.webdav.lib.BaseProperty; 26 import org.apache.webdav.lib.ResponseEntity; 27 import org.apache.webdav.lib.util.DOMUtils; 28 import org.w3c.dom.Element ; 29 import org.w3c.dom.NodeList ; 30 31 37 38 39 public class CurrentUserPrivilegeSetProperty extends BaseProperty { 40 41 42 44 45 48 public static final String TAG_NAME = "current-user-privilege-set"; 49 50 51 53 54 57 public CurrentUserPrivilegeSetProperty 58 (ResponseEntity response, Element element) { 59 super(response, element); 60 } 61 62 63 65 66 public boolean hasReadAccess() { 67 NodeList readPrivilege = DOMUtils.getElementsByTagNameNS(getElement(), "read", "DAV:"); 68 return (readPrivilege.getLength() == 1); 69 } 70 71 public boolean hasWriteAccess() { 72 NodeList writePrivilege = DOMUtils.getElementsByTagNameNS(getElement(), "write", "DAV:"); 73 74 return (writePrivilege.getLength() == 1); 75 } 76 77 public boolean hasReadWriteAccess() { 78 return (hasReadAccess() && hasWriteAccess()); 79 } 80 81 82 public String getPropertyAsString() { 83 String theResult=""; 84 theResult = (hasReadAccess()) ? "Read" : theResult; 85 theResult = (hasWriteAccess()) ? theResult+" Write" : theResult; 86 return theResult.trim(); 87 } 88 } 89 90 91 92 93 | Popular Tags |