X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/3351db65273a8d8ff1d012e00025e728cc428419..40b5fb815613c4cf9023c9c9ad93cda0d2521f86:/src/com/owncloud/android/datamodel/FileDataStorageManager.java diff --git a/src/com/owncloud/android/datamodel/FileDataStorageManager.java b/src/com/owncloud/android/datamodel/FileDataStorageManager.java index f132d967..39b1959c 100644 --- a/src/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/src/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -33,7 +33,6 @@ import com.owncloud.android.lib.resources.files.FileUtils; import com.owncloud.android.utils.FileStorageUtils; import com.owncloud.android.utils.Log_OC; - import android.accounts.Account; import android.content.ContentProviderClient; import android.content.ContentProviderOperation; @@ -610,6 +609,35 @@ public class FileDataStorageManager { } + public Cursor getContent(long parentId) { + Log_OC.d(TAG, "getContent start"); + Uri req_uri = Uri.withAppendedPath( + ProviderTableMeta.CONTENT_URI_DIR, + String.valueOf(parentId)); + Cursor c = null; + + if (getContentProviderClient() != null) { + try { + c = getContentProviderClient().query(req_uri, null, + ProviderTableMeta.FILE_PARENT + "=?" , + new String[] { String.valueOf(parentId)}, null); + } catch (RemoteException e) { + Log_OC.e(TAG, e.getMessage()); + return c; + } + } else { + c = getContentResolver().query(req_uri, null, + ProviderTableMeta.FILE_PARENT + "=?" , + new String[] { String.valueOf(parentId)}, null); + + //Log_OC.d(TAG, "getContent Uri " + req_uri); + //c.setNotificationUri(getContentResolver(), req_uri); + } + + Log_OC.d(TAG, "getContent end"); + return c; + } + private OCFile createRootDir() { OCFile file = new OCFile(OCFile.ROOT_PATH); file.setMimetype("DIR"); @@ -674,33 +702,33 @@ public class FileDataStorageManager { return c; } - private Cursor getShareCursorForValue(String key, String value) { - Cursor c = null; - if (getContentResolver() != null) { - c = getContentResolver() - .query(ProviderTableMeta.CONTENT_URI_SHARE, - null, - key + "=? AND " - + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER - + "=?", - new String[] { value, mAccount.name }, null); - } else { - try { - c = getContentProviderClient().query( - ProviderTableMeta.CONTENT_URI_SHARE, - null, - key + "=? AND " + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER - + "=?", new String[] { value, mAccount.name }, - null); - } catch (RemoteException e) { - Log_OC.e(TAG, "Could not get file details: " + e.getMessage()); - c = null; - } - } - return c; - } +// private Cursor getShareCursorForValue(String key, String value) { +// Cursor c = null; +// if (getContentResolver() != null) { +// c = getContentResolver() +// .query(ProviderTableMeta.CONTENT_URI_SHARE, +// null, +// key + "=? AND " +// + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER +// + "=?", +// new String[] { value, mAccount.name }, null); +// } else { +// try { +// c = getContentProviderClient().query( +// ProviderTableMeta.CONTENT_URI_SHARE, +// null, +// key + "=? AND " + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER +// + "=?", new String[] { value, mAccount.name }, +// null); +// } catch (RemoteException e) { +// Log_OC.e(TAG, "Could not get file details: " + e.getMessage()); +// c = null; +// } +// } +// return c; +// } - private OCFile createFileInstance(Cursor c) { + public OCFile createFileInstance(Cursor c) { OCFile file = null; if (c != null) { file = new OCFile(c.getString(c @@ -838,25 +866,25 @@ public class FileDataStorageManager { return overriden; } - private OCShare getShareById(long id) { - Cursor c = getShareCursorForValue(ProviderTableMeta._ID, String.valueOf(id)); - OCShare share = null; - if (c.moveToFirst()) { - share = createShareInstance(c); - } - c.close(); - return share; - } - - private OCShare getShareByRemoteId(long remoteId) { - Cursor c = getShareCursorForValue(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, String.valueOf(remoteId)); - OCShare share = null; - if (c.moveToFirst()) { - share = createShareInstance(c); - } - c.close(); - return share; - } +// private OCShare getShareById(long id) { +// Cursor c = getShareCursorForValue(ProviderTableMeta._ID, String.valueOf(id)); +// OCShare share = null; +// if (c.moveToFirst()) { +// share = createShareInstance(c); +// } +// c.close(); +// return share; +// } +// +// private OCShare getShareByRemoteId(long remoteId) { +// Cursor c = getShareCursorForValue(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, String.valueOf(remoteId)); +// OCShare share = null; +// if (c.moveToFirst()) { +// share = createShareInstance(c); +// } +// c.close(); +// return share; +// } public OCShare getFirstShareByPathAndType(String path, ShareType type) { Cursor c = null; @@ -1301,4 +1329,5 @@ public class FileDataStorageManager { */ //} } + }