mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Merge pull request #31 from owncloud/see_files_shared_with_me
Process extra properties oc:permissions and oc:id
This commit is contained in:
commit
48d43b576c
@ -30,18 +30,20 @@ import org.apache.jackrabbit.webdav.MultiStatusResponse;
|
||||
import org.apache.jackrabbit.webdav.property.DavProperty;
|
||||
import org.apache.jackrabbit.webdav.property.DavPropertyName;
|
||||
import org.apache.jackrabbit.webdav.property.DavPropertySet;
|
||||
|
||||
|
||||
|
||||
import org.apache.jackrabbit.webdav.xml.Namespace;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
public class WebdavEntry {
|
||||
private String mName, mPath, mUri, mContentType, mEtag;
|
||||
private long mContentLength, mCreateTimestamp, mModifiedTimestamp;
|
||||
private static final String NAMESPACE_OC = "http://owncloud.org/ns";
|
||||
private static final String EXTENDED_PROPERTY_NAME_PERMISSIONS = "permissions";
|
||||
private static final String EXTENDED_PROPERTY_NAME_REMOTE_ID = "id";
|
||||
|
||||
public WebdavEntry(MultiStatusResponse ms, String splitElement) {
|
||||
private String mName, mPath, mUri, mContentType, mEtag, mPermissions, mRemoteId;
|
||||
private long mContentLength, mCreateTimestamp, mModifiedTimestamp;
|
||||
|
||||
public WebdavEntry(MultiStatusResponse ms, String splitElement) {
|
||||
resetData();
|
||||
if (ms.getStatus().length != 0) {
|
||||
mUri = ms.getHref();
|
||||
@ -106,6 +108,22 @@ public class WebdavEntry {
|
||||
mEtag = mEtag.substring(1, mEtag.length()-1);
|
||||
}
|
||||
|
||||
// OC permissions property <oc:permissions>
|
||||
prop = propSet.get(
|
||||
EXTENDED_PROPERTY_NAME_PERMISSIONS, Namespace.getNamespace(NAMESPACE_OC)
|
||||
);
|
||||
if (prop != null) {
|
||||
mPermissions = prop.getValue().toString();
|
||||
}
|
||||
|
||||
// OC remote id property <oc:id>
|
||||
prop = propSet.get(
|
||||
EXTENDED_PROPERTY_NAME_REMOTE_ID, Namespace.getNamespace(NAMESPACE_OC)
|
||||
);
|
||||
if (prop != null) {
|
||||
mRemoteId = prop.getValue().toString();
|
||||
}
|
||||
|
||||
} else {
|
||||
Log.e("WebdavEntry",
|
||||
"General fuckup, no status for webdav response");
|
||||
@ -152,8 +170,16 @@ public class WebdavEntry {
|
||||
return mEtag;
|
||||
}
|
||||
|
||||
public String permissions() {
|
||||
return mPermissions;
|
||||
}
|
||||
|
||||
public String remoteId() {
|
||||
return mRemoteId;
|
||||
}
|
||||
|
||||
private void resetData() {
|
||||
mName = mUri = mContentType = null;
|
||||
mName = mUri = mContentType = mPermissions = null; mRemoteId = null;
|
||||
mContentLength = mCreateTimestamp = mModifiedTimestamp = 0;
|
||||
}
|
||||
}
|
||||
|
@ -163,6 +163,8 @@ public class ReadRemoteFolderOperation extends RemoteOperation {
|
||||
file.setMimeType(we.contentType());
|
||||
file.setModifiedTimestamp(we.modifiedTimestamp());
|
||||
file.setEtag(we.etag());
|
||||
file.setPermissions(we.permissions());
|
||||
file.setRemoteId(we.remoteId());
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,8 @@ public class RemoteFile implements Parcelable, Serializable {
|
||||
private long mCreationTimestamp;
|
||||
private long mModifiedTimestamp;
|
||||
private String mEtag;
|
||||
private String mPermissions;
|
||||
private String mRemoteId;
|
||||
|
||||
/**
|
||||
* Getters and Setters
|
||||
@ -101,6 +103,22 @@ public class RemoteFile implements Parcelable, Serializable {
|
||||
this.mEtag = etag;
|
||||
}
|
||||
|
||||
public String getPermissions() {
|
||||
return mPermissions;
|
||||
}
|
||||
|
||||
public void setPermissions(String permissions) {
|
||||
this.mPermissions = permissions;
|
||||
}
|
||||
|
||||
public String getRemoteId() {
|
||||
return mRemoteId;
|
||||
}
|
||||
|
||||
public void setRemoteId(String remoteId) {
|
||||
this.mRemoteId = remoteId;
|
||||
}
|
||||
|
||||
public RemoteFile() {
|
||||
resetData();
|
||||
}
|
||||
@ -127,6 +145,8 @@ public class RemoteFile implements Parcelable, Serializable {
|
||||
this.setMimeType(we.contentType());
|
||||
this.setModifiedTimestamp(we.modifiedTimestamp());
|
||||
this.setEtag(we.etag());
|
||||
this.setPermissions(we.permissions());
|
||||
this.setRemoteId(we.remoteId());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,6 +159,8 @@ public class RemoteFile implements Parcelable, Serializable {
|
||||
mCreationTimestamp = 0;
|
||||
mModifiedTimestamp = 0;
|
||||
mEtag = null;
|
||||
mPermissions = null;
|
||||
mRemoteId = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,6 +195,8 @@ public class RemoteFile implements Parcelable, Serializable {
|
||||
mCreationTimestamp = source.readLong();
|
||||
mModifiedTimestamp = source.readLong();
|
||||
mEtag = source.readString();
|
||||
mPermissions= source.readString();
|
||||
mRemoteId = source.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -188,6 +212,8 @@ public class RemoteFile implements Parcelable, Serializable {
|
||||
dest.writeLong(mCreationTimestamp);
|
||||
dest.writeLong(mModifiedTimestamp);
|
||||
dest.writeString(mEtag);
|
||||
dest.writeString(mPermissions);
|
||||
dest.writeString(mRemoteId);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user