浏览代码

OC-2582: Add methods isFileShareByLink and getFilePublicLink to FileDataStorageManager

masensio 11 年之前
父节点
当前提交
7aeda0b4dc
共有 1 个文件被更改,包括 30 次插入0 次删除
  1. 30 0
      src/com/owncloud/android/datamodel/FileDataStorageManager.java

+ 30 - 0
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();
+    }
 
 }