mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-08 00:16:09 +00:00
Add privatelink property support to webdav reponses
This commit is contained in:
parent
c18329efd6
commit
9fe3e11c52
@ -45,13 +45,14 @@ public class WebdavEntry {
|
|||||||
public static final String EXTENDED_PROPERTY_NAME_PERMISSIONS = "permissions";
|
public static final String EXTENDED_PROPERTY_NAME_PERMISSIONS = "permissions";
|
||||||
public static final String EXTENDED_PROPERTY_NAME_REMOTE_ID = "id";
|
public static final String EXTENDED_PROPERTY_NAME_REMOTE_ID = "id";
|
||||||
public static final String EXTENDED_PROPERTY_NAME_SIZE = "size";
|
public static final String EXTENDED_PROPERTY_NAME_SIZE = "size";
|
||||||
|
public static final String EXTENDED_PROPERTY_NAME_PRIVATE_LINK = "privatelink";
|
||||||
|
|
||||||
public static final String PROPERTY_QUOTA_USED_BYTES = "quota-used-bytes";
|
public static final String PROPERTY_QUOTA_USED_BYTES = "quota-used-bytes";
|
||||||
public static final String PROPERTY_QUOTA_AVAILABLE_BYTES = "quota-available-bytes";
|
public static final String PROPERTY_QUOTA_AVAILABLE_BYTES = "quota-available-bytes";
|
||||||
|
|
||||||
private static final int CODE_PROP_NOT_FOUND = 404;
|
private static final int CODE_PROP_NOT_FOUND = 404;
|
||||||
|
|
||||||
private String mName, mPath, mUri, mContentType, mEtag, mPermissions, mRemoteId;
|
private String mName, mPath, mUri, mContentType, mEtag, mPermissions, mRemoteId, mPrivateLink;
|
||||||
private long mContentLength, mCreateTimestamp, mModifiedTimestamp, mSize;
|
private long mContentLength, mCreateTimestamp, mModifiedTimestamp, mSize;
|
||||||
private BigDecimal mQuotaUsedBytes, mQuotaAvailableBytes;
|
private BigDecimal mQuotaUsedBytes, mQuotaAvailableBytes;
|
||||||
|
|
||||||
@ -72,8 +73,7 @@ public class WebdavEntry {
|
|||||||
if (prop != null) {
|
if (prop != null) {
|
||||||
mName = (String) prop.getName().toString();
|
mName = (String) prop.getName().toString();
|
||||||
mName = mName.substring(1, mName.length() - 1);
|
mName = mName.substring(1, mName.length() - 1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
String[] tmp = mPath.split("/");
|
String[] tmp = mPath.split("/");
|
||||||
if (tmp.length > 0)
|
if (tmp.length > 0)
|
||||||
mName = tmp[tmp.length - 1];
|
mName = tmp[tmp.length - 1];
|
||||||
@ -176,7 +176,6 @@ public class WebdavEntry {
|
|||||||
mRemoteId = prop.getValue().toString();
|
mRemoteId = prop.getValue().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: is it necessary?
|
|
||||||
// OC size property <oc:size>
|
// OC size property <oc:size>
|
||||||
prop = propSet.get(
|
prop = propSet.get(
|
||||||
EXTENDED_PROPERTY_NAME_SIZE, Namespace.getNamespace(NAMESPACE_OC)
|
EXTENDED_PROPERTY_NAME_SIZE, Namespace.getNamespace(NAMESPACE_OC)
|
||||||
@ -185,6 +184,14 @@ public class WebdavEntry {
|
|||||||
mSize = Long.parseLong((String) prop.getValue());
|
mSize = Long.parseLong((String) prop.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OC privatelink property <oc:privatelink>
|
||||||
|
prop = propSet.get(
|
||||||
|
EXTENDED_PROPERTY_NAME_PRIVATE_LINK, Namespace.getNamespace(NAMESPACE_OC)
|
||||||
|
);
|
||||||
|
if (prop != null) {
|
||||||
|
mPrivateLink = prop.getValue().toString();
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log_OC.e("WebdavEntry",
|
Log_OC.e("WebdavEntry",
|
||||||
"General fuckup, no status for webdav response");
|
"General fuckup, no status for webdav response");
|
||||||
@ -251,11 +258,17 @@ public class WebdavEntry {
|
|||||||
return mQuotaAvailableBytes;
|
return mQuotaAvailableBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String privateLink() {
|
||||||
|
return mPrivateLink;
|
||||||
|
}
|
||||||
|
|
||||||
private void resetData() {
|
private void resetData() {
|
||||||
mName = mUri = mContentType = mPermissions = null; mRemoteId = null;
|
mName = mUri = mContentType = mPermissions = null;
|
||||||
|
mRemoteId = null;
|
||||||
mContentLength = mCreateTimestamp = mModifiedTimestamp = 0;
|
mContentLength = mCreateTimestamp = mModifiedTimestamp = 0;
|
||||||
mSize = 0;
|
mSize = 0;
|
||||||
mQuotaUsedBytes = null;
|
mQuotaUsedBytes = null;
|
||||||
mQuotaAvailableBytes = null;
|
mQuotaAvailableBytes = null;
|
||||||
|
mPrivateLink = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,8 @@ public class WebdavUtils {
|
|||||||
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE,
|
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE,
|
||||||
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
|
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_PRIVATE_LINK,
|
||||||
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
|
|
||||||
return propSet;
|
return propSet;
|
||||||
}
|
}
|
||||||
@ -130,6 +132,10 @@ public class WebdavUtils {
|
|||||||
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE,
|
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE,
|
||||||
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
|
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE,
|
||||||
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
|
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_PRIVATE_LINK,
|
||||||
|
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
|
||||||
|
|
||||||
return propSet;
|
return propSet;
|
||||||
}
|
}
|
||||||
|
@ -171,6 +171,7 @@ public class ReadRemoteFolderOperation extends RemoteOperation {
|
|||||||
file.setSize(we.size());
|
file.setSize(we.size());
|
||||||
file.setQuotaUsedBytes(we.quotaUsedBytes());
|
file.setQuotaUsedBytes(we.quotaUsedBytes());
|
||||||
file.setQuotaAvailableBytes(we.quotaAvailableBytes());
|
file.setQuotaAvailableBytes(we.quotaAvailableBytes());
|
||||||
|
file.setPrivateLink(we.privateLink());
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,9 @@ import com.owncloud.android.lib.common.network.WebdavEntry;
|
|||||||
|
|
||||||
public class RemoteFile implements Parcelable, Serializable {
|
public class RemoteFile implements Parcelable, Serializable {
|
||||||
|
|
||||||
/** Generated - should be refreshed every time the class changes!! */
|
/**
|
||||||
|
* Generated - should be refreshed every time the class changes!!
|
||||||
|
*/
|
||||||
private static final long serialVersionUID = 3130865437811248451L;
|
private static final long serialVersionUID = 3130865437811248451L;
|
||||||
|
|
||||||
private String mRemotePath;
|
private String mRemotePath;
|
||||||
@ -54,6 +56,7 @@ public class RemoteFile implements Parcelable, Serializable {
|
|||||||
private long mSize;
|
private long mSize;
|
||||||
private BigDecimal mQuotaUsedBytes;
|
private BigDecimal mQuotaUsedBytes;
|
||||||
private BigDecimal mQuotaAvailableBytes;
|
private BigDecimal mQuotaAvailableBytes;
|
||||||
|
private String mPrivateLink;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getters and Setters
|
* Getters and Setters
|
||||||
@ -139,13 +142,21 @@ public class RemoteFile implements Parcelable, Serializable {
|
|||||||
mQuotaAvailableBytes = quotaAvailableBytes;
|
mQuotaAvailableBytes = quotaAvailableBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPrivateLink() {
|
||||||
|
return mPrivateLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrivateLink(String privateLink) {
|
||||||
|
mPrivateLink = privateLink;
|
||||||
|
}
|
||||||
|
|
||||||
public RemoteFile() {
|
public RemoteFile() {
|
||||||
resetData();
|
resetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new {@link RemoteFile} with given path.
|
* Create new {@link RemoteFile} with given path.
|
||||||
*
|
* <p>
|
||||||
* The path received must be URL-decoded. Path separator must be OCFile.PATH_SEPARATOR, and it must be the first character in 'path'.
|
* The path received must be URL-decoded. Path separator must be OCFile.PATH_SEPARATOR, and it must be the first character in 'path'.
|
||||||
*
|
*
|
||||||
* @param path The remote path of the file.
|
* @param path The remote path of the file.
|
||||||
@ -170,6 +181,7 @@ public class RemoteFile implements Parcelable, Serializable {
|
|||||||
this.setSize(we.size());
|
this.setSize(we.size());
|
||||||
this.setQuotaUsedBytes(we.quotaUsedBytes());
|
this.setQuotaUsedBytes(we.quotaUsedBytes());
|
||||||
this.setQuotaAvailableBytes(we.quotaAvailableBytes());
|
this.setQuotaAvailableBytes(we.quotaAvailableBytes());
|
||||||
|
this.setPrivateLink(we.privateLink());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -187,6 +199,7 @@ public class RemoteFile implements Parcelable, Serializable {
|
|||||||
mSize = 0;
|
mSize = 0;
|
||||||
mQuotaUsedBytes = null;
|
mQuotaUsedBytes = null;
|
||||||
mQuotaAvailableBytes = null;
|
mQuotaAvailableBytes = null;
|
||||||
|
mPrivateLink = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,6 +239,7 @@ public class RemoteFile implements Parcelable, Serializable {
|
|||||||
mSize = source.readLong();
|
mSize = source.readLong();
|
||||||
mQuotaUsedBytes = (BigDecimal) source.readSerializable();
|
mQuotaUsedBytes = (BigDecimal) source.readSerializable();
|
||||||
mQuotaAvailableBytes = (BigDecimal) source.readSerializable();
|
mQuotaAvailableBytes = (BigDecimal) source.readSerializable();
|
||||||
|
mPrivateLink = source.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -246,6 +260,7 @@ public class RemoteFile implements Parcelable, Serializable {
|
|||||||
dest.writeLong(mSize);
|
dest.writeLong(mSize);
|
||||||
dest.writeSerializable(mQuotaUsedBytes);
|
dest.writeSerializable(mQuotaUsedBytes);
|
||||||
dest.writeSerializable(mQuotaAvailableBytes);
|
dest.writeSerializable(mQuotaAvailableBytes);
|
||||||
|
dest.writeString(mPrivateLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user