+ public ArrayList<OCShare> getSharesWithForAFile(String filePath, String accountName){
+ // Condition
+ String where = ProviderTableMeta.OCSHARES_PATH + "=?" + " AND "
+ + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?"+ "AND"
+ + " (" + 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()) };
+
+ Cursor c = null;
+ 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> shares = new ArrayList<OCShare>();
+ OCShare share = null;
+ if (c.moveToFirst()) {
+ do {
+ share = createShareInstance(c);
+ shares.add(share);
+ // }
+ } while (c.moveToNext());
+ }
+ c.close();
+
+ return shares;
+ }
+