list = new ArrayList<>();
+ for (Response response : responses) {
+ list.add(webDavFileUtils.parseResponse(response, client.getFilesDavUri()));
+ }
+
+ // Result of the operation
+ result = new RemoteOperationResult<>(
+ true,
+ HttpStatus.SC_OK,
+ searchMethod.getResponseHeaders());
+ // Add data to the result
+ if (result.isSuccess()) {
+ result.setResultData(list);
+ }
+ } catch (Exception e) {
+ result = new RemoteOperationResult<>(e);
+ } finally {
+ if (searchMethod != null) {
+ searchMethod.releaseConnection(); // let the connection available for other methods
+ }
+ }
+ return result;
+ }
+
+ public String transformDocumentToString(Document document) throws TransformerException {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer trans = tf.newTransformer();
+ StringWriter sw = new StringWriter();
+ trans.transform(new DOMSource(document), new StreamResult(sw));
+ return sw.toString();
+ }
}
diff --git a/library/src/main/java/com/owncloud/android/lib/resources/files/model/RemoteFile.java b/library/src/main/java/com/owncloud/android/lib/resources/files/model/RemoteFile.java
index 8254c71bfb..ed459eaa40 100644
--- a/library/src/main/java/com/owncloud/android/lib/resources/files/model/RemoteFile.java
+++ b/library/src/main/java/com/owncloud/android/lib/resources/files/model/RemoteFile.java
@@ -1,22 +1,22 @@
/* ownCloud Android Library is available under MIT license
* Copyright (C) 2015 ownCloud Inc.
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
@@ -32,18 +32,16 @@
import com.owncloud.android.lib.resources.shares.ShareeUser;
import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Objects;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import lombok.Getter;
-import lombok.Setter;
/**
* Contains the data of a Remote File from a WebDavEntry.
*
* @author masensio
*/
-@Getter
-@Setter
public class RemoteFile implements Parcelable, Serializable {
/**
* Generated - should be refreshed every time the class changes!!
@@ -85,7 +83,7 @@ public RemoteFile() {
/**
* Create new {@link RemoteFile} with given 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.
@@ -250,4 +248,242 @@ public String getLocalId() {
return remoteId.substring(0, 8).replaceAll("^0*", "");
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ RemoteFile that = (RemoteFile) o;
+ return length == that.length && creationTimestamp == that.creationTimestamp && modifiedTimestamp == that.modifiedTimestamp && uploadTimestamp == that.uploadTimestamp && size == that.size && favorite == that.favorite && encrypted == that.encrypted && unreadCommentsCount == that.unreadCommentsCount && hasPreview == that.hasPreview && isLocked == that.isLocked && lockTimestamp == that.lockTimestamp && lockTimeout == that.lockTimeout && Objects.equals(remotePath, that.remotePath) && Objects.equals(mimeType, that.mimeType) && Objects.equals(etag, that.etag) && Objects.equals(permissions, that.permissions) && Objects.equals(remoteId, that.remoteId) && mountType == that.mountType && Objects.equals(ownerId, that.ownerId) && Objects.equals(ownerDisplayName, that.ownerDisplayName) && Objects.equals(note, that.note) && Arrays.equals(sharees, that.sharees) && Objects.equals(richWorkspace, that.richWorkspace) && lockType == that.lockType && Objects.equals(lockOwner, that.lockOwner) && Objects.equals(lockOwnerDisplayName, that.lockOwnerDisplayName) && Objects.equals(lockOwnerEditor, that.lockOwnerEditor) && Objects.equals(lockToken, that.lockToken);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = Objects.hash(remotePath, mimeType, length, creationTimestamp, modifiedTimestamp, uploadTimestamp, etag, permissions, remoteId, size, favorite, encrypted, mountType, ownerId, ownerDisplayName, unreadCommentsCount, hasPreview, note, richWorkspace, isLocked, lockType, lockOwner, lockOwnerDisplayName, lockTimestamp, lockOwnerEditor, lockTimeout, lockToken);
+ result = 31 * result + Arrays.hashCode(sharees);
+ return result;
+ }
+
+ public String getRemotePath() {
+ return remotePath;
+ }
+
+ public void setRemotePath(String remotePath) {
+ this.remotePath = remotePath;
+ }
+
+ public String getMimeType() {
+ return mimeType;
+ }
+
+ public void setMimeType(String mimeType) {
+ this.mimeType = mimeType;
+ }
+
+ public long getLength() {
+ return length;
+ }
+
+ public void setLength(long length) {
+ this.length = length;
+ }
+
+ public long getCreationTimestamp() {
+ return creationTimestamp;
+ }
+
+ public void setCreationTimestamp(long creationTimestamp) {
+ this.creationTimestamp = creationTimestamp;
+ }
+
+ public long getModifiedTimestamp() {
+ return modifiedTimestamp;
+ }
+
+ public void setModifiedTimestamp(long modifiedTimestamp) {
+ this.modifiedTimestamp = modifiedTimestamp;
+ }
+
+ public long getUploadTimestamp() {
+ return uploadTimestamp;
+ }
+
+ public void setUploadTimestamp(long uploadTimestamp) {
+ this.uploadTimestamp = uploadTimestamp;
+ }
+
+ public String getEtag() {
+ return etag;
+ }
+
+ public void setEtag(String etag) {
+ this.etag = etag;
+ }
+
+ public String getPermissions() {
+ return permissions;
+ }
+
+ public void setPermissions(String permissions) {
+ this.permissions = permissions;
+ }
+
+ public String getRemoteId() {
+ return remoteId;
+ }
+
+ public void setRemoteId(String remoteId) {
+ this.remoteId = remoteId;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ public void setSize(long size) {
+ this.size = size;
+ }
+
+ public boolean isFavorite() {
+ return favorite;
+ }
+
+ public void setFavorite(boolean favorite) {
+ this.favorite = favorite;
+ }
+
+ public boolean isEncrypted() {
+ return encrypted;
+ }
+
+ public void setEncrypted(boolean encrypted) {
+ this.encrypted = encrypted;
+ }
+
+ public WebdavEntry.MountType getMountType() {
+ return mountType;
+ }
+
+ public void setMountType(WebdavEntry.MountType mountType) {
+ this.mountType = mountType;
+ }
+
+ public String getOwnerId() {
+ return ownerId;
+ }
+
+ public void setOwnerId(String ownerId) {
+ this.ownerId = ownerId;
+ }
+
+ public String getOwnerDisplayName() {
+ return ownerDisplayName;
+ }
+
+ public void setOwnerDisplayName(String ownerDisplayName) {
+ this.ownerDisplayName = ownerDisplayName;
+ }
+
+ public int getUnreadCommentsCount() {
+ return unreadCommentsCount;
+ }
+
+ public void setUnreadCommentsCount(int unreadCommentsCount) {
+ this.unreadCommentsCount = unreadCommentsCount;
+ }
+
+ public boolean isHasPreview() {
+ return hasPreview;
+ }
+
+ public void setHasPreview(boolean hasPreview) {
+ this.hasPreview = hasPreview;
+ }
+
+ public String getNote() {
+ return note;
+ }
+
+ public void setNote(String note) {
+ this.note = note;
+ }
+
+ public ShareeUser[] getSharees() {
+ return sharees;
+ }
+
+ public void setSharees(ShareeUser[] sharees) {
+ this.sharees = sharees;
+ }
+
+ public String getRichWorkspace() {
+ return richWorkspace;
+ }
+
+ public void setRichWorkspace(String richWorkspace) {
+ this.richWorkspace = richWorkspace;
+ }
+
+ public boolean isLocked() {
+ return isLocked;
+ }
+
+ public void setLocked(boolean locked) {
+ isLocked = locked;
+ }
+
+ public FileLockType getLockType() {
+ return lockType;
+ }
+
+ public void setLockType(FileLockType lockType) {
+ this.lockType = lockType;
+ }
+
+ public String getLockOwner() {
+ return lockOwner;
+ }
+
+ public void setLockOwner(String lockOwner) {
+ this.lockOwner = lockOwner;
+ }
+
+ public String getLockOwnerDisplayName() {
+ return lockOwnerDisplayName;
+ }
+
+ public void setLockOwnerDisplayName(String lockOwnerDisplayName) {
+ this.lockOwnerDisplayName = lockOwnerDisplayName;
+ }
+
+ public long getLockTimestamp() {
+ return lockTimestamp;
+ }
+
+ public void setLockTimestamp(long lockTimestamp) {
+ this.lockTimestamp = lockTimestamp;
+ }
+
+ public String getLockOwnerEditor() {
+ return lockOwnerEditor;
+ }
+
+ public void setLockOwnerEditor(String lockOwnerEditor) {
+ this.lockOwnerEditor = lockOwnerEditor;
+ }
+
+ public long getLockTimeout() {
+ return lockTimeout;
+ }
+
+ public void setLockTimeout(long lockTimeout) {
+ this.lockTimeout = lockTimeout;
+ }
+
+ public String getLockToken() {
+ return lockToken;
+ }
+
+ public void setLockToken(String lockToken) {
+ this.lockToken = lockToken;
+ }
}
diff --git a/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/NCEtag.kt b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/NCEtag.kt
new file mode 100644
index 0000000000..e6e3b72950
--- /dev/null
+++ b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/NCEtag.kt
@@ -0,0 +1,50 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * Copyright (C) 2022 Tobias Kaminsky
+ * Copyright (C) 2022 Nextcloud GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+package com.owncloud.android.lib.resources.files.webdav
+
+import at.bitfire.dav4jvm.Property
+import at.bitfire.dav4jvm.PropertyFactory
+import at.bitfire.dav4jvm.XmlUtils
+import com.owncloud.android.lib.common.network.WebdavUtils
+import org.xmlpull.v1.XmlPullParser
+
+class NCEtag internal constructor(var etag: String) : Property {
+
+ companion object {
+ @JvmField
+ val NAME = Property.Name(XmlUtils.NS_WEBDAV, "getetag")
+ }
+
+ class Factory : PropertyFactory {
+
+ override fun getName() = NAME
+
+ override fun create(parser: XmlPullParser): NCEtag? {
+ //
+ XmlUtils.readText(parser)?.let { rawEtag ->
+ return NCEtag(WebdavUtils.parseEtag(rawEtag))
+ }
+ return null
+ }
+ }
+}
diff --git a/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/NCFavorite.kt b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/NCFavorite.kt
new file mode 100644
index 0000000000..f5062aa961
--- /dev/null
+++ b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/NCFavorite.kt
@@ -0,0 +1,62 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * Copyright (C) 2022 Tobias Kaminsky
+ * Copyright (C) 2022 Nextcloud GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+package com.owncloud.android.lib.resources.files.webdav
+
+import android.text.TextUtils
+import android.util.Log
+import at.bitfire.dav4jvm.Property
+import at.bitfire.dav4jvm.PropertyFactory
+import at.bitfire.dav4jvm.XmlUtils.readText
+import com.owncloud.android.lib.common.network.WebdavEntry
+import org.xmlpull.v1.XmlPullParser
+import org.xmlpull.v1.XmlPullParserException
+import java.io.IOException
+
+class NCFavorite internal constructor(var isOcFavorite: Boolean) : Property {
+
+ class Factory : PropertyFactory {
+ override fun create(parser: XmlPullParser): Property {
+ try {
+ val text = readText(parser)
+ if (!TextUtils.isEmpty(text)) {
+ return NCFavorite("1" == text)
+ }
+ } catch (e: IOException) {
+ Log.e("OCFavorite", "failed to create property", e)
+ } catch (e: XmlPullParserException) {
+ Log.e("OCFavorite", "failed to create property", e)
+ }
+ return NCFavorite(false)
+ }
+
+ override fun getName(): Property.Name {
+ return NAME
+ }
+ }
+
+ companion object {
+ @JvmField
+ val NAME: Property.Name =
+ Property.Name(WebdavEntry.NAMESPACE_OC, WebdavEntry.EXTENDED_PROPERTY_FAVORITE)
+ }
+}
diff --git a/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/NCMountType.kt b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/NCMountType.kt
new file mode 100644
index 0000000000..50c78bbf10
--- /dev/null
+++ b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/NCMountType.kt
@@ -0,0 +1,54 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * Copyright (C) 2022 Tobias Kaminsky
+ * Copyright (C) 2022 Nextcloud GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+package com.owncloud.android.lib.resources.files.webdav
+
+import at.bitfire.dav4jvm.Property
+import at.bitfire.dav4jvm.PropertyFactory
+import at.bitfire.dav4jvm.XmlUtils
+import com.owncloud.android.lib.common.network.WebdavEntry
+import org.xmlpull.v1.XmlPullParser
+
+class NCMountType internal constructor(var type: WebdavEntry.MountType) : Property {
+
+ companion object {
+ @JvmField
+ val NAME = Property.Name(WebdavEntry.NAMESPACE_NC, WebdavEntry.EXTENDED_PROPERTY_MOUNT_TYPE)
+ }
+
+ class Factory : PropertyFactory {
+
+ override fun getName() = NAME
+
+ override fun create(parser: XmlPullParser): NCMountType {
+ // (#PCDATA) >
+ val r = XmlUtils.readText(parser)?.let { type ->
+ when (type) {
+ "external" -> WebdavEntry.MountType.EXTERNAL
+ "group" -> WebdavEntry.MountType.GROUP
+ else -> WebdavEntry.MountType.INTERNAL
+ }
+ } ?: WebdavEntry.MountType.INTERNAL
+ return NCMountType(r)
+ }
+ }
+}
diff --git a/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCId.kt b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCId.kt
new file mode 100644
index 0000000000..a1d2535b7b
--- /dev/null
+++ b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCId.kt
@@ -0,0 +1,62 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Mario Danic
+ * @author Andy Scherzinger
+ * Copyright (C) 2021 Andy Scherzinger
+ * Copyright (C) 2017-2019 Mario Danic
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.nextcloud.talk.components.filebrowser.models.properties
+
+import android.text.TextUtils
+import android.util.Log
+import at.bitfire.dav4jvm.Property
+import at.bitfire.dav4jvm.PropertyFactory
+import at.bitfire.dav4jvm.XmlUtils.readText
+import com.owncloud.android.lib.common.network.WebdavEntry
+import org.xmlpull.v1.XmlPullParser
+import org.xmlpull.v1.XmlPullParserException
+import java.io.IOException
+
+class OCId private constructor(var ocId: String?) : Property {
+
+ class Factory : PropertyFactory {
+ override fun create(parser: XmlPullParser): Property {
+ try {
+ val text = readText(parser)
+ if (!TextUtils.isEmpty(text)) {
+ return OCId(text)
+ }
+ } catch (e: IOException) {
+ Log.e("OCId", "failed to create property", e)
+ } catch (e: XmlPullParserException) {
+ Log.e("OCId", "failed to create property", e)
+ }
+ return OCId("")
+ }
+
+ override fun getName(): Property.Name {
+ return NAME
+ }
+ }
+
+ companion object {
+ @JvmField
+ val NAME: Property.Name =
+ Property.Name(WebdavEntry.NAMESPACE_OC, WebdavEntry.EXTENDED_PROPERTY_NAME_REMOTE_ID)
+ }
+}
diff --git a/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCOwnerDisplayName.kt b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCOwnerDisplayName.kt
new file mode 100644
index 0000000000..9551c68578
--- /dev/null
+++ b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCOwnerDisplayName.kt
@@ -0,0 +1,64 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Mario Danic
+ * @author Andy Scherzinger
+ * Copyright (C) 2021 Andy Scherzinger
+ * Copyright (C) 2017-2019 Mario Danic
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.nextcloud.talk.components.filebrowser.models.properties
+
+import android.text.TextUtils
+import android.util.Log
+import at.bitfire.dav4jvm.Property
+import at.bitfire.dav4jvm.PropertyFactory
+import at.bitfire.dav4jvm.XmlUtils.readText
+import com.owncloud.android.lib.common.network.WebdavEntry
+import org.xmlpull.v1.XmlPullParser
+import org.xmlpull.v1.XmlPullParserException
+import java.io.IOException
+
+class OCOwnerDisplayName private constructor(var string: String?) : Property {
+
+ class Factory : PropertyFactory {
+ override fun create(parser: XmlPullParser): Property {
+ try {
+ val text = readText(parser)
+ if (!TextUtils.isEmpty(text)) {
+ return OCOwnerDisplayName(text)
+ }
+ } catch (e: IOException) {
+ Log.e("OCOwnerDisplayName", "failed to create property", e)
+ } catch (e: XmlPullParserException) {
+ Log.e("OCOwnerDisplayName", "failed to create property", e)
+ }
+ return OCOwnerDisplayName("")
+ }
+
+ override fun getName(): Property.Name {
+ return NAME
+ }
+ }
+
+ companion object {
+ @JvmField
+ val NAME: Property.Name = Property.Name(
+ WebdavEntry.NAMESPACE_OC,
+ WebdavEntry.EXTENDED_PROPERTY_OWNER_DISPLAY_NAME
+ )
+ }
+}
diff --git a/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCOwnerId.kt b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCOwnerId.kt
new file mode 100644
index 0000000000..32df45b214
--- /dev/null
+++ b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCOwnerId.kt
@@ -0,0 +1,62 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Mario Danic
+ * @author Andy Scherzinger
+ * Copyright (C) 2021 Andy Scherzinger
+ * Copyright (C) 2017-2019 Mario Danic
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.nextcloud.talk.components.filebrowser.models.properties
+
+import android.text.TextUtils
+import android.util.Log
+import at.bitfire.dav4jvm.Property
+import at.bitfire.dav4jvm.PropertyFactory
+import at.bitfire.dav4jvm.XmlUtils.readText
+import com.owncloud.android.lib.common.network.WebdavEntry
+import org.xmlpull.v1.XmlPullParser
+import org.xmlpull.v1.XmlPullParserException
+import java.io.IOException
+
+class OCOwnerId private constructor(var ownerId: String?) : Property {
+
+ class Factory : PropertyFactory {
+ override fun create(parser: XmlPullParser): Property {
+ try {
+ val text = readText(parser)
+ if (!TextUtils.isEmpty(text)) {
+ return OCOwnerId(text)
+ }
+ } catch (e: IOException) {
+ Log.e("OCId", "failed to create property", e)
+ } catch (e: XmlPullParserException) {
+ Log.e("OCId", "failed to create property", e)
+ }
+ return OCOwnerId("")
+ }
+
+ override fun getName(): Property.Name {
+ return NAME
+ }
+ }
+
+ companion object {
+ @JvmField
+ val NAME: Property.Name =
+ Property.Name(WebdavEntry.NAMESPACE_OC, WebdavEntry.EXTENDED_PROPERTY_OWNER_ID)
+ }
+}
diff --git a/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCSize.kt b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCSize.kt
new file mode 100644
index 0000000000..7f41c39b3b
--- /dev/null
+++ b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/OCSize.kt
@@ -0,0 +1,62 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Mario Danic
+ * @author Andy Scherzinger
+ * Copyright (C) 2021 Andy Scherzinger
+ * Copyright (C) 2017-2019 Mario Danic
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.nextcloud.talk.components.filebrowser.models.properties
+
+import android.text.TextUtils
+import android.util.Log
+import at.bitfire.dav4jvm.Property
+import at.bitfire.dav4jvm.PropertyFactory
+import at.bitfire.dav4jvm.XmlUtils.readText
+import com.owncloud.android.lib.common.network.WebdavEntry
+import org.xmlpull.v1.XmlPullParser
+import org.xmlpull.v1.XmlPullParserException
+import java.io.IOException
+
+class OCSize private constructor(var ocSize: Long) : Property {
+
+ class Factory : PropertyFactory {
+ override fun create(parser: XmlPullParser): Property {
+ try {
+ val text = readText(parser)
+ if (!TextUtils.isEmpty(text)) {
+ return OCSize(text!!.toLong())
+ }
+ } catch (e: IOException) {
+ Log.e("OCSize", "failed to create property", e)
+ } catch (e: XmlPullParserException) {
+ Log.e("OCSize", "failed to create property", e)
+ }
+ return OCSize(-1)
+ }
+
+ override fun getName(): Property.Name {
+ return NAME
+ }
+ }
+
+ companion object {
+ @JvmField
+ val NAME: Property.Name =
+ Property.Name(WebdavEntry.NAMESPACE_OC, WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE)
+ }
+}
diff --git a/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/Permissions.kt b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/Permissions.kt
new file mode 100644
index 0000000000..e53226771a
--- /dev/null
+++ b/library/src/main/java/com/owncloud/android/lib/resources/files/webdav/Permissions.kt
@@ -0,0 +1,47 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * Copyright (C) 2022 Tobias Kaminsky
+ * Copyright (C) 2022 Nextcloud GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+package com.owncloud.android.lib.resources.files.webdav
+
+import at.bitfire.dav4jvm.Property
+import at.bitfire.dav4jvm.PropertyFactory
+import at.bitfire.dav4jvm.XmlUtils
+import com.owncloud.android.lib.common.network.WebdavEntry
+import org.xmlpull.v1.XmlPullParser
+
+class Permissions internal constructor(var permissions: String) : Property {
+
+ companion object {
+ @JvmField
+ val NAME =
+ Property.Name(WebdavEntry.NAMESPACE_OC, WebdavEntry.EXTENDED_PROPERTY_NAME_PERMISSIONS)
+ }
+
+ class Factory : PropertyFactory {
+
+ override fun getName() = NAME
+
+ override fun create(parser: XmlPullParser) =
+ //
+ Permissions(XmlUtils.readText(parser) ?: "")
+ }
+}
diff --git a/library/src/main/java/com/owncloud/android/lib/resources/status/OCCapability.kt b/library/src/main/java/com/owncloud/android/lib/resources/status/OCCapability.kt
index 9ae4e729b7..93fc1ad380 100644
--- a/library/src/main/java/com/owncloud/android/lib/resources/status/OCCapability.kt
+++ b/library/src/main/java/com/owncloud/android/lib/resources/status/OCCapability.kt
@@ -27,14 +27,15 @@ package com.owncloud.android.lib.resources.status
/**
* Contains data of the Capabilities for an account, from the Capabilities API
*/
-class OCCapability {
+class OCCapability(
+ var versionMayor: Int = 0,
+ var versionMinor: Int = 0,
+ var versionMicro: Int = 0
+) {
var id: Long = 0
var accountName: String? = ""
// Server version
- var versionMayor = 0
- var versionMinor = 0
- var versionMicro = 0
var versionString: String? = ""
var versionEdition: String? = null
diff --git a/settings.gradle b/settings.gradle
index eaae9a3945..a0ca01735c 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,8 @@
include ':library'
include ':sample_client'
+
+includeBuild('/home/tobi/projekt/github/bitfireAT/dav4jvm/') {
+ dependencySubstitution {
+ substitute module('com.github.bitfireAT:dav4jvm') using project(':')
+ }
+}