Skip to content

Commit

Permalink
DavResource: add supportedlock filed
Browse files Browse the repository at this point in the history
  • Loading branch information
rt1shnik committed Feb 6, 2020
1 parent b9127c2 commit c4d8d3d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/com/thegrizzlylabs/sardineandroid/DavResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.thegrizzlylabs.sardineandroid.model.Propstat;
import com.thegrizzlylabs.sardineandroid.model.Resourcetype;
import com.thegrizzlylabs.sardineandroid.model.Response;
import com.thegrizzlylabs.sardineandroid.model.Supportedlock;
import com.thegrizzlylabs.sardineandroid.util.SardineUtil;

import org.w3c.dom.Element;
Expand Down Expand Up @@ -82,6 +83,7 @@ private class DavProperties {
//final List<QName> supportedReports;
final Map<QName, String> customProps;
final Lockdiscovery lockDiscovery;
final Supportedlock supportedlock;

DavProperties(Date creation, Date modified, String contentType,
Long contentLength, String etag, String displayName, List<QName> resourceTypes,
Expand All @@ -97,6 +99,7 @@ private class DavProperties {
//this.supportedReports = supportedReports;
this.customProps = customProps;
this.lockDiscovery = null;
this.supportedlock = null;
}

DavProperties(Response response) {
Expand All @@ -111,6 +114,7 @@ private class DavProperties {
//this.supportedReports = getSupportedReports(response);
this.customProps = getCustomProps(response);
this.lockDiscovery = getLockDiscovery(response);
this.supportedlock = getSupportedLock(response);
}
}

Expand Down Expand Up @@ -431,6 +435,19 @@ private Lockdiscovery getLockDiscovery(Response response) {
return null;
}

private Supportedlock getSupportedLock(Response response) {
List<Propstat> list = response.getPropstat();
if (list.isEmpty()) {
return null;
}
for (Propstat propstat : list) {
if (propstat.getProp() != null) {
return propstat.getProp().getSupportedlock();
}
}
return null;
}

/**
* @return Status code (or 200 if not present, or -1 if malformed)
*/
Expand Down Expand Up @@ -534,6 +551,10 @@ public Lockdiscovery getLockDiscovery() {
return this.props.lockDiscovery;
}

public Supportedlock getSupportedlock() {
return this.props.supportedlock;
}

/**
* @return URI of the resource.
*/
Expand Down

0 comments on commit c4d8d3d

Please sign in to comment.