From: masensio Date: Thu, 16 Jan 2014 15:55:10 +0000 (+0100) Subject: OC-2582: Add methods isFileShareByLink and getFilePublicLink to FileDataStorageManager X-Git-Tag: oc-android-1.5.5~35^2~66 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/7aeda0b4dcf757ce5138c90916d7a33cf53e09b9?hp=--cc OC-2582: Add methods isFileShareByLink and getFilePublicLink to FileDataStorageManager --- 7aeda0b4dcf757ce5138c90916d7a33cf53e09b9 diff --git a/src/com/owncloud/android/datamodel/FileDataStorageManager.java b/src/com/owncloud/android/datamodel/FileDataStorageManager.java index 5c102d3e..af904d00 100644 --- a/src/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/src/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -715,5 +715,35 @@ public class FileDataStorageManager { } return file; } + + /** + * Returns if the file/folder is shared by link or not + * @param path Path of the file/folder + * @return + */ + public boolean isFileShareByLink(String path) { + Cursor c = getCursorForValue(ProviderTableMeta.FILE_STORAGE_PATH, path); + OCFile file = null; + if (c.moveToFirst()) { + file = createFileInstance(c); + } + c.close(); + return file.isShareByLink(); + } + + /** + * Returns the public link of the file/folder + * @param path Path of the file/folder + * @return + */ + public String getFilePublicLink(String path) { + Cursor c = getCursorForValue(ProviderTableMeta.FILE_STORAGE_PATH, path); + OCFile file = null; + if (c.moveToFirst()) { + file = createFileInstance(c); + } + c.close(); + return file.getPublicLink(); + } }