List of usage examples for android.os RemoteException getMessage
public String getMessage()
From source file:com.owncloud.android.datamodel.FileDataStorageManager.java
private Vector<OCFile> getFolderContent(long parentId/*, boolean onlyOnDevice*/) { Vector<OCFile> ret = new Vector<OCFile>(); Uri req_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, String.valueOf(parentId)); Cursor c = null;//from ww w . j a v a 2s . c o m 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 ret; } } else { c = getContentResolver().query(req_uri, null, ProviderTableMeta.FILE_PARENT + "=?", new String[] { String.valueOf(parentId) }, null); } if (c != null) { if (c.moveToFirst()) { do { OCFile child = createFileInstance(c); // TODO Enable when "On Device" is recovered ? // if (child.isFolder() || !onlyOnDevice || onlyOnDevice && child.isDown()){ ret.add(child); // } } while (c.moveToNext()); } c.close(); } Collections.sort(ret); return ret; }
From source file:com.owncloud.android.datamodel.FileDataStorageManager.java
private void cleanShares() { String where = ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?"; String[] whereArgs = new String[] { mAccount.name }; if (getContentResolver() != null) { getContentResolver().delete(ProviderTableMeta.CONTENT_URI_SHARE, where, whereArgs); } else {//from w w w .j a v a 2 s. c o m try { getContentProviderClient().delete(ProviderTableMeta.CONTENT_URI_SHARE, where, whereArgs); } catch (RemoteException e) { Log_OC.e(TAG, "Exception in cleanShares" + e.getMessage()); } } }
From source file:com.owncloud.android.datamodel.FileDataStorageManager.java
private Cursor getFileCursorForValue(String key, String value) { Cursor c = null;/* ww w . ja v a2s. co m*/ if (getContentResolver() != null) { c = getContentResolver().query(ProviderTableMeta.CONTENT_URI, null, key + "=? AND " + ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?", new String[] { value, mAccount.name }, null); } else { try { c = getContentProviderClient().query(ProviderTableMeta.CONTENT_URI, null, key + "=? AND " + ProviderTableMeta.FILE_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; }
From source file:com.owncloud.android.datamodel.FileDataStorageManager.java
private void resetShareFlagsInFolder(OCFile folder) { ContentValues cv = new ContentValues(); cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, false); cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false); cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, ""); String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + "=? AND " + ProviderTableMeta.FILE_PARENT + "=?"; String[] whereArgs = new String[] { mAccount.name, String.valueOf(folder.getFileId()) }; if (getContentResolver() != null) { getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs); } else {/* w w w . jav a 2 s .c o m*/ try { getContentProviderClient().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs); } catch (RemoteException e) { Log_OC.e(TAG, "Exception in resetShareFlagsInFolder " + e.getMessage()); } } }
From source file:com.owncloud.android.datamodel.FileDataStorageManager.java
private void resetShareFlagInAFile(String filePath) { ContentValues cv = new ContentValues(); cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, false); cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false); cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, ""); String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + "=? AND " + ProviderTableMeta.FILE_PATH + "=?"; String[] whereArgs = new String[] { mAccount.name, filePath }; if (getContentResolver() != null) { getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs); } else {// w w w .j ava 2 s.c o m try { getContentProviderClient().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs); } catch (RemoteException e) { Log_OC.e(TAG, "Exception in resetShareFlagsInFolder " + e.getMessage()); } } }
From source file:com.owncloud.android.datamodel.FileDataStorageManager.java
private void resetShareFlagsInAllFiles() { ContentValues cv = new ContentValues(); cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, false); cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false); cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, ""); String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?"; String[] whereArgs = new String[] { mAccount.name }; if (getContentResolver() != null) { getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs); } else {//from w w w . j a va2 s . co m try { getContentProviderClient().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs); } catch (RemoteException e) { Log_OC.e(TAG, "Exception in resetShareFlagsInAllFiles" + e.getMessage()); } } }
From source file:com.owncloud.android.datamodel.FileDataStorageManager.java
public ArrayList<OCShare> getPublicSharesForAFile(String filePath, String accountName) { // Condition// w w w . j a v a 2s . c o m String where = ProviderTableMeta.OCSHARES_PATH + "=?" + " AND " + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?" + "AND " + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? "; String[] whereArgs = new String[] { filePath, accountName, Integer.toString(ShareType.PUBLIC_LINK.getValue()) }; Cursor c; if (getContentResolver() != null) { c = getContentResolver().query(ProviderTableMeta.CONTENT_URI_SHARE, null, where, whereArgs, null); } else { try { c = getContentProviderClient().query(ProviderTableMeta.CONTENT_URI_SHARE, null, where, whereArgs, null); } catch (RemoteException e) { Log_OC.e(TAG, "Could not get list of shares with: " + e.getMessage()); c = null; } } ArrayList<OCShare> publicShares = new ArrayList<>(); OCShare publicShare; if (c != null) { if (c.moveToFirst()) { do { publicShare = createShareInstance(c); publicShares.add(publicShare); // } } while (c.moveToNext()); } c.close(); } return publicShares; }
From source file:com.owncloud.android.datamodel.FileDataStorageManager.java
public ArrayList<OCShare> getPrivateSharesForAFile(String filePath, String accountName) { // Condition/*from w w w .ja va 2s. co m*/ String where = ProviderTableMeta.OCSHARES_PATH + "=?" + " AND " + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?" + "AND" + " (" + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? OR " + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? OR " + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? ) "; String[] whereArgs = new String[] { filePath, accountName, Integer.toString(ShareType.USER.getValue()), Integer.toString(ShareType.GROUP.getValue()), Integer.toString(ShareType.FEDERATED.getValue()) }; Cursor c; if (getContentResolver() != null) { c = getContentResolver().query(ProviderTableMeta.CONTENT_URI_SHARE, null, where, whereArgs, null); } else { try { c = getContentProviderClient().query(ProviderTableMeta.CONTENT_URI_SHARE, null, where, whereArgs, null); } catch (RemoteException e) { Log_OC.e(TAG, "Could not get list of shares with: " + e.getMessage()); c = null; } } ArrayList<OCShare> privateShares = new ArrayList<>(); OCShare privateShare; if (c != null) { if (c.moveToFirst()) { do { privateShare = createShareInstance(c); privateShares.add(privateShare); } while (c.moveToNext()); } c.close(); } return privateShares; }
From source file:com.owncloud.android.datamodel.FileDataStorageManager.java
/** * Gets a {@link Cursor} for an stored {@link OCShare} in the current account * matching a given column and a value for that column * * @param key Name of the column to match. * @param value Value of the column to match. * @return 'True' if a matching {@link OCShare} is stored in the current account. *///from ww w . j a va 2s .com private Cursor getShareCursorForValue(String key, String value) { Cursor c; 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.w(TAG, "Could not get details, assuming share does not exist: " + e.getMessage()); c = null; } } return c; }
From source file:com.owncloud.android.datamodel.FileDataStorageManager.java
private Cursor getCapabilityCursorForAccount(String accountName) { Cursor c = null;/*from w w w. ja va2s . co m*/ if (getContentResolver() != null) { c = getContentResolver().query(ProviderTableMeta.CONTENT_URI_CAPABILITIES, null, ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=? ", new String[] { accountName }, null); } else { try { c = getContentProviderClient().query(ProviderTableMeta.CONTENT_URI_CAPABILITIES, null, ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=? ", new String[] { accountName }, null); } catch (RemoteException e) { Log_OC.e(TAG, "Couldn't determine capability existance, assuming non existance: " + e.getMessage()); } } return c; }