/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
import java.util.List;
import java.util.Vector;
+import com.owncloud.android.Log_OC;
import com.owncloud.android.db.ProviderMeta;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import com.owncloud.android.utils.FileStorageUtils;
import android.database.Cursor;
import android.net.Uri;
import android.os.RemoteException;
-import android.util.Log;
public class FileDataStorageManager implements DataStorageManager {
cv, ProviderTableMeta._ID + "=?",
new String[] { String.valueOf(file.getFileId()) });
} catch (RemoteException e) {
- Log.e(TAG,
+ Log_OC.e(TAG,
"Fail to insert insert file to database "
+ e.getMessage());
}
result_uri = getContentProvider().insert(
ProviderTableMeta.CONTENT_URI_FILE, cv);
} catch (RemoteException e) {
- Log.e(TAG,
+ Log_OC.e(TAG,
"Fail to insert insert file to database "
+ e.getMessage());
}
}
} catch (OperationApplicationException e) {
- Log.e(TAG, "Fail to update/insert list of files to database " + e.getMessage());
+ Log_OC.e(TAG, "Fail to update/insert list of files to database " + e.getMessage());
} catch (RemoteException e) {
- Log.e(TAG, "Fail to update/insert list of files to database " + e.getMessage());
+ Log_OC.e(TAG, "Fail to update/insert list of files to database " + e.getMessage());
}
// update new id in file objects for insertions
if (results[i].uri != null) {
newId = Long.parseLong(results[i].uri.getPathSegments().get(1));
files.get(i).setFileId(newId);
- //Log.v(TAG, "Found and added id in insertion for " + files.get(i).getRemotePath());
+ //Log_OC.v(TAG, "Found and added id in insertion for " + files.get(i).getRemotePath());
}
}
}
ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?",
new String[] { mAccount.name }, null);
} catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
+ Log_OC.e(TAG, e.getMessage());
return ret;
}
} else {
+ ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?",
new String[] { value, mAccount.name }, null);
} catch (RemoteException e) {
- Log.e(TAG,
+ Log_OC.e(TAG,
"Couldn't determine file existance, assuming non existance: "
+ e.getMessage());
return false;
+ "=?", new String[] { value, mAccount.name },
null);
} catch (RemoteException e) {
- Log.e(TAG, "Could not get file details: " + e.getMessage());
+ Log_OC.e(TAG, "Could not get file details: " + e.getMessage());
c = null;
}
}
}
}
}
- if (removeDBData) {
- removeFile(dir, true);
- }
+ }
+ if (removeDBData) {
+ removeFile(dir, true);
}
}
}
ProviderTableMeta.FILE_ACCOUNT_OWNER + "=? AND " + ProviderTableMeta.FILE_PATH + " LIKE ?",
new String[] { mAccount.name, dir.getRemotePath() + "%" }, null);
} catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
+ Log_OC.e(TAG, e.getMessage());
}
} else {
c = getContentResolver().query(ProviderTableMeta.CONTENT_URI,
}
} catch (OperationApplicationException e) {
- Log.e(TAG, "Fail to update descendants of " + dir.getFileId() + " in database", e);
+ Log_OC.e(TAG, "Fail to update descendants of " + dir.getFileId() + " in database", e);
} catch (RemoteException e) {
- Log.e(TAG, "Fail to update desendants of " + dir.getFileId() + " in database", e);
+ Log_OC.e(TAG, "Fail to update desendants of " + dir.getFileId() + " in database", e);
}
}
}
+ @Override
+ public Vector<OCFile> getDirectoryImages(OCFile directory) {
+ Vector<OCFile> ret = new Vector<OCFile>();
+ if (directory != null) {
+ // TODO better implementation, filtering in the access to database (if possible) instead of here
+ Vector<OCFile> tmp = getDirectoryContent(directory);
+ OCFile current = null;
+ for (int i=0; i<tmp.size(); i++) {
+ current = tmp.get(i);
+ if (current.isImage()) {
+ ret.add(current);
+ }
+ }
+ }
+ return ret;
+ }
+
}